huggingface / huggingface/diffusers

Error while loading Lora

Ouverte
#11,286 2 commentaires 1 réaction 0 personnes assignées Voir sur GitHub
bug stale
Langage dominant
Python
Étoiles
34.5k
Forks
7.3k
Merge moyen
3 j 3 h
PR mergées (30 j)
91

Description

### Describe the bug

`Error(s) in loading state_dict for UNet2DConditionModel`. I have uploaded the model on hugging face. Error appears on load_lora_weights() function.

### Reproduction

```

from diffusers import DiffusionPipeline

pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0")
pipe.load_lora_weights("D1-3105/lora_bug-1")

prompt = "abstract portrait of 1girl,undefined gender,fragmented visual style,red and black color palette,evokes feelings of rebellion,passion,and freedom,blurred boundaries,high resolution,aesthetic,"
image = pipe(prompt).images[0]

```

### Logs

```shell
Loading default_0 was unsucessful with the following error:
Error(s) in loading state_dict for UNet2DConditionModel:
size mismatch for down_blocks.1.attentions.0.proj_in.lora_A.default_0.weight: copying a param with shape torch.Size([32, 640, 1, 1]) from checkpoint, the shape in current model is torch.Size([32, 640]).
size mismatch for down_blocks.1.attentions.0.proj_in.lora_B.default_0.weight: copying a param with shape torch.Size([640, 32, 1, 1]) from checkpoint, the shape in current model is torch.Size([640, 32]).
size mismatch for down_blocks.1.attentions.0.transformer_blocks.0.attn2.to_k.lora_A.default_0.weight: copying a param with shape torch.Size([32, 768]) from checkpoint, the shape in current model is torch.Size([32, 2048]).
size mismatch for down_blocks.1.attentions.0.transformer_blocks.0.attn2.to_v.lora_A.default_0.weight: copying a param with shape torch.Size([32, 768]) from checkpoint, the shape in current model is torch.Size([32, 2048]).
size mismatch for down_blocks.1.attentions.0.proj_out.lora_A.default_0.weight: copying a param with shape torch.Size([32, 640, 1, 1]) from checkpoint, the shape in current model is torch.Size([32, 640]).
........
```

### System Info

System Info

Diffusers version: Version: 0.33.0.dev0
Python: 3.12.9

### Who can help?

@sayakpaul

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez par exécuter la reproduction fournie de DiffusionPipeline et examinez le point d’entrée load_lora_weights() avec les incompatibilités signalées dans le state-dict de UNet2DConditionModel. Comparez les formes des tenseurs du checkpoint avec les formes attendues par le modèle actuel ; l’issue est terminée lorsque le LoRA référencé se charge correctement et que le prompt s’exécute sans ces erreurs.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
python, pytorch
Domaine
machine-learning
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
À clarifier
Accessibilité débutants
25/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.