Image and video generation

Run Pruna-Qwen-Image-2.1 locally: choosing its 5- or 8-step adapter

Draft images quickly with the Pruna adapter, then review at 8 steps

Pruna-Qwen-Image-2.1 is a LoRA1 adapter connected to the Qwen-Image-2.1 image model. Its additional weights are trained for few-step generation, enabling quick trials of prompt2 lighting and composition. This guide explores selecting candidates with 5 steps and comparing details with the quality-first 8-step adapter or 40-step base model.

Suppose you are comparing soft window light with a dark studio look on a ceramic mug. Using 5 steps to draft alternatives can make composition exploration quicker. After choosing a scene, review details such as the rim and handle with 8 steps or the base model. Five steps are faster than eight but visibly lower in quality, and the creator says v0.1 is below the base model in quality.

Requirements and key details
  • Use 5 steps for fast drafts and 8 steps as the adapter's quality-first default.
  • The adapter runs with the Qwen-Image-2.1 base model and its full pipeline.
  • The up-to-6.3× figure was measured under specific conditions on an H100 80 GB.

What 5 and 8 steps are for

This is not simply the base Qwen-Image-2.1 with its 40 steps reduced. The Pruna adapter adds weights trained separately to generate images in fewer iterations. Each step updates an image representation from noise; this version uses either 5 or 8 steps. Counting steps alone makes 8 steps one-fifth and 5 steps one-eighth of the base model's 40, but total generation time does not shrink by the same ratio. Prompt encoding, image reconstruction, and computation within each step also take time.

Each adapter file is about 335.6 MB. The pipeline3, text encoder, and VAE4 remain from the base model, so this file size does not represent total GPU5 memory requirements. Intermediate computation space also depends on resolution. The model card does not establish VRAM6 savings or prove that smaller GPUs can run it.

Several ceramic-mug still-life drafts with different lighting and compositions on a monitor at a warm studio desk.
Choose lighting and composition first, then inspect details in the selected scene.

Test both versions under the same CUDA setup

The official example targets CUDA7 GPUs. Generate one image at 8 steps first to verify the installation and settings; for the next run, changing STEPS to 5 also selects the matching file and sigma list.

Using the same prompt and seed 42 aligns the starting-noise condition, but does not make the compositions identical. Begin at 1024×1024, compare lighting, spacing, and mug position, then inspect details.

Run the installation commands, save the generation code as pruna_mug.py, then run python pruna_mug.py. The first generation is complete when mug-8-step.png appears in the working directory.

Image editing can use the same pipeline. Start by changing the background with one reference photo and check whether the mug shape is preserved. Training covered 1K resolution and up to three reference images. Begin with one photo you provide and a 1024×1024 output; test more references or higher resolutions separately. Append the editing example to the same script and prepare your reference photo as mug-reference.png. Running it saves the result as mug-edited.png.

Install the CUDA packages and pinned Diffusers version
pip install 'torch>=2.4.0' 'transformers>=5.17' accelerate peft pillow
pip install git+https://github.com/huggingface/diffusers@6256aa7666cedd47443adc8f82da9a10e110b09c
The official example assumes a CUDA GPU setup.
Generate a 1024×1024 image: pruna_mug.py
import torch
from diffusers import FlowMatchEulerDiscreteScheduler, QwenImage21Pipeline

STEPS = 8  # 8: quality-first default; 5: faster candidate selection
SIGMAS = {
    5: [1.0, 0.94, 6 / 7, 2 / 3, 0.4],
    8: [1.0, 14 / 15, 6 / 7, 10 / 13, 2 / 3, 6 / 11, 0.4, 2 / 9],
}[STEPS]

pipe = QwenImage21Pipeline.from_pretrained(
    "Qwen/Qwen-Image-2.1", torch_dtype=torch.bfloat16
).to("cuda")
pipe.load_lora_weights(
    "PrunaAI/Pruna-Qwen-Image-2.1",
    weight_name=f"p_qwen_image_2.1_{STEPS}step_v0.1.safetensors",
)
pipe.scheduler = FlowMatchEulerDiscreteScheduler.from_config(
    pipe.scheduler.config, use_dynamic_shifting=False, shift=1.0, shift_terminal=None
)

image = pipe(
    prompt=(
        "A ceramic mug on a small table, soft window light from the left, "
        "warm neutral background, three-quarter view, realistic still life"
    ),
    width=1024, height=1024,
    generator=torch.Generator("cuda").manual_seed(42),
    num_inference_steps=STEPS, sigmas=SIGMAS,
    true_cfg_scale=1.0, use_kv_cache=True,
).images[0]
image.save(f"mug-{STEPS}-step.png")
Verify the setup at 8 steps first. Switching to 5 selects its matching file and sigmas.
Optional image-editing example using the same pipeline
from PIL import Image

source = Image.open("mug-reference.png").convert("RGB")
edited = pipe(
    prompt="Keep the ceramic mug shape; change the background to a warm gray studio.",
    image=source,
    width=1024, height=1024,
    generator=torch.Generator("cuda").manual_seed(42),
    num_inference_steps=STEPS, sigmas=SIGMAS,
    true_cfg_scale=1.0, use_kv_cache=True,
).images[0]
edited.save("mug-edited.png")
Optional: append this after the first script and place mug-reference.png in the same folder; it reuses pipe and STEPS.
A workbench with books and a small expansion card beside a desktop fitted with a graphics card
Even a small adapter file still needs memory for the base model.

