Skip to content

[BUG](loaders): Resize textual inversion embeddings to encoder width - #15432

Open
Sakibpedia wants to merge 1 commit into
huggingface:mainfrom
Sakibpedia:fix-ti-embedding-size
Open

Sakibpedia wants to merge 1 commit into
huggingface:mainfrom
Sakibpedia:fix-ti-embedding-size

Conversation

@Sakibpedia

Copy link
Copy Markdown

What

Textual inversion embeddings trained for a text encoder with a different width were rejected by load_textual_inversion. They are now linearly resized to the target encoder width, with a warning that the resized concept may differ from the original. The stale brace-format error message was also removed.

Tests

  • pytest tests/others/test_textual_inversion_embedding_size.py -q (regression test fails before the change, passes after)
  • python -m ruff check and python -m ruff format --check on the changed files

Fixes #10373

Fixes huggingface#10373: linearly resize textual inversion embeddings whose width differs from the text encoder instead of raising, and fix the outdated error message.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Request] Compatibility of textual inversion between SD 1.5 and SD 2.1

1 participant