Skip to content

feat: reduce CLIP memory usage with no embeddings #768

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

wbruna
Copy link
Contributor

@wbruna wbruna commented Aug 14, 2025

The CLIP weights need to be converted to f32 for textual inversions (fbd42b6, for #601), but that increases the amount of allocated VRAM even when embeddings aren't being used.

On a typical SDXL render on Vulkan, this change reduces peak VRAM usage around 190MB.

I'm including a refactor of the clip_skip handling, since this change would end up conflicting with it. Please let me know if I shall submit it separately instead.

wbruna added 2 commits August 14, 2025 12:12
All handlers are constructed with the default clip_skip value, and
it is always set during inference time, so there isn't much point
in keeping it as a persistent attribute. Instead, just propagate
the parameter value down from get_learned_condition*.
The CLIP weights need to be converted to f32 for textual inversions
(fbd42b6), but that increases the
amount of allocated VRAM even when embeddings aren't being used.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant