Skip to content

Expanded IP Adapter modes. #8011

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

Merged
merged 11 commits into from
May 19, 2025
Merged

Expanded IP Adapter modes. #8011

merged 11 commits into from
May 19, 2025

Conversation

hipsterusername
Copy link
Member

@hipsterusername hipsterusername commented May 18, 2025

This pull request introduces enhancements to the IP-Adapter functionality, including the addition of two new methods (style_strong and style_precise) and corresponding updates across the backend and frontend to support these methods. Key changes include updates to data models, invocation logic, attention processing, and the user interface.

Backend Enhancements to IP-Adapter:

  • New Methods and Logic:

    • Added style_strong and style_precise methods to the IPAdapterInvocation class, with specific logic for determining target attention blocks based on the base type (e.g., sd-1, sdxl). ([[1]](https://github.com/invoke-ai/InvokeAI/pull/8011/files#diff-c63c2992c76f7ae765f25b13f9ecd2b8bb63eef5e5159dfa218a37926f95f980L97-R98), [[2]](https://github.com/invoke-ai/InvokeAI/pull/8011/files#diff-c63c2992c76f7ae765f25b13f9ecd2b8bb63eef5e5159dfa218a37926f95f980R151-R182))
  • Attention Processing Updates:

    • With the help of matt3o, modified CustomAttnProcessor2_0 to handle negative attention blocks for the style_precise method. This is, admittedly, less sophisticated than processing the entire negative block as a separate point of control, but the amount of work involved in that (and the likelihood of that being needed in the future, given this is for Diffusers/SDXL) seems low. ([invokeai/backend/stable_diffusion/diffusion/custom_atttention.pyR166-R169](https://github.com/invoke-ai/InvokeAI/pull/8011/files#diff-2674cdb025f9eb53c71d878340376496d4f2cbf9d1ca77d7a048ea031124e8a2R166-R169))
    • Enhanced UNetAttentionPatcher to mark specific blocks as negative when using the style_precise method. ([invokeai/backend/stable_diffusion/diffusion/unet_attention_patcher.pyR43-R50](https://github.com/invoke-ai/InvokeAI/pull/8011/files#diff-500c7c7bdd4c31b28a0bea8009cd83b12ccb32813cfef4a0db0024607d8a9062R43-R50))

Frontend Updates for IP-Adapter Configuration:

  • UI Enhancements:

    • Added style_strong and style_precise options to the IP-Adapter method dropdown in the user interface, along with descriptions. ([invokeai/frontend/web/src/features/controlLayers/components/IPAdapter/IPAdapterMethod.tsxR38-R47](https://github.com/invoke-ai/InvokeAI/pull/8011/files#diff-a8e1c058bc6b8e47c2b9d696b5fff027d12f45d755977add5ad779ac00254630R38-R47))
  • Schema and Type Updates:

    • Extended the zIPMethodV2 and related schemas to include the new methods, ensuring validation and type safety. ([[1]](https://github.com/invoke-ai/InvokeAI/pull/8011/files#diff-41b99074662523f313cc66e9d6ce8fa9067ac0a87dbf8bcd374554dc533fbcf9L53-R53), [[2]](https://github.com/invoke-ai/InvokeAI/pull/8011/files#diff-21f94e3b560358a31df37b048dc4077c48c02f38c55068a6ffc4f11be239f07aL150-R150), [[3]](https://github.com/invoke-ai/InvokeAI/pull/8011/files#diff-7000f59d98ff3b216f5408fecd7c6ff301af310cd1f6d8301d08553fc696d4c4L9173-R9173), [[4]](https://github.com/invoke-ai/InvokeAI/pull/8011/files#diff-7000f59d98ff3b216f5408fecd7c6ff301af310cd1f6d8301d08553fc696d4c4L9299-R9299))## Summary

QA Instructions

Should test all previous instances of IP Adapter vs new
Regression:

  • SD1 Style
  • SD1 Composition
  • SD1 Full
  • SDXL Style
  • SDXL Composition
  • SDXL Full
  • Multiple IP Adapters

Functionality:

  • SD1 Style Precise
  • SD1 Style Strong
  • SDXL Style Precise
  • SDXL Style Strong

Merge Plan

Checklist

  • The PR has a short but descriptive title, suitable for a changelog
  • Tests added / updated (if applicable)
  • Documentation added / updated (if applicable)
  • Updated What's New copy (if doing a release after this PR)

@github-actions github-actions bot added python PRs that change python files invocations PRs that change invocations backend PRs that change backend files frontend PRs that change frontend files labels May 18, 2025
@hipsterusername hipsterusername force-pushed the IP-Adapter-Expansion2 branch from 64a2ded to 28c864c Compare May 18, 2025 13:30
@hipsterusername hipsterusername marked this pull request as ready for review May 18, 2025 19:51
@hipsterusername
Copy link
Member Author

@psychedelicious -- I'm not entirely sure why the typegen checks are failing -- but i think i've worked with matt3o to get everything wired in correctly, and have tested vs main to confirm no regressions (although as a note, did just test the IP adapter plus models)

Copy link
Collaborator

@psychedelicious psychedelicious left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just needed to re-gen the types, looks good now

@psychedelicious psychedelicious enabled auto-merge (rebase) May 19, 2025 00:36
@psychedelicious psychedelicious force-pushed the IP-Adapter-Expansion2 branch from ed99a28 to 349a109 Compare May 19, 2025 00:36
@psychedelicious psychedelicious force-pushed the IP-Adapter-Expansion2 branch from 349a109 to 97aab5a Compare May 19, 2025 03:43
@psychedelicious psychedelicious merged commit e84b3c1 into main May 19, 2025
12 checks passed
@psychedelicious psychedelicious deleted the IP-Adapter-Expansion2 branch May 19, 2025 03:50
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 frontend PRs that change frontend files invocations PRs that change invocations python PRs that change python files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants