---
title: Qwen-Image-2.1-Lightning-v2-RL
canonical_url: "https://www.modelscope.cn/models/lightx2v/Qwen-Image-2.1-Lightning-v2-RL"
md_url: "https://www.modelscope.cn/models/lightx2v/Qwen-Image-2.1-Lightning-v2-RL.md"
repository: lightx2v/Qwen-Image-2.1-Lightning-v2-RL
last_updated: 2026-11-03
license: other
pipeline_tag: text-to-image-synthesis
tasks:
  - text-to-image-synthesis
base_model:
  - Qwen/Qwen-Image-2.1
base_model_relation: finetune
parameters: 7.3B
tensor_type:
  - F32
library_name:
  - pytorch
  - diffusers
  - safetensors
frameworks:
  - pytorch
downloads: 83
stars: 0
tags:
  - lightx2v
  - qwen-image
  - image-generation
  - image-editing
  - distillation
  - reinforcement-learning
  - diffusers
---

# Qwen-Image-2.1-Lightning-v2-RL

> Qwen-Image-2.1-Lightning-v2-RL - lightx2v 在 ModelScope 开源的模型。🤗 Hugging Face &nbsp;&nbsp;| &nbsp;&nbsp;💻 GitHub &nbsp;&nbsp;| &nbsp;&nbsp;🌐 LightX2V &nbsp;&nbsp;| &nbsp;&nbsp;💬 WeChat

lightx2v/Qwen-Image-2.1-Lightning-v2-RL 是 ModelScope 魔搭社区上的 7.3B 参数text-to-image-synthesis模型，采用 other 许可，基于 Qwen/Qwen-Image-2.1 构建。

- **Repository**: lightx2v/Qwen-Image-2.1-Lightning-v2-RL
- **License**: other
- **Tasks**: text-to-image-synthesis
- **Parameters**: 7.3B
- **Base model**: Qwen/Qwen-Image-2.1
- **Tags**: lightx2v, qwen-image, image-generation, image-editing, distillation, reinforcement-learning, diffusers
- **Downloads**: 83
- **Stars**: 0
- **Last updated**: 2026-11-03

Source: https://www.modelscope.cn/models/lightx2v/Qwen-Image-2.1-Lightning-v2-RL

---

<div align="center">
  <a href="https://github.com/ModelTC/LightX2V">
    <img src="https://huggingface.co/lightx2v/Qwen-Image-2.1-Lightning-v2-RL/resolve/main/assets/img_lightx2v.png" alt="LightX2V" width="600">
  </a>
</div>

<p align="center">
  🤗 <a href="https://huggingface.co/lightx2v">Hugging Face</a>&nbsp;&nbsp;|
  &nbsp;&nbsp;💻 <a href="https://github.com/ModelTC/LightX2V">GitHub</a>&nbsp;&nbsp;|
  &nbsp;&nbsp;🌐 <a href="https://x2v.light-ai.top/">LightX2V</a>&nbsp;&nbsp;|
  &nbsp;&nbsp;💬 <a href="https://huggingface.co/lightx2v/Qwen-Image-2.1-Lightning-v2-RL/blob/main/assets/wechat.jpg">WeChat</a>
</p>

## Introduction

**Four-step image generation and editing. Built with Qwen.**

