notes

Log | Files | Refs

stable-diffusion-cpp.txt (2703B)


      1 Stable Diffusion CPP
      2 
      3 mkdir -p ~/models/flux
      4 cd ~/models/flux
      5 
      6 
      7 1. Download the VAE from the official FLUX.1-dev repository:
      8 
      9 hf download black-forest-labs/FLUX.1-dev \
     10   ae.safetensors \
     11   --local-dir ~/models/flux
     12 
     13 2. Download both text encoders:
     14 
     15 hf download comfyanonymous/flux_text_encoders \
     16   clip_l.safetensors \
     17   t5xxl_fp16.safetensors \
     18   --local-dir ~/models/flux
     19 
     20 3. Download the GGUF model
     21 
     22 For your command, you need a FLUX.1-schnell GGUF file—not the original flux1-schnell.safetensors. The project recommends using preconverted GGUF weights, rather than FP16 FLUX weights, because of FP16 overflow issues and the VRAM benefits of quantization.
     23 
     24 3.1 First, list the files in a compatible GGUF repository:
     25 
     26 hf repo-files leejet/FLUX.1-schnell-GGUF
     27 
     28 3.2 Then download the exact filename listed there. For example, if it lists flux1-schnell-q8_0.gguf:
     29 
     30 hf download leejet/FLUX.1-schnell-GGUF \
     31   flux1-schnell-q8_0.gguf \
     32   --local-dir ~/models/flux
     33 
     34 or
     35 
     36 hf download gpustack/FLUX.1-schnell-GGUF \
     37   flux1-schnell-q4_k.gguf \
     38   --local-dir ~/models/flux
     39 
     40 If the repository or filename differs, use the exact owner/repository and filename returned by hf repo-files. The official project documentation links to preconverted FLUX.1-schnell GGUF weights but does not guarantee a particular repository filename permanently.
     41 
     42 4. Run it correctly
     43 
     44 Your pasted command has a shell formatting issue: a backslash must be the final character on its line. Use this:
     45 
     46 ./build/bin/sd-cli \
     47   --diffusion-model ~/models/flux/flux1-schnell-q8_0.gguf \
     48   --vae ~/models/flux/ae.safetensors \
     49   --clip_l ~/models/flux/clip_l.safetensors \
     50   --t5xxl ~/models/flux/t5xxl_fp16.safetensors \
     51   --prompt "A cinematic photo of Vienna at blue hour after rain, reflections on wet cobblestones, warm café lights" \
     52   --width 1024 \
     53   --height 1024 \
     54   --steps 4 \
     55   --cfg-scale 1.0 \
     56   --sampling-method euler \
     57   --diffusion-fa \
     58   --seed -1 \
     59   --output ~/Pictures/flux-schnell.png \
     60   --verbose
     61 
     62 If run out of memory, then put the large T5-XXL encoder in system RAM, keep the diffusion model on the RTX 4090, and use a lower quantization than Q8 if needed:
     63 
     64   ./build/bin/sd-cli \
     65   --diffusion-model ~/models/flux/flux1-schnell-q4_k.gguf \
     66   --vae ~/models/flux/ae.safetensors \
     67   --clip_l ~/models/flux/clip_l.safetensors \
     68   --t5xxl ~/models/flux/t5xxl_fp16.safetensors \
     69   --clip-on-cpu \
     70   --vae-on-cpu \
     71   --prompt "A cinematic photo of Vienna at blue hour after rain, reflections on wet cobblestones, warm café lights" \
     72   --width 1024 \
     73   --height 1024 \
     74   --steps 4 \
     75   --cfg-scale 1.0 \
     76   --sampling-method euler \
     77   --diffusion-fa \
     78   --seed -1 \
     79   --output ~/Pictures/flux-schnell.png \
     80   --verbose