huggingface / huggingface/diffusers

KeyError when loading LoRA for Flux model: missing lora_unet_final_layer_adaLN_modulation_1 weights

Abierto
#11,964 4 comentarios 0 reacciones 0 asignados Ver en GitHub
stale
Lenguaje dominante
Python
Estrellas
34.5k
Forks
7.3k
Merge medio
3 d 3 h
PR fusionados (30 d)
91

Descripción

I'm trying to run Overlay-Kontext-Dev-LoRA locally by loading the LoRA weights using the pipe.load_lora_weights() function. However, I encountered the following error during execution:

> KeyError: 'lora_unet_final_layer_adaLN_modulation_1.lora_down.weight'

```
import torch
from diffusers import DiffusionPipeline
from diffusers.utils import load_image

Load the pipeline with a specific torch data type for GPU optimization
pipe = DiffusionPipeline.from_pretrained(
"black-forest-labs/FLUX.1-Kontext-dev",
torch_dtype=torch.bfloat16
)

Move the entire pipeline to the GPU
pipe.to("cuda")

Load LoRA weights (this will also be on the GPU)
pipe.load_lora_weights("ilkerzgi/Overlay-Kontext-Dev-LoRA")

prompt = "Place it"
input_image = load_image("img2.png")

The pipeline will now run on the GPU
image = pipe(image=input_image, prompt=prompt).images[0]

image.save("output_image.png")
```

Environment:
diffusers version: 0.35.0.dev0
Python: 3.10
Running locally on a ubuntu environment with RTX 4090

> Additional Note:
> The model file size is also quite large. I may need to quantize it before running it on the 4090 to avoid out-of-memory issues.
>
> Would appreciate any help or suggestions on how to resolve the loading issue. Thank you!

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza reproduciendo el script de Python proporcionado con diffusers 0.35.0.dev0 e inspecciona el punto de entrada pipe.load_lora_weights() usando los modelos Overlay-Kontext-Dev-LoRA y FLUX.1-Kontext-dev. Compara las claves de LoRA con las claves esperadas por el pipeline y considera terminado el issue cuando los pesos se carguen sin el error missing lora_unet_final_layer_adaLN_modulation_1.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
python, pytorch
Área
machine-learning
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Necesita aclaración
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.