catplusplus/Qwen-Rapid-AIO-v18-NSFW-nunchaku

认证创作者 catplusplus 已认证
🤗 Hugging Face 来源text-to-imageapache-2.042 GBsafetensors✓ 7 个校验和今天更新
磁力链接🌱 3✓ 与 Hugging Face 一致

This model will strictly adher to prompts with NSFW finetuned transformer of base model and included heretic text encoder. User assumes all resposibility for approporiate/ethical generation and distribution of images. The model is optimized with nunchaku transformer for fast image generation on a single Blackwell 16GB GPU such as Geoforce RTX 5060 Ti

Qwen-Image-Edit-Rapid-AIO v18 (Nunchaku SVDQuant NVFP4) 🌟🚀

This repository provides official SVDQuant NVFP4 quantized weights for Phr00t's Qwen-Image-Edit-Rapid-AIO v18 NSFW model, packaged for high-speed inference with Nunchaku on NVIDIA Blackwell (sm_120), Ada Lovelace, and Hopper architectures.


⚡ Highlights

  • 4-Step Fast Inference: Distilled for rapid 4-step generation with guidance_scale=1.0.
  • Dual Precision Checkpoints:
    • svdq-fp4_r32-qwen-rapid-aio-v18-nsfw.safetensors (11.95 GB): Ultra-fast, fits 100% resident in VRAM on 16GB GPUs without layer-by-layer offloading.
    • svdq-fp4_r128-qwen-rapid-aio-v18-nsfw.safetensors (13.08 GB): Maximum expressiveness and high-frequency acuity.
  • Zero Cobblestone Artifacts: Healed with calibrated AWQ INT4 modulations (img_mod.1 and txt_mod.1) to eliminate patch-to-patch gain flutter.
  • Resident VRAM on 16GB GPUs: Can run with offload=False at 1024x1024, peaking at only 12.19 GB VRAM (leaving 3.8+ GB headroom) when using VAE tiling.
  • Full Multimodal Editing & T2I Support: Fully compatible with both QwenImagePipeline and QwenImageEditPlusPipeline.

📊 Performance Benchmarks (RTX 5060 Ti 16GB)

Resolution Aspect Ratio Mode DiT Speed Total Latency Peak VRAM
512 x 512 1:1 Resident (No Layer Offload) 5.56 it/s 2.81s 12.37 GB
768 x 768 1:1 Resident (No Layer Offload) 2.58 it/s 3.03s 13.65 GB
1024 x 576 16:9 Resident (No Layer Offload) 2.36 it/s 4.49s 12.18 GB
1024 x 1024 1:1 Resident (No Layer Offload) 1.16 it/s 6.30s 12.19 GB
1024 x 1024 1:1 Layer-by-Layer Offload 1.10 it/s 3.64s < 6.0 GB

🚀 Quickstart Usage

1. Installation

pip install nunchaku diffusers transformers accelerate

2. Text-to-Image Generation (Python)

import torch
from diffusers import FlowMatchEulerDiscreteScheduler, QwenImagePipeline
from nunchaku.models.transformers.transformer_qwenimage import NunchakuQwenImageTransformer2DModel

# Load Nunchaku FP4 Transformer (Rank 32 or Rank 128)
transformer = NunchakuQwenImageTransformer2DModel.from_pretrained(
    "svdq-fp4_r32-qwen-rapid-aio-v18-nsfw.safetensors",
    device="cuda:0",
    offload=False, # Set offload=True if VRAM < 12GB
    torch_dtype=torch.bfloat16,
)

scheduler = FlowMatchEulerDiscreteScheduler.from_pretrained(
    "Qwen/Qwen-Image-Edit-2511", subfolder="scheduler"
)
pipe = QwenImagePipeline.from_pretrained(
    "Qwen/Qwen-Image-Edit-2511",
    transformer=transformer,
    scheduler=scheduler,
    torch_dtype=torch.bfloat16,
)
pipe._exclude_from_cpu_offload.append("transformer")
pipe.enable_sequential_cpu_offload(gpu_id=0)
pipe.vae.enable_tiling()

image = pipe(
    prompt="A cute anime village girl with a ponytail in a sunny garden",
    width=1024,
    height=1024,
    num_inference_steps=4,
    true_cfg_scale=1.0,
).images[0]
image.save("output.png")

3. Image Editing with Reference Image

from diffusers import QwenImageEditPlusPipeline
from PIL import Image

pipe_edit = QwenImageEditPlusPipeline.from_pretrained(
    "Qwen/Qwen-Image-Edit-2511",
    transformer=transformer,
    torch_dtype=torch.bfloat16,
)
pipe_edit._exclude_from_cpu_offload.append("transformer")
pipe_edit.enable_sequential_cpu_offload(gpu_id=0)
pipe_edit.vae.enable_tiling()

# Ensure zero_cond_t is synchronized
if hasattr(transformer, "zero_cond_t"):
    transformer.zero_cond_t = True

init_img = Image.open("input.jpg").convert("RGB").resize((1024, 1024))
edited = pipe_edit(
    image=init_img,
    prompt="add sunglasses and a red ribbon",
    width=1024,
    height=1024,
    num_inference_steps=4,
    true_cfg_scale=1.0,
).images[0]
edited.save("edited.png")

📦 Extras & Reproducibility

The extras/ folder contains the exact scripts used to quantize and evaluate this model:

  • extras/stream_quantize.py: Layer-by-layer streaming SVDQuant quantizer.
  • extras/packer.py: Nunchaku Blackwell NVFP4 & AWQ INT4 memory-layout converter.
  • extras/QUANTIZATION_PLAYBOOK.md: Complete mathematical breakdown and discovery notes.
  • extras/run_gauntlet_benchmark.py: Multi-domain challenge evaluation suite.

💖 Acknowledgments