Text-to-Image
Diffusers
Safetensors
QwenImagePipeline
nvidia
ModelOpt
Qwen-Image
quantized
FP4
fp4
8-bit precision
Instructions to use nvidia/Qwen-Image-NVFP4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use nvidia/Qwen-Image-NVFP4 with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("nvidia/Qwen-Image-NVFP4", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
- DiffusionBee
File size: 777 Bytes
06b4b72 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | import base64, json, urllib.request
payload = {
"model": "/model",
"prompt": "A realistic photograph of a red ceramic teapot on a wooden table beside a window, soft morning light, detailed wood grain.",
"negative_prompt": " ", "size": "512x512",
"num_inference_steps": 50, "guidance_scale": 4.0, "seed": 42,
"response_format": "b64_json", "format": "png",
}
request = urllib.request.Request(
"http://127.0.0.1:8000/v1/images/generations",
data=json.dumps(payload).encode(), headers={"Content-Type": "application/json"})
with urllib.request.urlopen(request, timeout=600) as response:
result = json.load(response)
with open("sample.png", "wb") as output:
output.write(base64.b64decode(result["data"][0]["b64_json"]))
print("Saved sample.png")
|