Skip to content

Commit 73c2176

Browse files
authored
feat: add sd3 support (#298)
1 parent 9c51d87 commit 73c2176

30 files changed

+2429655
-1076
lines changed

.gitmodules

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[submodule "ggml"]
22
path = ggml
3-
url = https://github.com/ggerganov/ggml.git
3+
url = https://github.com/leejet/ggml.git

README.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<p align="center">
2-
<img src="./assets/a%20lovely%20cat.png" width="256x">
2+
<img src="./assets/cat_with_sd_cpp_42.png" width="360x">
33
</p>
44

55
# stable-diffusion.cpp
@@ -10,7 +10,7 @@ Inference of [Stable Diffusion](https://github.com/CompVis/stable-diffusion) in
1010

1111
- Plain C/C++ implementation based on [ggml](https://github.com/ggerganov/ggml), working in the same way as [llama.cpp](https://github.com/ggerganov/llama.cpp)
1212
- Super lightweight and without external dependencies
13-
- SD1.x, SD2.x and SDXL support
13+
- SD1.x, SD2.x, SDXL and SD3 support
1414
- !!!The VAE in SDXL encounters NaN issues under FP16, but unfortunately, the ggml_conv_2d only operates under FP16. Hence, a parameter is needed to specify the VAE that has fixed the FP16 NaN issue. You can find it here: [SDXL VAE FP16 Fix](https://huggingface.co/madebyollin/sdxl-vae-fp16-fix/blob/main/sdxl_vae.safetensors).
1515

1616
- [SD-Turbo](https://huggingface.co/stabilityai/sd-turbo) and [SDXL-Turbo](https://huggingface.co/stabilityai/sdxl-turbo) support
@@ -86,11 +86,13 @@ git submodule update
8686
- Stable Diffusion v1.4 from https://huggingface.co/CompVis/stable-diffusion-v-1-4-original
8787
- Stable Diffusion v1.5 from https://huggingface.co/runwayml/stable-diffusion-v1-5
8888
- Stable Diffuison v2.1 from https://huggingface.co/stabilityai/stable-diffusion-2-1
89+
- Stable Diffusion 3 2B from https://huggingface.co/stabilityai/stable-diffusion-3-medium
8990

9091
```shell
9192
curl -L -O https://huggingface.co/CompVis/stable-diffusion-v-1-4-original/resolve/main/sd-v1-4.ckpt
9293
# curl -L -O https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.safetensors
9394
# curl -L -O https://huggingface.co/stabilityai/stable-diffusion-2-1/resolve/main/v2-1_768-nonema-pruned.safetensors
95+
# curl -L -O https://huggingface.co/stabilityai/stable-diffusion-3-medium/resolve/main/sd3_medium_incl_clips_t5xxlfp16.safetensors
9496
```
9597

9698
### Build
@@ -226,6 +228,7 @@ For example:
226228
./bin/sd -m ../models/sd-v1-4.ckpt -p "a lovely cat"
227229
# ./bin/sd -m ../models/v1-5-pruned-emaonly.safetensors -p "a lovely cat"
228230
# ./bin/sd -m ../models/sd_xl_base_1.0.safetensors --vae ../models/sdxl_vae-fp16-fix.safetensors -H 1024 -W 1024 -p "a lovely cat" -v
231+
# ./bin/sd -m ../models/sd3_medium_incl_clips_t5xxlfp16.safetensors -H 1024 -W 1024 -p 'a lovely cat holding a sign says \"Stable Diffusion CPP\"' --cfg-scale 4.5 --sampling-method euler -v
229232
```
230233

231234
Using formats of different precisions will yield results of varying quality.
@@ -384,6 +387,7 @@ Thank you to all the people who have already contributed to stable-diffusion.cpp
384387

385388
- [ggml](https://github.com/ggerganov/ggml)
386389
- [stable-diffusion](https://github.com/CompVis/stable-diffusion)
390+
- [sd3-ref](https://github.com/Stability-AI/sd3-ref)
387391
- [stable-diffusion-stability-ai](https://github.com/Stability-AI/stablediffusion)
388392
- [stable-diffusion-webui](https://github.com/AUTOMATIC1111/stable-diffusion-webui)
389393
- [ComfyUI](https://github.com/comfyanonymous/ComfyUI)

assets/cat_with_sd_cpp_20184.png

1.44 MB
Loading

assets/cat_with_sd_cpp_42.png

1.24 MB
Loading

0 commit comments

Comments
 (0)