---
title: Qwen-Image-2.1-Lightning
canonical_url: "https://www.modelscope.cn/models/lightx2v/Qwen-Image-2.1-Lightning"
md_url: "https://www.modelscope.cn/models/lightx2v/Qwen-Image-2.1-Lightning.md"
repository: lightx2v/Qwen-Image-2.1-Lightning
last_updated: 2026-10-14
pipeline_tag: text-to-image-synthesis
tasks:
  - text-to-image-synthesis
base_model:
  - Qwen/Qwen-Image-2.1
base_model_relation: adapter
parameters: 16.8M
tensor_type:
  - F32
library_name:
  - pytorch
  - lora
  - safetensors
supports_inference: img2img
downloads: 509
stars: 3
tags:
  - lora
  - diffusion
  - distillation
  - image-generation
  - image-editing
  - lightx2v
---

# Qwen-Image-2.1-Lightning

> Qwen-Image-2.1-Lightning - lightx2v 在 ModelScope 开源的模型。LightX2V Lightning for Qwen-Image-2.1

lightx2v/Qwen-Image-2.1-Lightning 是 ModelScope 魔搭社区上的 16.8M 参数text-to-image-synthesis模型，基于 Qwen/Qwen-Image-2.1 构建，并支持在线推理（img2img）。

- **Repository**: lightx2v/Qwen-Image-2.1-Lightning
- **Tasks**: text-to-image-synthesis
- **Parameters**: 16.8M
- **Base model**: Qwen/Qwen-Image-2.1
- **Online inference**: img2img
- **Tags**: lora, diffusion, distillation, image-generation, image-editing, lightx2v
- **Downloads**: 509
- **Stars**: 3
- **Last updated**: 2026-10-14

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

---

# LightX2V Lightning for Qwen-Image-2.1

A **4-step distilled LoRA for [Qwen-Image-2.1](https://huggingface.co/Qwen/Qwen-Image-2.1)**, supporting text-to-image generation and image editing. Training was performed entirely on **16 Huawei Ascend 910B NPUs**, using DMD in [LightX2V](https://github.com/ModelTC/LightX2V).


For inference on heterogeneous hardware platforms, refer to the [LightX2V platform scripts](https://github.com/ModelTC/LightX2V/tree/main/scripts/platforms).

Both examples use the training noise schedule: four steps with dynamic exponential shifting and no terminal stretching. Training and LightX2V inference keep latents in FP32; these BF16 Diffusers examples can produce different numerical results.

## Text-to-image

Run this example from the directory containing `pytorch_lora_weights.safetensors`:

```python
import torch
from diffusers import FlowMatchEulerDiscreteScheduler, QwenImage21Pipeline

pipe = QwenImage21Pipeline.from_pretrained(
    "Qwen/Qwen-Image-2.1", torch_dtype=torch.bfloat16
).to("cuda")
pipe.load_lora_weights(
    ".", weight_name="pytorch_lora_weights.safetensors", adapter_name="lightning"
)

pipe.scheduler = FlowMatchEulerDiscreteScheduler.from_config(
    pipe.scheduler.config,
    num_train_timesteps=1000,
    use_dynamic_shifting=True,
    time_shift_type="exponential",
    base_image_seq_len=256,
    max_image_seq_len=8192,
    base_shift=0.5,
    max_shift=0.9,
    shift_terminal=None,
)

image = pipe(
    prompt='A coffee shop entrance with a chalkboard reading "Qwen Coffee, $2 per cup" and a neon sign displaying "通义千问".',
    width=1024,
    height=1024,
    num_inference_steps=4,
    sigmas=[1.0, 0.75, 0.5, 0.25],
    true_cfg_scale=1.0,
    use_kv_cache=False,
    generator=torch.Generator("cuda").manual_seed(42),
).images[0]
image.save("t2i.png")
```

## Image editing

Run this example from the directory containing `pytorch_lora_weights.safetensors` and `input.png`:

```python
import torch
from PIL import Image
from diffusers import FlowMatchEulerDiscreteScheduler, QwenImage21Pipeline

pipe = QwenImage21Pipeline.from_pretrained(
    "Qwen/Qwen-Image-2.1", torch_dtype=torch.bfloat16
).to("cuda")
pipe.load_lora_weights(
    ".", weight_name="pytorch_lora_weights.safetensors", adapter_name="lightning"
)

pipe.scheduler = FlowMatchEulerDiscreteScheduler.from_config(
    pipe.scheduler.config,
    num_train_timesteps=1000,
    use_dynamic_shifting=True,
    time_shift_type="exponential",
    base_image_seq_len=256,
    max_image_seq_len=8192,
    base_shift=0.5,
    max_shift=0.9,
    shift_terminal=None,
)

image = pipe(
    prompt="Change the red jacket to dark blue. Keep the person's identity, pose, background and lighting unchanged.",
    image=Image.open("input.png"),
    width=1024,
    height=1024,
    num_inference_steps=4,
    sigmas=[1.0, 0.75, 0.5, 0.25],
    true_cfg_scale=1.0,
    use_kv_cache=False,
    generator=torch.Generator("cuda").manual_seed(42),
).images[0]
image.save("edit.png")
```

For multiple references, use `image=[Image.open("reference_1.png"), Image.open("reference_2.png")]`.

## Comparison

Same prompts, seeds and output sizes; CFG is disabled for both models. The 40-step base-model images are from an earlier run. Click an example name to view its prompt.

### Text-to-image

| Example | Qwen-Image-2.1 · 40 steps | Lightning LoRA · 4 steps |
| --- | --- | --- |
| [Coffee Shop Signage](assets/t2i/01/prompt.txt) | <img src="assets/t2i/01/base_40step.png" alt="Coffee shop, 40 steps" width="360"> | <img src="assets/t2i/01/lightning_4step.png" alt="Coffee shop, 4 steps" width="360"> |
| [Nine-Headed Fox Beast](assets/t2i/02/prompt.txt) | <img src="assets/t2i/02/base_40step.png" alt="Fox beast, 40 steps" width="360"> | <img src="assets/t2i/02/lightning_4step.png" alt="Fox beast, 4 steps" width="360"> |
| [Sheep Designer Toy](assets/t2i/03/prompt.txt) | <img src="assets/t2i/03/base_40step.png" alt="Sheep toy, 40 steps" width="360"> | <img src="assets/t2i/03/lightning_4step.png" alt="Sheep toy, 4 steps" width="360"> |
| [Office Cow Selfie](assets/t2i/04/prompt.txt) | <img src="assets/t2i/04/base_40step.png" alt="Office cow, 40 steps" width="360"> | <img src="assets/t2i/04/lightning_4step.png" alt="Office cow, 4 steps" width="360"> |
| [Floral Wine Advertisement](assets/t2i/05/prompt.txt) | <img src="assets/t2i/05/base_40step.png" alt="Wine advertisement, 40 steps" width="360"> | <img src="assets/t2i/05/lightning_4step.png" alt="Wine advertisement, 4 steps" width="360"> |

### Image editing

Both models use the same reference images, shown below in prompt order.

| Example | Reference images | Qwen-Image-2.1 · 40 steps | Lightning LoRA · 4 steps |
| --- | --- | --- | --- |
| [Jacket Recolor](assets/edit/01/prompt.txt) | <img src="assets/edit/01/input_1.png" alt="Reference image 1" width="100"> | <img src="assets/edit/01/base_40step.png" alt="Jacket recolor, 40 steps" width="300"> | <img src="assets/edit/01/lightning_4step.png" alt="Jacket recolor, 4 steps" width="300"> |
| [Outfit and Night Scene](assets/edit/02/prompt.txt) | <img src="assets/edit/02/input_1.png" alt="Reference image 1" width="100"><br><img src="assets/edit/02/input_2.png" alt="Reference image 2" width="100"><br><img src="assets/edit/02/input_3.png" alt="Reference image 3" width="100"> | <img src="assets/edit/02/base_40step.png" alt="Outfit and night scene, 40 steps" width="300"> | <img src="assets/edit/02/lightning_4step.png" alt="Outfit and night scene, 4 steps" width="300"> |
| [Person and Cat](assets/edit/03/prompt.txt) | <img src="assets/edit/03/input_1.png" alt="Reference image 1" width="100"><br><img src="assets/edit/03/input_2.png" alt="Reference image 2" width="100"><br><img src="assets/edit/03/input_3.png" alt="Reference image 3" width="100"> | <img src="assets/edit/03/base_40step.png" alt="Person and cat, 40 steps" width="300"> | <img src="assets/edit/03/lightning_4step.png" alt="Person and cat, 4 steps" width="300"> |
| [Product Advertisement](assets/edit/04/prompt.txt) | <img src="assets/edit/04/input_1.png" alt="Reference image 1" width="100"><br><img src="assets/edit/04/input_2.png" alt="Reference image 2" width="100"><br><img src="assets/edit/04/input_3.png" alt="Reference image 3" width="100"> | <img src="assets/edit/04/base_40step.png" alt="Product advertisement, 40 steps" width="300"> | <img src="assets/edit/04/lightning_4step.png" alt="Product advertisement, 4 steps" width="300"> |
| [Sofa and Pendant Lamp](assets/edit/05/prompt.txt) | <img src="assets/edit/05/input_1.png" alt="Reference image 1" width="100"><br><img src="assets/edit/05/input_2.png" alt="Reference image 2" width="100"><br><img src="assets/edit/05/input_3.png" alt="Reference image 3" width="100"> | <img src="assets/edit/05/base_40step.png" alt="Sofa and pendant lamp, 40 steps" width="300"> | <img src="assets/edit/05/lightning_4step.png" alt="Sofa and pendant lamp, 4 steps" width="300"> |
| [Floor Material Transfer](assets/edit/06/prompt.txt) | <img src="assets/edit/06/input_1.png" alt="Reference image 1" width="100"><br><img src="assets/edit/06/input_2.png" alt="Reference image 2" width="100"> | <img src="assets/edit/06/base_40step.png" alt="Floor material transfer, 40 steps" width="300"> | <img src="assets/edit/06/lightning_4step.png" alt="Floor material transfer, 4 steps" width="300"> |
| [Mirror Reflection](assets/edit/07/prompt.txt) | <img src="assets/edit/07/input_1.png" alt="Reference image 1" width="100"><br><img src="assets/edit/07/input_2.png" alt="Reference image 2" width="100"><br><img src="assets/edit/07/input_3.png" alt="Reference image 3" width="100"> | <img src="assets/edit/07/base_40step.png" alt="Mirror reflection, 40 steps" width="300"> | <img src="assets/edit/07/lightning_4step.png" alt="Mirror reflection, 4 steps" width="300"> |
| [Backpack Try-On](assets/edit/08/prompt.txt) | <img src="assets/edit/08/input_1.png" alt="Reference image 1" width="100"><br><img src="assets/edit/08/input_2.png" alt="Reference image 2" width="100"><br><img src="assets/edit/08/input_3.png" alt="Reference image 3" width="100"> | <img src="assets/edit/08/base_40step.png" alt="Backpack try-on, 40 steps" width="300"> | <img src="assets/edit/08/lightning_4step.png" alt="Backpack try-on, 4 steps" width="300"> |
