Text-to-Image
Diffusers
Safetensors
English
Chinese
QwenImage21Pipeline
image-generation
qwen-image
sdnq
8-bit precision
Instructions to use OzzyGT/Qwen_Image_2_1_sdnq_dynamic_4bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use OzzyGT/Qwen_Image_2_1_sdnq_dynamic_4bit with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("OzzyGT/Qwen_Image_2_1_sdnq_dynamic_4bit", 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
Qwen Image 2.1 SDNQ Dynamic INT4
Same prompt and seed; the int4 model is on the right.
This is an int4 quantized version of Qwen/Qwen-Image-2.1 using SDNQ (SD.Next Quantization) with the dynamic option and Hadamard Rotation.
Note: You need SDNQ v0.2.2 or superior
Usage
You can find ready-to-use scripts in the diffusers-recipes repository.
Sample image
The quantized (right) image above was generated with the following prompt and settings (seed 42):
import sdnq # register the SDNQ backend before loading
import torch
from diffusers import DiffusionPipeline
pipe = DiffusionPipeline.from_pretrained("OzzyGT/Qwen_Image_2_1_sdnq_dynamic_4bit", torch_dtype=torch.bfloat16)
pipe.enable_model_cpu_offload()
pipe.vae.enable_tiling()
prompt = """The image is a wide realistic photograph of a sign painter lettering a glass shop door at dusk, set against a deep blue-grey cobbled street. The background is a narrow street receding toward the upper right, its wet cobblestones a mottled blue-grey broken by scattered amber highlights, the far end dissolving into soft bokeh. In the centre of the frame a man in his late forties kneels on one knee on the wet stones, his body angled three-quarters away from the viewer and his face in lost profile as he looks up at his work. He wears a heavy charcoal wool coat over a collarless off-white shirt, both flecked with dried paint, and his forearms are bare to the elbow. In his right hand he holds a fine sable lettering brush, its tip loaded with gold size, and his left forearm rests along a slender wooden mahl stick braced against the door frame. Across the upper third of the glass, a row of gold leaf capitals reads "HALVARD & CO.", each letter outlined in a thin dark keyline. Directly beneath it, in smaller black serif capitals, a second line reads "EST. 1931". He is working on the outside face of the glass, so both lines read correctly to the viewer, the wet gold still glossy where the last stroke ended mid-letter. On the right side of the frame, the dark glass returns a reflection of the street behind the viewer: a deep red neon sign whose letters appear reversed as "BAR", and the smeared white headlights of a passing car drawn into horizontal streaks. In the lower-left corner an open wooden toolbox sits on the cobbles with its lid folded back, and beside it three brushes stand upright in a squat glass jar half-filled with what appears to be cloudy solvent. Along the lower edge of the frame, the wet stones throw the gold lettering back as a broken vertical smear, its fragments displaced by the gaps between the cobbles. Behind his left shoulder, a cast-iron downpipe runs up the corner of the building, its paint blistered and rust-streaked. In the upper-left corner, the edge of a striped fabric awning is cropped by the frame. His breath is faintly visible in the cold air, a pale wisp drifting to the right of his jaw. The lighting is low and directional, a warm sodium streetlamp out of frame to the left raking across the glass and the painter's shoulder while the blue dusk fills the shadows, leaving a hard specular line down the edge of the door. The overall composition is asymmetric and horizontal, weighted to the left by the kneeling figure and balanced by the lettering and reflections on the right, in a muted palette of blue-grey, charcoal and warm amber."""
image = pipe(
prompt,
height=1696,
width=2528,
num_inference_steps=25,
true_cfg_scale=1.0,
generator=torch.Generator("cpu").manual_seed(42),
).images[0]
image.save("sample.png")
- Downloads last month
- 8
Model tree for OzzyGT/Qwen_Image_2_1_sdnq_dynamic_4bit
Base model
Qwen/Qwen-Image-2.1