This model is the reinforcement-learning-refined version of LightX2V Lightning v2, distilled from [Qwen-Image-2.1](https://huggingface.co/Qwen/Qwen-Image-2.1). It supports text-to-image generation, single-reference image editing, and multi-reference image generation with **4 denoising steps** and **CFG = 1.0**.

RL training was performed with [LightX2V RL](https://github.com/ModelTC/LightX2V/tree/main/lightx2v_rl).

## Model files

The release provides the **full transformer weights** in a single `diffusion_pytorch_model.safetensors` file, together with `config.json`. The weights are stored in FP32 and can be loaded in BF16 for inference.

`inference_config.json` records the base model, four sampling sigmas, guidance scale, KV cache setting, and scheduler parameters. It is a release-specific configuration file, explicitly read by the example below; Diffusers does not load it automatically.

The inference files are:

```text
config.json
diffusion_pytorch_model.safetensors
inference_config.json
README.md
assets/img_lightx2v.png
assets/wechat.jpg
assets/comparison/
```

`merge_manifest.json` is a local export audit record, is not used for inference, and can be excluded when uploading.

Load the processor, text encoder, and VAE from the original Qwen-Image-2.1 pipeline, then replace its transformer as shown below. This checkpoint is not a LoRA adapter or a standalone pipeline bundle.

## Quick start

Install a recent Diffusers version with `QwenImage21Pipeline` support:

```bash
pip install git+https://github.com/huggingface/diffusers.git
pip install "transformers>=5.17.0" accelerate safetensors pillow
```

Run the following code from the downloaded model directory, or change `MODEL_DIR` to its local path. The base pipeline components will be downloaded from Hugging Face when needed.

### Load the model

```python
import json
from pathlib import Path

import torch
from PIL import Image
from diffusers import (
    FlowMatchEulerDiscreteScheduler,
    QwenImage21Pipeline,
    QwenImage21Transformer2DModel,
)

MODEL_DIR = "."
with (Path(MODEL_DIR) / "inference_config.json").open(encoding="utf-8") as f:
    inference_config = json.load(f)
SIGMAS = inference_config["sample_sigmas"]

transformer = QwenImage21Transformer2DModel.from_pretrained(
    MODEL_DIR,
    torch_dtype=torch.bfloat16,
)
pipe = QwenImage21Pipeline.from_pretrained(
    inference_config["base_model"],
    transformer=transformer,
    torch_dtype=torch.bfloat16,
)
# The four sigmas are already shifted. Do not apply dynamic shifting again.
pipe.scheduler = FlowMatchEulerDiscreteScheduler(
    **inference_config["scheduler"],
)
pipe.to("cuda")


def generate(prompt, image=None, seed=42):
    return pipe(
        prompt=prompt,
        image=image,
        width=1024,
        height=1024,
        sigmas=SIGMAS,
        num_inference_steps=len(SIGMAS),
        true_cfg_scale=inference_config["true_cfg_scale"],
        use_kv_cache=inference_config["use_kv_cache"],
        generator=torch.Generator("cpu").manual_seed(seed),
    ).images[0]
```

Use this exact sigma schedule for all three tasks. The terminal sigma of zero is appended by the scheduler. Setting only `num_inference_steps=4` does not reproduce this schedule.

### Text-to-image

```python
image = generate(
    "A ceramic teapot beside a small bowl of oranges on a wooden table, "
    "soft morning window light, detailed glaze, natural colors."
)
image.save("t2i.png")
```

### Single-reference editing

```python
reference = Image.open("reference.png").convert("RGB")
image = generate(
    "Change the jacket to dark green. Preserve the person's face, pose, "
    "and the rest of the scene.",
    image=[reference],
)
image.save("edit.png")
```

### Multi-reference generation

Pass reference images in the same order used by the prompt:

```python
references = [
    Image.open("person.png").convert("RGB"),
    Image.open("jacket.png").convert("RGB"),
]
image = generate(
    "Show the person from image 1 wearing the jacket from image 2. "
    "Preserve the person's identity and the jacket's design, "
    "with natural lighting and a simple studio background.",
    image=references,
)
image.save("multi_reference.png")
```

The examples use 1024 × 1024 output. For other aspect ratios, set both dimensions to multiples of 32. Generation quality can vary with the prompt and seed; fine text, anatomy, object counts, and precise reference preservation may still require checking.

## Comparison with Qwen-Image-2.1 (40 steps)

Selected qualitative examples from our validation runs: **Lightning v2 RL uses 4 steps**, while the baseline uses the original [Qwen-Image-2.1](https://huggingface.co/Qwen/Qwen-Image-2.1) weights with 40-step Euler sampling. Both use CFG = 1.0, the same full enhanced prompts, the same input references where applicable, and 1024 × 1024 output. 

### Text-to-image

| Example / prompt | Qwen-Image-2.1 · 40 steps | Lightning v2 RL · 4 steps |
| --- | --- | --- |
| [Dolphin at a Burning Shoreline](https://huggingface.co/lightx2v/Qwen-Image-2.1-Lightning-v2-RL/blob/main/assets/comparison/t2i/12/prompt.txt) | <a href="https://huggingface.co/lightx2v/Qwen-Image-2.1-Lightning-v2-RL/blob/main/assets/comparison/t2i/12/base_40step.png"><img src="https://huggingface.co/lightx2v/Qwen-Image-2.1-Lightning-v2-RL/resolve/main/assets/comparison/t2i/12/base_40step.png" alt="Dolphin at a Burning Shoreline, original model, 40 steps" width="360"></a> | <a href="https://huggingface.co/lightx2v/Qwen-Image-2.1-Lightning-v2-RL/blob/main/assets/comparison/t2i/12/rl_4step.png"><img src="https://huggingface.co/lightx2v/Qwen-Image-2.1-Lightning-v2-RL/resolve/main/assets/comparison/t2i/12/rl_4step.png" alt="Dolphin at a Burning Shoreline, RL model, 4 steps" width="360"></a> |
| [Weathered Bicycle in the Rain](https://huggingface.co/lightx2v/Qwen-Image-2.1-Lightning-v2-RL/blob/main/assets/comparison/t2i/13/prompt.txt) | <a href="https://huggingface.co/lightx2v/Qwen-Image-2.1-Lightning-v2-RL/blob/main/assets/comparison/t2i/13/base_40step.png"><img src="https://huggingface.co/lightx2v/Qwen-Image-2.1-Lightning-v2-RL/resolve/main/assets/comparison/t2i/13/base_40step.png" alt="Weathered Bicycle in the Rain, original model, 40 steps" width="360"></a> | <a href="https://huggingface.co/lightx2v/Qwen-Image-2.1-Lightning-v2-RL/blob/main/assets/comparison/t2i/13/rl_4step.png"><img src="https://huggingface.co/lightx2v/Qwen-Image-2.1-Lightning-v2-RL/resolve/main/assets/comparison/t2i/13/rl_4step.png" alt="Weathered Bicycle in the Rain, RL model, 4 steps" width="360"></a> |

### Single-reference editing

| Example / prompt | Reference images | Qwen-Image-2.1 · 40 steps | Lightning v2 RL · 4 steps |
| --- | --- | --- | --- |
| [Flying Dragon above Waterfall Gardens](https://huggingface.co/lightx2v/Qwen-Image-2.1-Lightning-v2-RL/blob/main/assets/comparison/i2i_single/20/prompt.txt) | <a href="https://huggingface.co/lightx2v/Qwen-Image-2.1-Lightning-v2-RL/blob/main/assets/comparison/i2i_single/20/input_1.png"><img src="https://huggingface.co/lightx2v/Qwen-Image-2.1-Lightning-v2-RL/resolve/main/assets/comparison/i2i_single/20/input_1.png" alt="Reference 1" width="125"></a> | <a href="https://huggingface.co/lightx2v/Qwen-Image-2.1-Lightning-v2-RL/blob/main/assets/comparison/i2i_single/20/base_40step.png"><img src="https://huggingface.co/lightx2v/Qwen-Image-2.1-Lightning-v2-RL/resolve/main/assets/comparison/i2i_single/20/base_40step.png" alt="Flying Dragon above Waterfall Gardens, original model, 40 steps" width="300"></a> | <a href="https://huggingface.co/lightx2v/Qwen-Image-2.1-Lightning-v2-RL/blob/main/assets/comparison/i2i_single/20/rl_4step.png"><img src="https://huggingface.co/lightx2v/Qwen-Image-2.1-Lightning-v2-RL/resolve/main/assets/comparison/i2i_single/20/rl_4step.png" alt="Flying Dragon above Waterfall Gardens, RL model, 4 steps" width="300"></a> |
| [Guitarist and Cat in a Busy Marketplace](https://huggingface.co/lightx2v/Qwen-Image-2.1-Lightning-v2-RL/blob/main/assets/comparison/i2i_single/22/prompt.txt) | <a href="https://huggingface.co/lightx2v/Qwen-Image-2.1-Lightning-v2-RL/blob/main/assets/comparison/i2i_single/22/input_1.png"><img src="https://huggingface.co/lightx2v/Qwen-Image-2.1-Lightning-v2-RL/resolve/main/assets/comparison/i2i_single/22/input_1.png" alt="Reference 1" width="125"></a> | <a href="https://huggingface.co/lightx2v/Qwen-Image-2.1-Lightning-v2-RL/blob/main/assets/comparison/i2i_single/22/base_40step.png"><img src="https://huggingface.co/lightx2v/Qwen-Image-2.1-Lightning-v2-RL/resolve/main/assets/comparison/i2i_single/22/base_40step.png" alt="Guitarist and Cat in a Busy Marketplace, original model, 40 steps" width="300"></a> | <a href="https://huggingface.co/lightx2v/Qwen-Image-2.1-Lightning-v2-RL/blob/main/assets/comparison/i2i_single/22/rl_4step.png"><img src="https://huggingface.co/lightx2v/Qwen-Image-2.1-Lightning-v2-RL/resolve/main/assets/comparison/i2i_single/22/rl_4step.png" alt="Guitarist and Cat in a Busy Marketplace, RL model, 4 steps" width="300"></a> |

### Multi-reference generation

| Example / prompt | Reference images | Qwen-Image-2.1 · 40 steps | Lightning v2 RL · 4 steps |
| --- | --- | --- | --- |
| [Food Transfer into a Stylized Scene](https://huggingface.co/lightx2v/Qwen-Image-2.1-Lightning-v2-RL/blob/main/assets/comparison/i2i_multi/27/prompt.txt) | <a href="https://huggingface.co/lightx2v/Qwen-Image-2.1-Lightning-v2-RL/blob/main/assets/comparison/i2i_multi/27/input_1.png"><img src="https://huggingface.co/lightx2v/Qwen-Image-2.1-Lightning-v2-RL/resolve/main/assets/comparison/i2i_multi/27/input_1.png" alt="Reference 1" width="125"></a><br><a href="https://huggingface.co/lightx2v/Qwen-Image-2.1-Lightning-v2-RL/blob/main/assets/comparison/i2i_multi/27/input_2.png"><img src="https://huggingface.co/lightx2v/Qwen-Image-2.1-Lightning-v2-RL/resolve/main/assets/comparison/i2i_multi/27/input_2.png" alt="Reference 2" width="125"></a> | <a href="https://huggingface.co/lightx2v/Qwen-Image-2.1-Lightning-v2-RL/blob/main/assets/comparison/i2i_multi/27/base_40step.png"><img src="https://huggingface.co/lightx2v/Qwen-Image-2.1-Lightning-v2-RL/resolve/main/assets/comparison/i2i_multi/27/base_40step.png" alt="Food Transfer into a Stylized Scene, original model, 40 steps" width="300"></a> | <a href="https://huggingface.co/lightx2v/Qwen-Image-2.1-Lightning-v2-RL/blob/main/assets/comparison/i2i_multi/27/rl_4step.png"><img src="https://huggingface.co/lightx2v/Qwen-Image-2.1-Lightning-v2-RL/resolve/main/assets/comparison/i2i_multi/27/rl_4step.png" alt="Food Transfer into a Stylized Scene, RL model, 4 steps" width="300"></a> |
| [Floral Porcelain Teapot in a Portrait Scene](https://huggingface.co/lightx2v/Qwen-Image-2.1-Lightning-v2-RL/blob/main/assets/comparison/i2i_multi/29/prompt.txt) | <a href="https://huggingface.co/lightx2v/Qwen-Image-2.1-Lightning-v2-RL/blob/main/assets/comparison/i2i_multi/29/input_1.png"><img src="https://huggingface.co/lightx2v/Qwen-Image-2.1-Lightning-v2-RL/resolve/main/assets/comparison/i2i_multi/29/input_1.png" alt="Reference 1" width="125"></a><br><a href="https://huggingface.co/lightx2v/Qwen-Image-2.1-Lightning-v2-RL/blob/main/assets/comparison/i2i_multi/29/input_2.png"><img src="https://huggingface.co/lightx2v/Qwen-Image-2.1-Lightning-v2-RL/resolve/main/assets/comparison/i2i_multi/29/input_2.png" alt="Reference 2" width="125"></a> | <a href="https://huggingface.co/lightx2v/Qwen-Image-2.1-Lightning-v2-RL/blob/main/assets/comparison/i2i_multi/29/base_40step.png"><img src="https://huggingface.co/lightx2v/Qwen-Image-2.1-Lightning-v2-RL/resolve/main/assets/comparison/i2i_multi/29/base_40step.png" alt="Floral Porcelain Teapot in a Portrait Scene, original model, 40 steps" width="300"></a> | <a href="https://huggingface.co/lightx2v/Qwen-Image-2.1-Lightning-v2-RL/blob/main/assets/comparison/i2i_multi/29/rl_4step.png"><img src="https://huggingface.co/lightx2v/Qwen-Image-2.1-Lightning-v2-RL/resolve/main/assets/comparison/i2i_multi/29/rl_4step.png" alt="Floral Porcelain Teapot in a Portrait Scene, RL model, 4 steps" width="300"></a> |

## License and acknowledgements

This model is derived from Qwen-Image-2.1 and is subject to the [Qwen Research License](https://huggingface.co/Qwen/Qwen-Image-2.1/blob/main/LICENSE), including its non-commercial terms.

Thanks to the Qwen team and the Diffusers community. See [LightX2V](https://github.com/ModelTC/LightX2V), the earlier [Qwen-Image-2.1-Lightning](https://huggingface.co/lightx2v/Qwen-Image-2.1-Lightning) release, and [Qwen-Image-2.1-Turbo](https://huggingface.co/Qwen/Qwen-Image-2.1-Turbo) for related work.
