Support CLIP skip for SDXL (see description) #12518
Closed
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.
Description
Note: making this PR just to bring this to discussion.
This PR adds a form of supporting CLIP skip with SDXL. I added this since scripts like the XYZ plot support changing this and I don't think users should be mislead to believe all the CLIP layers behave the same, but this does have several issues:
encode_with_transformer
only returnslast
,penultimate
, andpooled
(I don't know enough about SDXL's arch to know what this is honestly). The way Stability handles this also implies the last and penultimate are the only layers that should ever be used. https://github.com/Stability-AI/generative-models/blob/45c443b316737a4ab6e40413d7794a7f5657c19f/sgm/modules/encoders/modules.py#L442-L447Also some potentially useful info, courtesy of Anonymous: https://boards.4channel.org/g/thread/95329616#p95329692
Checklist: