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.
What does this PR do?
Adds support for XLabs Flux IP Adapter.
Example
flux-ip-adapter-v2
Details
Note:
true_cfg=1.0
is important, andstrength
is sensitive, fixed strength may not work, see here for more strength schedules, good results will require experimentation with strength schedules and the start/stop values. Results also vary with input image, I had no success with the statue image used for v1 test.Multiple input images is not yet supported (dev note: apply
torch.mean
to the batch ofimage_embeds
and toip_attention
)Notes
--timestep_to_start_cfg
greater than the number of steps to disable CFGpipeline_flux_with_cfg
community example, except we run positive and negative separately.load_ip_adapter
.load_ip_adapter
supportsimage_encoder_pretrained_model_name_or_path
e.g."openai/clip-vit-large-patch14"
rather than justimage_encoder_folder
, also supportsimage_encoder_dtype
with defaulttorch.float16
.FluxTransformerBlock
because of where ip_attention is applied to thehidden_states
, see here in the original codebase.flux-ip-adapter-v2 will be fixed and tested shortly.Fixes #9825
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.
@sayakpaul @yiyixuxu @DN6