File size: 3,976 Bytes
f9250e6
 
 
550ca54
693f722
550ca54
693f722
550ca54
693f722
550ca54
693f722
550ca54
693f722
 
 
550ca54
 
 
 
 
 
 
 
693f722
550ca54
 
 
 
 
 
 
 
693f722
550ca54
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
693f722
550ca54
693f722
550ca54
 
 
 
 
 
 
 
 
 
 
 
f9250e6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
---
license: apache-2.0
---

# LoRA Fuser (FLUX.1-dev)

This model is designed to harmonize conflicting relationships when multiple LoRA models are loaded simultaneously, preventing image degradation.

For details, please refer to our paper: [AutoLoRA: Automatic LoRA Retrieval and Fine-Grained Gated Fusion for Text-to-Image Generation](https://arxiv.org/abs/2508.02107)

**We are still optimizing this model. The current version may produce unstable results with certain LoRAs. Please stay tuned for future updates.**

## Result Demonstration

Prompt: `a cat`

||[LoRA 1](https://modelscope.cn/models/cancel13/cxsk)|[LoRA 2](https://modelscope.cn/models/wy413928499/xuancai2)|[LoRA 3](https://modelscope.cn/models/DiffSynth-Studio/ArtAug-lora-FLUX.1dev-v1)|[LoRA 4](https://modelscope.cn/models/hongyanbujian/JPL)|
|-|-|-|-|-|
|[LoRA 1](https://modelscope.cn/models/cancel13/cxsk)|![](./assets/cat/image_0_0.jpg)|![](./assets/cat/image_0_1.jpg)|![](./assets/cat/image_0_2.jpg)|![](./assets/cat/image_0_3.jpg)|
|[LoRA 2](https://modelscope.cn/models/wy413928499/xuancai2)|![](./assets/cat/image_0_1.jpg)|![](./assets/cat/image_1_1.jpg)|![](./assets/cat/image_1_2.jpg)|![](./assets/cat/image_1_3.jpg)|
|[LoRA 3](https://modelscope.cn/models/DiffSynth-Studio/ArtAug-lora-FLUX.1dev-v1)|![](./assets/cat/image_0_2.jpg)|![](./assets/cat/image_1_2.jpg)|![](./assets/cat/image_2_2.jpg)|![](./assets/cat/image_2_3.jpg)|
|[LoRA 4](https://modelscope.cn/models/hongyanbujian/JPL)|![](./assets/cat/image_0_3.jpg)|![](./assets/cat/image_1_3.jpg)|![](./assets/cat/image_2_3.jpg)|![](./assets/cat/image_3_3.jpg)|

Prompt: `a car`

||[LoRA 1](https://modelscope.cn/models/cancel13/cxsk)|[LoRA 2](https://modelscope.cn/models/wy413928499/xuancai2)|[LoRA 3](https://modelscope.cn/models/DiffSynth-Studio/ArtAug-lora-FLUX.1dev-v1)|[LoRA 4](https://modelscope.cn/models/hongyanbujian/JPL)|
|-|-|-|-|-|
|[LoRA 1](https://modelscope.cn/models/cancel13/cxsk)|![](./assets/car/image_0_0.jpg)|![](./assets/car/image_0_1.jpg)|![](./assets/car/image_0_2.jpg)|![](./assets/car/image_0_3.jpg)|
|[LoRA 2](https://modelscope.cn/models/wy413928499/xuancai2)|![](./assets/car/image_0_1.jpg)|![](./assets/car/image_1_1.jpg)|![](./assets/car/image_1_2.jpg)|![](./assets/car/image_1_3.jpg)|
|[LoRA 3](https://modelscope.cn/models/DiffSynth-Studio/ArtAug-lora-FLUX.1dev-v1)|![](./assets/car/image_0_2.jpg)|![](./assets/car/image_1_2.jpg)|![](./assets/car/image_2_2.jpg)|![](./assets/car/image_2_3.jpg)|
|[LoRA 4](https://modelscope.cn/models/hongyanbujian/JPL)|![](./assets/car/image_0_3.jpg)|![](./assets/car/image_1_3.jpg)|![](./assets/car/image_2_3.jpg)|![](./assets/car/image_3_3.jpg)|

## Inference Code

```shell
git clone https://github.com/modelscope/DiffSynth-Studio.git  
cd DiffSynth-Studio
pip install -e .
```

```python
import torch
from diffsynth.pipelines.flux_image_new import FluxImagePipeline, ModelConfig

        
pipe = FluxImagePipeline.from_pretrained(
    torch_dtype=torch.bfloat16,
    device="cuda",
    model_configs=[
        ModelConfig(model_id="black-forest-labs/FLUX.1-dev", origin_file_pattern="flux1-dev.safetensors"),
        ModelConfig(model_id="black-forest-labs/FLUX.1-dev", origin_file_pattern="text_encoder/model.safetensors"),
        ModelConfig(model_id="black-forest-labs/FLUX.1-dev", origin_file_pattern="text_encoder_2/"),
        ModelConfig(model_id="black-forest-labs/FLUX.1-dev", origin_file_pattern="ae.safetensors"),
        ModelConfig(model_id="DiffSynth-Studio/LoRAFusion-preview-FLUX.1-dev", origin_file_pattern="model.safetensors"),
    ],
)
pipe.enable_lora_magic()
```

```python
pipe.load_lora(
    pipe.dit,
    ModelConfig(model_id="cancel13/cxsk", origin_file_pattern="30.safetensors"),
    hotload=True,
)
pipe.load_lora(
    pipe.dit,
    ModelConfig(model_id="DiffSynth-Studio/ArtAug-lora-FLUX.1dev-v1", origin_file_pattern="merged_lora.safetensors"),
    hotload=True,
)
image = pipe(prompt="a cat", seed=0)
image.save("image_fused.jpg")
```