Skip to content

gemlab-vt/LoRAShop

Repository files navigation

LoRAShop: Training-Free Multi-Concept Image Generation and Editing with Rectified Flow Transformers (NeurIPS 2025 - Spotlight)

Official implementation of LoRAShop, the first framework for multi-concept image editing with LoRA models. This work enables seamless integration of multiple subjects or styles into images while preserving global context, lighting, and fine details.

arXiv Project Page

Teaser

Abstract

We introduce LoRAShop, the first framework for multi-concept image editing with LoRA models. LoRAShop builds on a key observation about the feature interaction patterns inside Flux-style diffusion transformers: concept-specific transformer features activate spatially coherent regions early in the denoising process. We harness this observation to derive a disentangled latent mask for each concept in a prior forward pass and blend the corresponding LoRA weights only within regions bounding the concepts to be personalized. The resulting edits seamlessly integrate multiple subjects or styles into the original scene while preserving global context, lighting, and fine details. Our experiments demonstrate that LoRAShop delivers better identity preservation compared to baselines. By eliminating retraining and external constraints, LoRAShop turns personalized diffusion models into a practical 'photoshop-with-LoRAs' tool and opens new avenues for compositional visual storytelling and rapid creative iteration.

Install

# Using conda (recommended)
conda create -n lorashop python=3.12 -y
conda activate lorashop

# Install the requirements
pip install -r requirements.txt

Quick Start

Multi-Concept Generation (LoRAShop's Key Capability)

import torch
from flux_real_pipeline import RealGenerationPipeline
from main import load_lora_from_hub, ensure_matching_lora_params

# Load pipeline
pipe = RealGenerationPipeline.from_pretrained(
    "black-forest-labs/FLUX.1-dev",
    torch_dtype=torch.bfloat16
).to("cuda")

# Load multiple LoRA models
lora_dicts = []
lora_dicts.append(load_lora_from_hub("punzel/flux_billie_eilish", "flux_billie_eilish.safetensors"))
lora_dicts.append(load_lora_from_hub("punzel/flux_emma_watson", "flux_emma_watson.safetensors"))

# Ensure matching parameters and load
updated_lora_dicts = ensure_matching_lora_params(lora_dicts)
for lora_dict in updated_lora_dicts:
    pipe.load_lora_weights(lora_dict)

pipe.register_transformer_blocks()

# Generate with multiple concepts
# Important: target_prompt must be a substring of the main prompt
# Note: target_prompt[0] maps to LoRA[0], target_prompt[1] maps to LoRA[1]
generator = torch.Generator(device="cuda").manual_seed(42)
result = pipe(
    prompt="a woman in a red dress and a woman in a blue dress",
    target_prompt=["woman in a red dress", "woman in a blue dress"],
    guidance_scale=3.5,
    num_inference_steps=50,
    height=1024,
    width=1024,
    generator=generator
)

result.images[0].save("output_multi.png")

Command Line Usage

# Multi-concept generation with multiple LoRAs
# Important: target_prompt must be a substring of the main prompt
python main.py \
    --prompt "a woman in a red dress and a woman in a blue dress" \
    --target_prompt "woman in a red dress" "woman in a blue dress" \
    --lora_repos punzel/flux_billie_eilish punzel/flux_emma_watson \
    --lora_files flux_billie_eilish.safetensors flux_emma_watson.safetensors \
    --output_path output_multi.png

# Using local LoRA files
python main.py \
    --prompt "a person in a suit and a person in a dress" \
    --target_prompt "person in a suit" "person in a dress" \
    --lora_paths path/to/first_lora.safetensors path/to/second_lora.safetensors \
    --output_path output.png

Examples

For comprehensive examples and interactive demos, see demo.ipynb.

You can also run the example shell script:

bash example_multi_lora.sh

Or the Python example:

python example.py

Current Status

  • ✅ Multi-concept generation examples
  • 🚧 Image editing examples (coming soon)

Citation

If you use this work in your research, please cite our paper:

@misc{dalva2025lorashop,
  title={LoRAShop: Training-Free Multi-Concept Image Generation and Editing with Rectified Flow Transformers}, 
  author={Yusuf Dalva and Hidir Yesiltepe and Pinar Yanardag},
  year={2025},
  eprint={2505.23758},
  archivePrefix={arXiv},
  primaryClass={cs.CV},
  url={https://arxiv.org/abs/2505.23758}, 
}

About

Implementation for project LoRAShop (NeurIPS 2025 - Spotlight)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published