Views
No views yet
Language: English | 中文
Important: This quantized model cannot run with the official upstream nunchaku package (the official repo has not been actively maintained for a long time). Install vitoom-nunchaku prebuilt wheels, or deploy via vitoom for a ready-to-use platform.
tonera/Qwen-Image-Edit-2511-Lightning-Nunchakulightx2v/Qwen-Image-Edit-2511-LightningQwen/Qwen-Image-Edit-2511svdq-<precision>_r32-Qwen-Image-Edit-2511-Lightning-Nunchaku.safetensors; <precision> is commonly fp4 or int4. Pick the matching file according to your vitoom inference environment and the return value of get_precision(). The repo may also provide variants such as int8from_pretrained path when loading the pipelinesvdq-int4-Qwen2.5vl-Nunchaku.safetensors from tonera/Qwen2.5vl-Nunchaku (for multimodal edit paths such as QwenImageEditPlusPipeline; not svdq-int4-Qwen2.5vl-text-Nunchaku.safetensors)tonera/Qwen2.5vl-Nunchaku), hidden-states metrics are cosine ≈ 0.969 and rel_l2 ≈ 0.247; see that repo for details.1pip install "git+https://github.com/huggingface/diffusers.git"
2
3pip install torch==2.11.* torchvision==0.26.* torchaudio==2.11.* \
4 --index-url https://download.pytorch.org/whl/cu130
5
6hf download tonera/vitoom-nunchaku \
7 nunchaku-1.3.0.dev20260622+cu13.0torch2.11-cp311-cp311-linux_x86_64.whl \
8 --local-dir ./wheels
9
10pip install ./wheels/nunchaku-1.3.0.dev20260622+cu13.0torch2.11-cp311-cp311-linux_x86_64.whlpython -c "import nunchaku; from nunchaku import NunchakuQwenImageTransformer2DModel; print(nunchaku.__version__)"REPO / TE_REPO with your local path or Hugging Face ID.1import torch
2from diffusers import QwenImageEditPlusPipeline
3from diffusers.utils import load_image
4
5from nunchaku import NunchakuQwenEncoderModel, NunchakuQwenImageTransformer2DModel
6from nunchaku.torch_transfer_utils import pretouch_pipeline_cpu_tensors
7from nunchaku.utils import get_precision
8
9REPO = "tonera/Qwen-Image-Edit-2511-Lightning-Nunchaku"
10TE_REPO = "tonera/Qwen2.5vl-Nunchaku"
11NAME = "Qwen-Image-Edit-2511-Lightning-Nunchaku"
12
13torch_dtype = torch.bfloat16
14
15# Optional: quantized text encoder for much lower VRAM (use the non-text weight for edit models)
16text_encoder = NunchakuQwenEncoderModel.from_pretrained(
17 f"{TE_REPO}/svdq-int4-Qwen2.5vl-Nunchaku.safetensors"
18)
19
20transformer = NunchakuQwenImageTransformer2DModel.from_pretrained(
21 f"{REPO}/svdq-{get_precision()}_r32-{NAME}.safetensors"
22)
23
24pipe = QwenImageEditPlusPipeline.from_pretrained(
25 REPO,
26 text_encoder=text_encoder,
27 transformer=transformer,
28 torch_dtype=torch_dtype,
29)
30pretouch_pipeline_cpu_tensors(
31 pipe, ("text_encoder", "text_encoder_2", "vae", "unet", "transformer")
32)
33pipe.to("cuda")
34
35image1 = load_image("https://example.com/ref1.jpg").convert("RGB")
36image2 = load_image("https://example.com/ref2.jpg").convert("RGB")
37
38result = pipe(
39 prompt=(
40 "Combine the girl from image 1 and the girl from image 2 into a single girl; "
41 "the girl in image 1 wears a blue dress, and the girl in image 2 wears a red dress"
42 ),
43 negative_prompt=" ",
44 width=1024,
45 height=1024,
46 image=[image1, image2],
47 num_inference_steps=8,
48 true_cfg_scale=1.0,
49 generator=torch.Generator("cuda").manual_seed(42),
50).images[0]
51result.save("qwen_edit_2511_lightning_nunchaku.png")text_encoder= argument.PIL.Image or a URL-loaded image to image= instead of a list.1pipe.transformer.set_offload(True, use_pin_memory=True, num_blocks_on_gpu=1)
2pipe._exclude_from_cpu_offload.append("transformer")
3pipe.enable_sequential_cpu_offload()1from nunchaku.lora.common.compose import compose_lora
2
3lora_path = "/path/to/your_lora.safetensors"
4transformer.update_lora_params(compose_lora([(lora_path, 0.5)]))| Parameter | Suggested value | Notes |
|---|---|---|
num_inference_steps | 4–8 | Lightning distilled model; 8 steps is a common default |
true_cfg_scale | 1.0 | Matches Lightning configuration |
negative_prompt | " " | Placeholder space, consistent with official examples |
guidance_scale | 1.0 | Keep at 1 if the pipeline supports it |
| Approach | Best for |
|---|---|
| Install vitoom-nunchaku wheel (Option 1 above) | Developers running Python scripts in their own environment |
| Install vitoom (Option 2 below) | End users who want Web UI, Agent, and one-click deployment |