huggingface / huggingface/diffusers

Loading loras on "text_pipe" of a modular pipeline fails

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

説明

### Describe the bug

The following code works:

```python
import torch
from diffusers import Flux2Pipeline

pipe = Flux2Pipeline.from_pretrained("black-forest-labs/FLUX.2-dev", torch_dtype=torch.bfloat16)
pipe.load_lora_weights("flux.2-turbo-lora.safetensors")
```

but on modular it doesn't:

```python
import torch
from diffusers import ModularPipeline

pipe = ModularPipeline.from_pretrained("black-forest-labs/FLUX.2-dev")
blocks = pipe.blocks
text_blocks = blocks.sub_blocks.pop("text_encoder")
text_pipe = text_blocks.init_pipeline("black-forest-labs/FLUX.2-dev")
text_pipe.load_components(torch_dtype=torch.bfloat16)
text_pipe.load_lora_weights("flux.2-turbo-lora.safetensors")
text_pipe.set_adapters(["default"], adapter_weights=[1])
```

The lora is found here: https://huggingface.co/fal/FLUX.2-dev-Turbo/blob/main/flux.2-turbo-lora.safetensors

### Logs

```shell
src/diffusers/configuration_utils.py", line 176, in __getattr__
raise AttributeError(f"'{type(self).__name__}' object has no attribute '{name}'")
AttributeError: 'Flux2ModularPipeline' object has no attribute 'transformer'. Did you mean: 'transformer_name'?
```

### System Info

Latest commit of Diffusers 71a6fd9f0df04d3764dfa999268a05d87903a85a

### Who can help?

@yiyixuxu @DN6 @sayakpaul

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

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

調査の方向性

text_blocks.init_pipeline()、load_components()、load_lora_weights()、set_adapters()を使用するModularPipelineの例から始めます。src/diffusers/configuration_utils.py:176のAttributeErrorを追跡し、この経路を動作するFlux2Pipelineの例と比較します。text_pipeが、transformer属性がないことによるエラーを発生させずにLoRAをロードして有効化できれば完了です。

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

評価

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

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

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