Can't get right output image, pls help.

#9
by wikeeyang - opened

ENV: Ubuntu 24.04, RTX 4090 24GB, Python 3.12, CUDA 12.8, Torch 2.80, list as below:
Package Version


accelerate 1.12.0
diffusers 0.36.0.dev0
numpy 2.3.5
nvidia-cuda-runtime-cu12 12.8.90
nvidia-cudnn-cu12 9.10.2.21
pillow 12.0.0
safetensors 0.7.0
sdnq 0.1.2
torch 2.8.0+cu128
torchaudio 2.8.0+cu128
torchvision 0.23.0+cu128
transformers 4.57.3
triton 3.4.0

hf download Disty0/Z-Image-Turbo-SDNQ-uint4-svd-r32 --local-dir sdnq/Z-Image-Turbo-SDNQ-uint4-svd-r32

copy the demo script and run:

cat Test-sdnq-Z-Image.py

import torch
import diffusers
from sdnq import SDNQConfig # import sdnq to register it into diffusers and transformers

pipe = diffusers.ZImagePipeline.from_pretrained("sdnq/Z-Image-Turbo-SDNQ-uint4-svd-r32", torch_dtype=torch.bfloat16).to('cuda')

pipe.enable_model_cpu_offload()

prompt = "Young Chinese woman in red Hanfu, intricate embroidery. Impeccable makeup, red floral forehead pattern. Elaborate high bun, golden phoenix headdress, red flowers, beads. Holds round folding fan with lady, trees, bird. Neon lightning-bolt lamp (โšก๏ธ), bright yellow glow, above extended left palm. Soft-lit outdoor night background, silhouetted tiered pagoda (่ฅฟๅฎ‰ๅคง้›ๅก”), blurred colorful distant lights."
image = pipe(
prompt=prompt,
height=1920,
width=1216,
num_inference_steps=9,
guidance_scale=0.0,
generator=torch.manual_seed(42),
).images[0]
image.save("z-image-turbo-sdnq-uint4-svd-r32.png")

log as below:

(py12) adm@ubuntu2404:~/models$ python Test-sdnq-Z-Image.py
Loading pipeline components...: 80%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–Œ | 4/5 [00:02<00:00, 1.82it/s]
torch_dtype is deprecated! Use dtype instead!
Loading pipeline components...: 100%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 5/5 [00:03<00:00, 1.40it/s]
100%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 9/9 [00:18<00:00, 2.06s/it]

(py12) adm@ubuntu2404:~/models$ ll
total 1496
drwxrwxr-x 4 adm adm 4096 Dec 2 10:07 ./
drwxrwxr-x 67 adm adm 4096 Nov 25 07:23 ../
-rw-rw-r-- 1 adm adm 923 Dec 1 21:04 Test-sdnq-Z-Image.py
drwxrwxr-x 3 adm adm 4096 Dec 1 11:24 sdnq/
-rw-rw-r-- 1 adm adm 1509365 Dec 2 10:07 z-image-turbo-sdnq-uint4-svd-r32.png

the image as below:

z-image-turbo-sdnq-uint4-svd-r32-05

No any error, but I don't know what happened.

Does this happen now? New transformers broke the tokenizer so i had to push a generic version that works with both old and new transformers.

Thanks! Yes, I updated the model from your repo, but the results are still the same as before. I tried transformers 4.57.3 and 5.0.0-dev, but the generated images are the same. I have no idea why.

20d5686065280a1ab84e065e072d4a26

2b6dc275ac7736f50c380b4359ae6310

I delete the old model and download it from modelscope https://www.modelscope.cn/models/Disty0/Z-Image-Turbo-SDNQ-uint4-svd-r32, it's run normally, haha...๐Ÿคฃ๐Ÿคฃ๐Ÿคฃ, Thanks a lot!

0665c6c6c6267702daffe1b97f4a7ada

z-image-turbo-sdnq-uint4-svd-r32-08

wikeeyang changed discussion status to closed

Sign up or log in to comment