huggingface / huggingface/diffusers

Loading loras on "text_pipe" of a modular pipeline fails

Open
#13,487 4 comments 0 reactions 0 assignees View on GitHub
bug lora modular-pipelines
Dominant language
Python
Stars
34.5k
Forks
7.3k
Avg merge
3d 3h
Merged PRs (30d)
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

Contributor guide

Open the contributing guide

Research direction

Start with the ModularPipeline example using text_blocks.init_pipeline(), load_components(), load_lora_weights(), and set_adapters(). Trace the AttributeError at src/diffusers/configuration_utils.py:176 and compare this path with the working Flux2Pipeline example. Done means the modular text_pipe can load and activate the LoRA without the missing transformer attribute error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.