leejet / stable-diffusion.cpp

Stable Diffusion and Flux in pure C/C++
MIT License
3.55k stars 306 forks source link

Wrong model type when using qauntized t5xxl,clip and vae #374

Open KintCark opened 3 months ago

KintCark commented 3 months ago

When I put q3 t5xxl and clip the ccp says it's f16 and vae f32 these are wrong which causes termux to crash. Flux model is shown correctly if I use flux q2 it shows q2 please fix.

Another issue: the flux prompt coherence is horrible I use flux q3 and I put jedi cat but it just gave me the word cat.s and when I put pretty woman holding a rose,it just showed a picture of a rose. Is this because I'm using q3 t5xxl? I can't use fp8 t5 it crashes termux but it works fine in comfyui we need more memory optimization like split sigmas or split attention optimization

Update: I tried it again this time it got flux and clip models correctly but t5xxl it says q8_0 when actually it's q2_k

Green-Sky commented 3 months ago

you mean this?

[INFO ] stable-diffusion.cpp:255  - Weight type:                 q8_0
[INFO ] stable-diffusion.cpp:256  - Conditioner weight type:     q8_0
[INFO ] stable-diffusion.cpp:257  - Diffsuion model weight type: q8_0
[INFO ] stable-diffusion.cpp:258  - VAE weight type:             q8_0

this will display different things depending on model and backend that you are using.

Also, it is always helpful to share the command you used :)

KintCark commented 3 months ago

./bin/sd --diffusion-model /root/stable-diffusion.cpp/build/models/flux1-schnell-q2_k.gguf --cfg-scale 1 --steps 1 --seed 0 --sampling-method euler -H 320 -W 320 -p "Jedi cat holding a light saber, cyberpunk sci-fi,16k resolution, sharp focus, hd" --vae /root/stable-diffusion.cpp/build/vae/ae-f16.gguf --vae-on-cpu --threads 8 --clip_l /root/stable-diffusion.cpp/build/models/clip_l-q8_0.gguf --t5xxl /root/stable-diffusion.cpp/build/models/t5xxl_q2_k.gguf --clip-on-cpu

I used this

Green-Sky commented 3 months ago

on cuda i get:

[INFO ] stable-diffusion.cpp:224  - Version: Flux Schnell
[INFO ] stable-diffusion.cpp:255  - Weight type:                 q8_0
[INFO ] stable-diffusion.cpp:256  - Conditioner weight type:     q8_0
[INFO ] stable-diffusion.cpp:257  - Diffsuion model weight type: q3_K
[INFO ] stable-diffusion.cpp:258  - VAE weight type:             f16

with sd -v --diffusion-model models/fluxunchainedAndSchnfuFluxD_schnfuV13-q3_k.gguf --vae models/flux-extra/ae-f16.gguf --clip_l models/flux-extra/clip_l-q8_0.gguf --t5xxl models/flux-extra/t5xxl_fp16.safetensors --cfg-scale 1.0 --sampling-method euler --steps 6

btw, you seems to be trying very hard -H 320 -W 320, good luck with your system :). You can try increasing the number of steps to 6, to counteract some of the quantization artifacts.

leejet commented 3 months ago

Are you using the latest sd.cpp?

KintCark commented 3 months ago

Are you using the latest sd.cpp?

Yea I think I am