Qwen-Image
Qwen-Image
Qwen-Image is Alibaba Cloud’s flow-matching image model. NeMo AutoModel supports Qwen-Image text-to-image training and cached, full-parameter training of Qwen-Image-Edit-2511.
Available Models
Qwen-Image-Edit-2511 training is intentionally limited to cached target/context latents and cached Qwen2.5-VL prompt conditioning. Raw-image online encoding, LoRA, older Qwen image-edit checkpoints, and multinode tuning are not supported by the training recipe. Image-edit inference is supported by the generic generation script.
Recipes
Prepare MagicBrush
The validation protocol uses osunlp/MagicBrush, an instruction-based editing dataset released under CC-BY-4.0. It contains 8,807 training examples and 528 development examples.
The generic exporter maps dataset columns to ordered editing roles. Mapping source_img to both context and condition writes the image only once while retaining both role entries. The dataset’s mask is retained in source-manifest metadata for future masked-edit adapters.
Create the 64-example correctness cache with aspect-ratio-preserving processing limited to approximately 1024² total pixels:
Create the 1,024-example fixed-square performance cache by replacing the split, limit, resolution, and output arguments:
The performance preset resizes both source and target to 1024×1024. If that shape cannot complete without an out-of-memory error, use the 768p preset for every compared run and record the fallback.
Cache Contract
Each versioned cache sample contains:
target_latent:[channels, height, width]context_latents: an ordered list of[channels, context_height, context_width]tensorsprompt_embeddings:[sequence, hidden]prompt_attention_mask:[sequence]conditioning_tensors: optional explicitly named tensorsmetadata: original IDs, tensor shapes, token lengths, and the compound target/context bucket signature
The top-level metadata.json records the source dataset ID, dataset config when provided, split, row limit, and preprocessing settings. Batches contain only compatible target and ordered-context shapes, and their CPU metadata includes target, context, text, and total token counts.
Train
Set data.dataloader.cache_dir and checkpoint.checkpoint_dir in the recipe, then launch one FSDP2 rank per H100:
The baseline uses BF16 parameters and compute, whole Qwen transformer-block activation checkpointing, beta timestep sampling, and the distributed checkpoint manager. Consolidated model checkpoints are written in the Diffusers-compatible safetensors format (checkpoint.diffusers_compatible: true), matching the other diffusion recipes. Set checkpoint.restore_from: LATEST to resume the optimizer, scheduler, dataloader, sampler, and step state.
Checkpoint-resume smoke test
Use the 64-example correctness cache and a new checkpoint path. The first launch saves after 10 completed optimizer steps:
Resume the same run and continue to 20 completed optimizer steps:
The smoke test passes when the first launch writes the step-10 checkpoint, the second launch restores it and reaches step 20, and every reported loss and gradient norm is finite.
Generate
Use generate_qwen_image_edit.yaml to edit an image with the base model or a consolidated training checkpoint. Each entry in inference.input_images is paired with the prompt at the same position, so both lists must have the same length.
Pass the epoch checkpoint directory, source image, and edit instruction to the generic generation script:
The checkpoint directory must contain the consolidated Diffusers-compatible safetensors written by training with checkpoint.save_consolidated: final. Omit --model.checkpoint to run with the base Qwen/Qwen-Image-Edit-2511 weights.
Install
From a source checkout, install the diffusion media dependencies:
See the Installation Guide and Diffusion Training and Fine-Tuning Guide.