huggingface / huggingface/diffusers

Loading loras on "text_pipe" of a modular pipeline fails

Ouverte
#13,487 4 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
bug lora modular-pipelines
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

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

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez par l’exemple de ModularPipeline en utilisant text_blocks.init_pipeline(), load_components(), load_lora_weights() et set_adapters(). Suivez l’AttributeError dans src/diffusers/configuration_utils.py:176 et comparez ce chemin avec l’exemple fonctionnel de Flux2Pipeline. La tâche est terminée lorsque text_pipe peut charger et activer la LoRA sans l’erreur d’attribut transformer manquant.

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é
3/5
Temps estimé
1-2 jours
Activité
Calme
Clarté
Plutôt claire
Accessibilité débutants
52/100

Recevez les nouvelles issues par e-mail

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