kostakoff commited on
Commit
adde3d4
·
1 Parent(s): 05e06b5

added readme

Browse files
Files changed (2) hide show
  1. README.md +119 -0
  2. out.png +3 -0
README.md CHANGED
@@ -11,3 +11,122 @@ inference: true
11
  ---
12
 
13
  # Stable Diffusion v1-5 GGUF Model Card
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  ---
12
 
13
  # Stable Diffusion v1-5 GGUF Model Card
14
+
15
+ Quantized versions of [stable-diffusion-v1-5](https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-v1-5) in **GGUF** format for use with [stable-diffusion.cpp](https://github.com/leejet/stable-diffusion.cpp).
16
+
17
+ At the time of publishing, no ready-made GGUF weights for SDXL were available for sd.cpp runtime — so here we are.
18
+
19
+ ![Sample output](out.png)
20
+ *Sample generation: "A lovely cat" · seed 357925 · Q8_0 · 512×512*
21
+
22
+ ---
23
+
24
+ ## Available Quantizations
25
+
26
+ | File | Quantization | Description |
27
+ |------|-------------|-------------|
28
+ | `v1-5-pruned_bf16.gguf` | BF16 | Near-lossless, largest file ⚠️ See note below |
29
+ | `v1-5-pruned_Q8_0.gguf` | Q8_0 | High quality, ~half the size of bf16 |
30
+ | `v1-5-pruned_Q4_K.gguf` | Q4_K | Balanced quality/size |
31
+ | `v1-5-pruned_Q4_0.gguf` | Q4_0 | Smallest, fastest, slight quality loss |
32
+
33
+ > ⚠️ **BF16 known issue:** The `bf16` variant produces a **black image** when used with SD 1.5 in stable-diffusion.cpp. This appears to be a bug specific to SD 1.5 — other model architectures are not affected. Use `Q8_0` if you need maximum quality without quantization loss.
34
+
35
+ ---
36
+
37
+ ## Quick Start
38
+
39
+ ### 1. Download the model
40
+
41
+ ```bash
42
+ wget https://huggingface.co/kostakoff/stable-diffusion-v1-5-GGUF/resolve/main/v1-5-pruned_Q4_0.gguf
43
+
44
+ # Other quantizations:
45
+ # wget https://huggingface.co/kostakoff/stable-diffusion-v1-5-GGUF/resolve/main/v1-5-pruned_Q4_K.gguf
46
+ # wget https://huggingface.co/kostakoff/stable-diffusion-v1-5-GGUF/resolve/main/v1-5-pruned_Q8_0.gguf
47
+ # wget https://huggingface.co/kostakoff/stable-diffusion-v1-5-GGUF/resolve/main/v1-5-pruned_bf16.gguf
48
+ ```
49
+
50
+ ### 2. Build stable-diffusion.cpp
51
+
52
+ > **Requirements:** CUDA-capable GPU, CMake ≥ 3.18, CUDA Toolkit
53
+
54
+ ```bash
55
+ git clone https://github.com/leejet/stable-diffusion.cpp
56
+ cd stable-diffusion.cpp
57
+ git submodule init
58
+ git submodule update
59
+ mkdir build && cd build
60
+ cmake .. -DSD_CUDA=ON
61
+ cmake --build . --config Release
62
+ ```
63
+
64
+ This was tested on commit `d950627` (version `master-520-d950627`). Check your version with:
65
+
66
+ ```bash
67
+ ./build/bin/sd-cli --version
68
+ ```
69
+
70
+ ### 3. Start the server
71
+
72
+ ```bash
73
+ export CUDA_VISIBLE_DEVICES=0
74
+
75
+ ./stable-diffusion.cpp/build/bin/sd-server \
76
+ -m /path/to/v1-5-pruned_Q4_0.gguf \
77
+ --vae-on-cpu \
78
+ --listen-ip 0.0.0.0 \
79
+ --listen-port 8081
80
+ ```
81
+
82
+ The server exposes an OpenAI-compatible `/v1/images/generations` endpoint.
83
+
84
+ ### 4. Generate an image
85
+
86
+ ```bash
87
+ curl -s http://127.0.0.1:8081/v1/images/generations \
88
+ -H "Content-Type: application/json" \
89
+ -d '{
90
+ "model": "sd",
91
+ "prompt": "A lovely cat<sd_cpp_extra_args>{\"seed\": 357925}</sd_cpp_extra_args>",
92
+ "n": 1,
93
+ "size": "512x512",
94
+ "response_format": "b64_json"
95
+ }' | jq -r '.data[0].b64_json' | base64 --decode > output.png
96
+ ```
97
+
98
+ Extra parameters are passed via `<sd_cpp_extra_args>` as a JSON snippet embedded directly in the `prompt` field.
99
+
100
+ ---
101
+
102
+ ## How the weights were created
103
+
104
+ Converted from the original [stable-diffusion-v1-5/stable-diffusion-v1-5](https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-v1-5)
105
+
106
+ ```bash
107
+ # Q4_0
108
+ ./stable-diffusion.cpp/build/bin/sd-cli -M convert \
109
+ -m ~/llm/models/sd1.5/v1-5-pruned.safetensors \
110
+ -o v1-5-pruned_Q4_0.gguf -v --type q4_0
111
+
112
+ # Q4_K
113
+ ./stable-diffusion.cpp/build/bin/sd-cli -M convert \
114
+ -m ~/llm/models/sd1.5/v1-5-pruned.safetensors \
115
+ -o v1-5-pruned_Q4_K.gguf -v --type q4_K
116
+
117
+ # Q8_0
118
+ ./stable-diffusion.cpp/build/bin/sd-cli -M convert \
119
+ -m ~/llm/models/sd1.5/v1-5-pruned.safetensors \
120
+ -o v1-5-pruned_Q8_0.gguf -v --type q8_0
121
+
122
+ # BF16
123
+ ./stable-diffusion.cpp/build/bin/sd-cli -M convert \
124
+ -m ~/llm/models/sd1.5/v1-5-pruned.safetensors \
125
+ -o v1-5-pruned_bf16.gguf -v --type bf16
126
+ ```
127
+
128
+ ---
129
+
130
+ ## License
131
+
132
+ This model inherits the license of the original: **CreativeML Open RAIL-M**
out.png ADDED

Git LFS Details

  • SHA256: cb929af093342f1683e7eaa47e5b1d011f6239d2d504ef7a91412717e3ddbf04
  • Pointer size: 131 Bytes
  • Size of remote file: 476 kB