Conditions behind the official 6.3× figure

The model card's up-to-6.3× result used one H100 80 GB, BF168, and batch size9 1. It used a Qwen model-card prompt and reported the median of three generations after one warm-up. Prompt encoding, denoising, and decoding10 were included, while PNG saving, model loading, and warm-up were excluded. This figure cannot predict total time until a file is saved on a personal GPU.

The chart compared the 40-step base with KV cache11 on against Pruna at 5 and 8 steps with KV cache off. It also used no LoRA merging, CFG12, compilation, or CPU13 offloading14. The quick-start code uses use_kv_cache=True for Pruna, so running it does not reproduce the chart conditions exactly.

For a local comparison, hold prompt, resolution, seed, runtime15, and save method constant, then inspect the images. Separate model loading and the first warm-up from repeated generation, and record the median across runs. A CPU timer stopped before CUDA work completes can underreport time, so do not time without synchronizing the GPU.

Check fine details and runtime support separately

After narrowing the options at 5 steps, zoom in on the mug rim, handle-to-body junction, and glaze highlights in an 8-step or base-model output. Eight steps do not mean base-model quality. If detail matters, compare against the original 40-step base. The published 2K chart compares speed, not verified 2K quality; training used 1K resolution.

The official quick start uses .to("cuda") and a CUDA random generator, so it targets CUDA. The model card does not establish Mac Metal16, MLX17, or GGUF18 integration, but that alone does not prove other implementations are impossible. If you choose another runtime, verify support for the Pruna adapter and its version. The site's /generate page shows estimated times for base Qwen-Image, not Pruna.

Three mug outputs on a table being compared under a magnifier for rim and handle details
Zoom in to inspect the rim ellipse and handle connection.

Match the weight terms to your intended use

The Pruna adapter is derived from Qwen-Image-2.1, and its model card and license refer to the Qwen Research License. Section 1 defines non-commercial use as research or evaluation; Section 2 limits permitted use to those non-commercial purposes. Commercial use requires a separate license. This summarizes the published terms, so read the full license and current model card before use.

Non-commercially evaluating a mug scene differs in purpose from creating product images for sale. Access to this guide or website does not expand the permitted use of the weights. Review rights for inputs and outputs separately before distribution.

Terminology notes

  1. LoRA — A method that learns and applies small additional weights to adapt a base model. The adapter is used with the base model for purposes such as style adaptation or few-step generation.

    Back to the text
  2. Prompt — The input text sent to a model. For generative models it describes the desired result and strongly shapes the output.

    Back to the text
  3. Pipeline — A sequence of processing stages from input to output. Different models or tools may be used at each stage.

    Back to the text
  4. VAE — Short for Variational Autoencoder. It can encode input into a compact latent representation or decode that representation into an output.

    Back to the text
  5. GPU — A processor designed to handle many calculations in parallel. It performs model computations during AI inference.

    Back to the text
  6. VRAM — Memory used by a graphics card’s GPU to store model weights and intermediate values.

    Back to the text
  7. CUDA — A software platform for general-purpose computing on NVIDIA GPUs.

    Back to the text
  8. BF16 — A 16-bit floating-point format for model values. Its exponent has the same width as FP32, giving it a similarly wide value range.

    Back to the text
  9. Batch size — The number of inputs or requests processed together in one batch.

    Back to the text
  10. Token decoding — The stage that generates successive output tokens using the input and the response produced so far.

    Back to the text
  11. KV cache — Memory that stores attention keys and values from earlier tokens for reuse during later token generation. Its size depends on context length and batch size.

    Back to the text
  12. CFG — A technique that combines conditioned and unconditioned predictions to adjust how generation follows its input. Distilled models may require it to be disabled; recommended values vary by model.

    Back to the text
  13. CPU — The central processor that runs the operating system and general-purpose instructions; in AI workloads it also handles tasks such as preprocessing and data movement.

    Back to the text
  14. Offloading — Moving some model data from GPU memory to system RAM or storage when capacity is limited. This adds data transfer.

    Back to the text
  15. Runtime — The software environment that provides facilities needed while a program runs. In local AI, it can also refer to a model execution engine.

    Back to the text
  16. Metal — Apple’s low-level technology for graphics and parallel GPU computation.

    Back to the text
  17. MLX — Apple’s machine-learning framework, which runs models using memory shared by the CPU and GPU on Apple Silicon.

    Back to the text
  18. GGUF — A file format for model data, widely used by llama.cpp-based tools.

    Back to the text

Frequently asked questions

What should you check first in this article?
Pruna-Qwen-Image-2.1 is a LoRA adapter connected to the Qwen-Image-2.1 image model. Its additional weights are trained for few-step generation, enabling quick trials of prompt lighting and composition. This guide explores selecting candidates with 5 steps and comparing details with the quality-first 8-step adapter or 40-step base model.
How much memory does it need?
Each adapter file is about 335.6 MB. The pipeline, text encoder, and VAE remain from the base model, so this file size does not represent total GPU memory requirements. Intermediate computation space also depends on resolution. The model card does not establish VRAM savings or prove that smaller GPUs can run it.
Where can you check the conditions and sources?
The model card's up-to-6.3× result used one H100 80 GB, BF16, and batch size 1. It used a Qwen model-card prompt and reported the median of three generations after one warm-up. Prompt encoding, denoising, and decoding were included, while PNG saving, model loading, and warm-up were excluded. This figure cannot predict total time until a file is saved on a personal GPU.