-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FLUX CFG support #7152
Merged
Merged
FLUX CFG support #7152
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
How does |
13 tasks
hipsterusername
approved these changes
Oct 22, 2024
22146b0
to
d20b894
Compare
psychedelicious
added a commit
that referenced
this pull request
Oct 22, 2024
## Summary This PR adds support for the XLabs IP-Adapter (https://huggingface.co/XLabs-AI/flux-ip-adapter) in workflows. Linear UI integration is coming in a follow-up PR. The XLabs IP-Adapter can be installed in the Starter Models tab. Usage tips: - Use a `cfg_scale` value of 2.0 to 4.0 - Start with an IP-Adatper weight of ~0.6 and adjust from there. - Set `cfg_scale_start_step = 1` - Set `cfg_scale_end_step` to roughly the halfway point (it's unnecessary to apply CFG to all steps, and this will improve processing time). Sample workflow: <img width="976" alt="image" src="https://github.com/user-attachments/assets/4627b459-7e5a-4703-80e7-f7575c5fce19"> Result: ![image](https://github.com/user-attachments/assets/220b6a4c-69c6-447f-8df6-8aa6a56f3b3f) ## Related Issues / Discussions Prerequisite: #7152 ## Remaining TODO: - [ ] Update default workflows. ## QA Instructions - [x] Test basic happy path - [x] Test with multiple IP-Adapters (it runs, but results aren't great) - [ ] ~Test with multiple images to a single IP-Adapter~ (this is not supported for now) - [ ] Test automatic runtime installation of CLIP-L, CLIP-H, and CLIP-G image encoder models if they are not already installed. - [ ] Test starter model installation of the XLabs FLUX IP-Adapter - [ ] Test SD and SDXL IP-Adapters for regression. - [ ] Check peak memory utilization. ## Merge Plan - [ ] Merge #7152 - [ ] Change target branch to main ## Checklist - [x] _The PR has a short but descriptive title, suitable for a changelog_ - [x] _Tests added / updated (if applicable)_ - [ ] _Documentation added / updated (if applicable)_
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
backend
PRs that change backend files
invocations
PRs that change invocations
python
PRs that change python files
python-tests
PRs that change python tests
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Add support for Classifier-Free Guidance with FLUX.
cfg_scale != 1.0
cfg_scale == 1.0
(i.e. no compute overhead in this case)cfg_scale_start_step
andcfg_scale_end_step
can be used to easily control the range of steps that CFG is applied for.Example
Positive Caption:
![image](https://private-user-images.githubusercontent.com/14897797/378007451-f25ff832-d69b-4c5f-88f4-9429ce96d598.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk5MTE1MTEsIm5iZiI6MTczOTkxMTIxMSwicGF0aCI6Ii8xNDg5Nzc5Ny8zNzgwMDc0NTEtZjI1ZmY4MzItZDY5Yi00YzVmLTg4ZjQtOTQyOWNlOTZkNTk4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE4VDIwNDAxMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTU4MTY4OTQ3MDQ3MDdiZTZkOWQ4N2ZjOTZkMDk5YTU0ZDIyOWQ2MzZhMmFjNGUyMWRiYjBjMmI1NjA3YjVhZjQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.JpTRHcLGtTdAPSB9sNKbT-HHrhvqk0p16w_LeYoUicQ)
Professional photography of a luxury hotel in the Nevada desert
CFG: 1.0
Positive Caption:
![image](https://private-user-images.githubusercontent.com/14897797/378008486-27e3b952-2795-469f-bb24-b7fddb726ba1.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk5MTE1MTEsIm5iZiI6MTczOTkxMTIxMSwicGF0aCI6Ii8xNDg5Nzc5Ny8zNzgwMDg0ODYtMjdlM2I5NTItMjc5NS00NjlmLWJiMjQtYjdmZGRiNzI2YmExLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE4VDIwNDAxMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWYxMTAzZGY5NGNhYjI3MjdjYTVjOTMzMDllMzdlZjgzNDZlMzI5YWU2NDYyYWM0ZGIxYzRjMTljNzhkZGIwNGYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.p-bztiFwuNhGm5cosL8B910e8q4Gdoz_z9USdaVJyZU)
Professional photography of a luxury hotel in the Nevada desert
Negative Caption:
Swimming pool
CFG: 2.0
Same seed
QA Instructions
cfg_scale_start_step
andcfg_scale_end_step
control the range of steps that CFG is appliedChecklist