huggingface / huggingface/diffusers

Loading loras on "text_pipe" of a modular pipeline fails

Offen
#13,487 4 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
bug lora modular-pipelines
Vorherrschende Sprache
Python
Sterne
34.5k
Forks
7.3k
Ø Merge
3 T. 3 Std.
Gemergte PRs (30 T.)
91

Beschreibung

### 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

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne mit dem ModularPipeline-Beispiel unter Verwendung von text_blocks.init_pipeline(), load_components(), load_lora_weights() und set_adapters(). Verfolge den AttributeError in src/diffusers/configuration_utils.py:176 und vergleiche diesen Pfad mit dem funktionierenden Flux2Pipeline-Beispiel. Erledigt ist die Aufgabe, wenn text_pipe die LoRA laden und aktivieren kann, ohne den Fehler aufgrund des fehlenden transformer-Attributs auszulösen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python, pytorch
Bereich
machine-learning
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Ruhig
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
52/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.