huggingface / huggingface/diffusers

Error in loading Lora

オープン
#11,209 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る
bug lora stale
主要言語
Python
スター
34.5k
フォーク
7.3k
平均マージ
3日 3時間
マージ済み PR(30日)
91

説明

### Describe the bug

`lora_unet_down_blocks_1_attentions_0_transformer_blocks_0_attn1_to_k.alpha` not supported error. 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("artemonlysuno/sdxl-lora-neutral")

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
Traceback (most recent call last):
File "/home/user/runware/Oleg/sd-base-api/test_lora.py", line 5, in
pipe.load_lora_weights("artemonlysuno/sdxl-lora-neutral")
File "/home/user/anaconda3/envs/3.7/lib/python3.12/site-packages/diffusers/loaders/lora_pipeline.py", line 543, in load_lora_weights
state_dict, network_alphas = self.lora_state_dict(
^^^^^^^^^^^^^^^^^^^^^
File "/home/user/anaconda3/envs/3.7/lib/python3.12/site-packages/huggingface_hub/utils/_validators.py", line 114, in _inner_fn
return fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^
File "/home/user/anaconda3/envs/3.7/lib/python3.12/site-packages/diffusers/loaders/lora_pipeline.py", line 698, in lora_state_dict
state_dict = _maybe_map_sgm_blocks_to_diffusers(state_dict, unet_config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/anaconda3/envs/3.7/lib/python3.12/site-packages/diffusers/loaders/lora_conversion_utils.py", line 59, in _maybe_map_sgm_blocks_to_diffusers
raise ValueError(f"Checkpoint not supported because layer {layer} not supported.")
ValueError: Checkpoint not supported because layer lora_unet_down_blocks_1_attentions_0_transformer_blocks_0_attn1_to_k.alpha not supported.
```

### System Info

Diffusers version: Version: 0.33.0.dev0
Python: 3.12.9

### Who can help?

@sayakpaul

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

Start in diffusers/loaders/lora_conversion_utils.py at _maybe_map_sgm_blocks_to_diffusers and follow its call from diffusers/loaders/lora_pipeline.py. Reproduce the load_lora_weights() example with the linked Hugging Face model and determine whether the reported .alpha layer is handled; done means the checkpoint loads without the unsupported-layer error.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
huggingface, python, pytorch
領域
machine-learning
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
42/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。