






license: other license_name: qwen-research license_link: LICENSE base_model: Qwen/Qwen-Image-2.1 base_model_relation: adapter library_name: diffusers pipeline_tag: image-to-image tags:
Built with Qwen.
A LoRA adapter for Qwen/Qwen-Image-2.1. It replaces people in a picture with
characters from character sheets. Each person is replaced whole: face, hair, body and clothes. The pose, expression, framing,
background and lighting of the picture stay as they were. It samples in 6 steps without classifier-free guidance, or, with
--turbo, in 2 steps handed over to Qwen-Image-2.1-Turbo for 6 more: sharper detail.

Each row is: the character sheet(s), the source picture, the output. All are made with inference/swap.py at its defaults
(seed 0, tone fix on); the only inputs are the sheets, the source and the short WHO text shown.
The top image replaces two people at once: --char queen.png woman --char king.png man --left 1 2.
One person, letterboxed source: --char astronaut.png dancer
Two people in close contact, both replaced: --char flavio.png man --char fleur.png woman --left 1 2
A close-up selfie: --char odessa.png woman
A full-body mascot costume; the prop in his hand stays: --char pete.png man
| file | what it is |
|---|---|
viggle-image-swap-v0.1-lora.safetensors | the LoRA (rank 256, alpha 256), bf16, diffusers key format |
inference/swap.py | command-line inference: builds the prompt, orders the images, samples, tone fix |
requirements.txt | the tested package versions |
Image order: the sheets first (image 1, 2, ...), the source last. Each image is shrunk to at most 1 MP.
One sentence per character, then one sentence that names what to keep. With one sheet (image 1) and the source as image 2:
Replace the man in a green shirt in image 2 with the character from image 1. Keep everything else exactly as in image 2: the pose, expression, framing, background and lighting.
With two people in the picture and only one replaced, say where the person is and that the other stays:
Replace the woman on the left in image 2 with the character from image 1. Keep everything else exactly as in image 2: the pose, expression, framing, background and lighting, and leave the other person unchanged.
Positions are on the left / on the right, in the middle (three people), or 2nd from the left and so on.
inference/swap.py writes these prompts for you (--left, --kept).
pip install -U torch torchvision "transformers==5.17.0" accelerate safetensors "peft==0.18.0" pillow numpy
pip install "git+https://github.com/huggingface/diffusers.git@80c7ed262aeffbeb43ef13ae04baeb9b84515a69"
QwenImage21Pipeline is pinned to that diffusers commit, which is what this adapter was tested on.
Command line:
See the full description on the original page
No creation yet
