|
|
--- |
|
|
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)||||| |
|
|
|[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)||||| |
|
|
|
|
|
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)||||| |
|
|
|[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)||||| |
|
|
|
|
|
## 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") |
|
|
``` |