Skip to content

Loading loras on "text_pipe" of a modular pipeline fails #13487

@christopher5106

Description

@christopher5106

Describe the bug

The following code works:

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:

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

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 71a6fd9

Who can help?

@yiyixuxu @DN6 @sayakpaul

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions