Skip to content

PhotoMaker crash with quantized model #648

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
rmatif opened this issue Apr 5, 2025 · 0 comments
Open

PhotoMaker crash with quantized model #648

rmatif opened this issue Apr 5, 2025 · 0 comments

Comments

@rmatif
Copy link

rmatif commented Apr 5, 2025

When running PhotoMaker (I have just tested v1), it crashes when using a quantized model, while the fp16 models work just fine

@rmatif ➜ /workspaces/stable-diffusion.cpp (master) $ ./build/bin/sd -m models/sd_xl_turbo_1.0_fp16.safetensors  --taesd models/diffusion_pytorch_model.safetensors --stacked-id-embd-dir models/photomaker-v1.safetensors --input-id-images-dir photomaker -p "a girl img, retro futurism, retro game art style but extremely beautiful, intricate details, masterpiece, best quality, space-themed, cosmic, celestial, stars, galaxies, nebulas, planets, science fiction, highly detailed" --steps 1 --cfg-scale 1 --style-ratio 10 -o output.png -v -H 512 -W 512 --type q8_0
Option: 
    n_threads:         4
    mode:              txt2img
    model_path:        models/sd_xl_turbo_1.0_fp16.safetensors
    wtype:             q8_0
    clip_l_path:       
    clip_g_path:       
    t5xxl_path:        
    diffusion_model_path:   
    vae_path:          
    taesd_path:        models/diffusion_pytorch_model.safetensors
    esrgan_path:       
    controlnet_path:   
    embeddings_path:   
    stacked_id_embeddings_path:   models/photomaker-v1.safetensors
    input_id_images_path:   photomaker
    style ratio:       10.00
    normalize input image :  false
    output_path:       output.png
    init_img:          
    mask_img:          
    control_image:     
    clip on cpu:       false
    controlnet cpu:    false
    vae decoder on cpu:false
    diffusion flash attention:false
    strength(control): 0.90
    prompt:            a girl img, retro futurism, retro game art style but extremely beautiful, intricate details, masterpiece, best quality, space-themed, cosmic, celestial, stars, galaxies, nebulas, planets, science fiction, highly detailed
    negative_prompt:   
    min_cfg:           1.00
    cfg_scale:         1.00
    slg_scale:         0.00
    guidance:          3.50
    eta:               0.00
    clip_skip:         -1
    width:             512
    height:            512
    sample_method:     euler_a
    schedule:          default
    sample_steps:      1
    strength(img2img): 0.75
    rng:               cuda
    seed:              42
    batch_count:       1
    vae_tiling:        false
    upscale_repeats:   1
System Info: 
    SSE3 = 1
    AVX = 1
    AVX2 = 1
    AVX512 = 0
    AVX512_VBMI = 0
    AVX512_VNNI = 0
    FMA = 1
    NEON = 0
    ARM_FMA = 0
    F16C = 1
    FP16_VA = 0
    WASM_SIMD = 0
    VSX = 0
[DEBUG] stable-diffusion.cpp:188  - Using CPU backend
[INFO ] stable-diffusion.cpp:197  - loading model from 'models/sd_xl_turbo_1.0_fp16.safetensors'
[INFO ] model.cpp:908  - load models/sd_xl_turbo_1.0_fp16.safetensors using safetensors format
[DEBUG] model.cpp:979  - init from 'models/sd_xl_turbo_1.0_fp16.safetensors'
[INFO ] stable-diffusion.cpp:244  - Version: SDXL 
[INFO ] stable-diffusion.cpp:277  - Weight type:                 q8_0
[INFO ] stable-diffusion.cpp:278  - Conditioner weight type:     q8_0
[INFO ] stable-diffusion.cpp:279  - Diffusion model weight type: q8_0
[INFO ] stable-diffusion.cpp:280  - VAE weight type:             f32
[DEBUG] stable-diffusion.cpp:282  - ggml tensor size = 400 bytes
[DEBUG] clip.hpp:171  - vocab size: 49408
[DEBUG] clip.hpp:182  -  trigger word img already in vocab
[DEBUG] ggml_extend.hpp:1174 - clip params backend buffer size =  231.50 MB(RAM) (196 tensors)
[DEBUG] ggml_extend.hpp:1174 - clip params backend buffer size =  887.42 MB(RAM) (517 tensors)
[DEBUG] ggml_extend.hpp:1174 - unet params backend buffer size =  2931.68 MB(RAM) (1680 tensors)
[INFO ] model.cpp:908  - load models/photomaker-v1.safetensors using safetensors format
[DEBUG] model.cpp:979  - init from 'models/photomaker-v1.safetensors'
[INFO ] lora.hpp:117  - loading LoRA from 'models/photomaker-v1.safetensors'
[DEBUG] model.cpp:1727 - loading tensors from models/photomaker-v1.safetensors
[DEBUG] ggml_extend.hpp:1174 - lora params backend buffer size =  354.38 MB(RAM) (1120 tensors)
[DEBUG] model.cpp:1727 - loading tensors from models/photomaker-v1.safetensors
  |=====================================>            | 1134/1527 - 1000.00it/s[DEBUG] lora.hpp:160  - lora type: ".lora_down"/".lora_up"
[DEBUG] lora.hpp:162  - finished loaded lora
[INFO ] stable-diffusion.cpp:392  - loading stacked ID embedding (PHOTOMAKER) model file from 'models/photomaker-v1.safetensors'
[INFO ] model.cpp:908  - load models/photomaker-v1.safetensors using safetensors format
[DEBUG] model.cpp:979  - init from 'models/photomaker-v1.safetensors'
[DEBUG] ggml_extend.hpp:1174 - pmid params backend buffer size =  1243.48 MB(RAM) (407 tensors)
[DEBUG] stable-diffusion.cpp:419  - loading weights
[DEBUG] model.cpp:1727 - loading tensors from models/sd_xl_turbo_1.0_fp16.safetensors
  |===============================>                  | 2641/4168 - 125.00it/s[DEBUG] model.cpp:1727 - loading tensors from models/photomaker-v1.safetensors
  |==================================================| 4168/4168 - 90.91it/s
[INFO ] tae.hpp:214  - loading taesd from 'models/diffusion_pytorch_model.safetensors', decode_only = true
[DEBUG] ggml_extend.hpp:1174 - taesd params backend buffer size =   2.34 MB(RAM) (67 tensors)
[INFO ] model.cpp:908  - load models/diffusion_pytorch_model.safetensors using safetensors format
[DEBUG] model.cpp:979  - init from 'models/diffusion_pytorch_model.safetensors'
[DEBUG] model.cpp:1727 - loading tensors from models/diffusion_pytorch_model.safetensors
  |=========================>                        | 67/134 - 0.00it/s[INFO ] tae.hpp:236  - taesd model loaded
[INFO ] stable-diffusion.cpp:503  - total params memory size = 5296.42MB (VRAM 2.34MB, RAM 5294.09MB): clip 1118.92MB(RAM), unet 2931.68MB(RAM), vae 2.34MB(VRAM), controlnet 0.00MB(VRAM), pmid 1243.48MB(RAM)
[INFO ] stable-diffusion.cpp:522  - loading model from 'models/sd_xl_turbo_1.0_fp16.safetensors' completed, taking 29.53s
[INFO ] stable-diffusion.cpp:556  - running in eps-prediction mode
[DEBUG] stable-diffusion.cpp:600  - finished loaded file
[DEBUG] stable-diffusion.cpp:1548 - txt2img 512x512
[DEBUG] stable-diffusion.cpp:1241 - prompt after extract and remove lora: "a girl img, retro futurism, retro game art style but extremely beautiful, intricate details, masterpiece, best quality, space-themed, cosmic, celestial, stars, galaxies, nebulas, planets, science fiction, highly detailed"
[INFO ] stable-diffusion.cpp:690  - Attempting to apply 0 LoRAs
[INFO ] stable-diffusion.cpp:1246 - apply_loras completed, taking 0.00s
/workspaces/stable-diffusion.cpp/ggml/src/ggml.c:5764: GGML_ASSERT(cgraph->n_nodes < cgraph->size) failed
Could not attach to process.  If your uid matches the uid of the target
process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try
again as the root user.  For more details, see /etc/sysctl.d/10-ptrace.conf
ptrace: Operation not permitted.
No stack.
The program is not being run.
Aborted (core dumped)

The same command without --type q8_0 works just fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant