[bug]: FLUX.1 diffusers-format LoRAs with text-encoder layers fail to load
I maintainer di solito rispondono entro 2 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 75/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- python
- Ambito
- backend, machine-learning
Direzione di ricerca
Inizia in invokeai/backend/patches/lora_conversions/flux_diffusers_lora_conversion_utils.py a lora_model_from_flux_diffusers_state_dict. Rifletti il percorso kohya mappando text_encoder. a FLUX_LORA_CLIP_PREFIX e text_encoder_2. a FLUX_LORA_T5_PREFIX. Esegui lo script repro fornito per confermare che l'AssertionError è scomparso e i layer text-encoder si caricano.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Is there an existing issue for this problem?
- I have searched the existing issues
Install method
Manual (dev checkout)
Operating system
Windows
GPU vendor
Not GPU-specific (reproduced on CPU)
GPU model
No response
GPU VRAM
No response
Version number
main at 0ddc9df91b
What happened
A FLUX.1 diffusers-format LoRA that also trains the text encoders fails to load:
File "invokeai/backend/patches/lora_conversions/flux_diffusers_lora_conversion_utils.py", line 288, in lora_layers_from_flux_diffusers_grouped_state_dict
assert len(grouped_state_dict) == 0
AssertionError
diffusers' FLUX LoRA layout keeps the CLIP layers under text_encoder., next to the transformer. layers. OneTrainer additionally writes T5 layers under text_encoder_2.. lora_model_from_flux_diffusers_state_dict converts transformer keys only, so any text-encoder key is left over and trips the closing assert. The whole LoRA is rejected, transformer layers included.
The kohya path already applies FLUX text-encoder layers through FLUX_LORA_CLIP_PREFIX / FLUX_LORA_T5_PREFIX.
What you expected to happen
text_encoder.* maps to the CLIP prefix and text_encoder_2.* to the T5 prefix, as the kohya lora_te1_ / lora_te2_ keys do. At minimum, unknown keys are reported with their names instead of a bare AssertionError.
How to reproduce the problem
import torch
import invokeai.backend.model_manager.load # noqa: F401
from invokeai.backend.patches.lora_conversions.flux_diffusers_lora_conversion_utils import (
lora_model_from_flux_diffusers_state_dict,
)
def peft(prefix: str, d: int) -> dict:
return {f"{prefix}.lora_A.weight": torch.randn(4, d), f"{prefix}.lora_B.weight": torch.randn(d, 4)}
sd = peft("transformer.transformer_blocks.0.attn.to_out.0", 3072) | peft(
"text_encoder.text_model.encoder.layers.0.self_attn.q_proj", 768
)
lora_model_from_flux_diffusers_state_dict(sd, alpha=None)
Additional context
OneTrainer writes FLUX.1 LoRAs with trained CLIP and T5 in exactly this layout.
Found while checking every LoRA layout OneTrainer writes (b08db37) against main: OneTrainer's own savers run on meta-device models of the real architectures, then identification, LoRALoader and LayerPatcher module resolution on the InvokeAI model.
Discord username
No response
- Lingua principale
- TypeScript
- Stelle
- 28.8k
- Fork
- 3.1k
- Merge medio
- 3g 2h
- PR unite (30g)
- 159
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di invoke-ai/InvokeAI
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 2 giorni
-
bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
I maintainer di solito rispondono entro 2 giorni
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 2 giorni
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 2 giorni
-
[enhancement]: Bump PyPatchMatch to latestForse già presa @dunkeroni l’ha presa 10 giorni fa. Apertaenhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
invoke-ai/InvokeAI#9826 · 2 reazioni · 1 assegnatario ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di invoke-ai/InvokeAI
Issue simili
-
type: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
I maintainer di solito rispondono entro 1 giorno
-
0️⃣ phase/new
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 70/100
microsoft/playwright#43640 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100