Repository navigation
[LoRA] strip the stale text_model. prefix from Kohya CLIP text-encoder LoRAs on transformers >= 5.6 - #1
Closed
christopher5106 wants to merge 1 commit into
Closed
[LoRA] strip the stale text_model. prefix from Kohya CLIP text-encoder LoRAs on transformers >= 5.6#1christopher5106 wants to merge 1 commit into
christopher5106 wants to merge 1 commit into
Conversation
…t-encoder LoRAs on transformers >= 5.6 transformers 5.6 flattened CLIPTextModel, so named_modules() no longer yields `text_model.*` names while kohya-converted FLUX LoRAs still carry that prefix. The rank dict came out empty and _create_lora_config raised IndexError (huggingface#13984). Upstream closed the fix (huggingface#14029) wanting a general solution; this carries it on the scenario branch until one lands. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> (cherry picked from commit 4148971)
Author
|
Merged upstream as huggingface#14872. The branch is deleted and |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Upstream: fixed upstream by huggingface#14872, another contributor's PR merged on 2026-09-28, which applies the same
text_model.strip. The bug is huggingface#13984. This branch is now redundant: it is due for deletion, and this PR will be closed at the next re-sync.Problem: transformers 5.6 flattened
CLIPTextModel, so its modules are no longer nested undertext_model.. Loading a Kohya FLUX.1 LoRA that carries CLIP text-encoder weights (lora_te1_*keys) still producestext_model.-prefixed names, matches no module, and fails with anIndexErroron an empty rank.Change:
lora_base.pystrips the staletext_model.prefix when the text encoder has no such submodule (8 lines).Test:
test_kohya_clip_text_encoder_lora_under_flattened_clipintests/pipelines/flux/test_pipeline_flux.pyfails without the patch and passes with it.In
scenario: yes, cherry-picked.