kostakoff commited on
Commit ·
96c8a5d
1
Parent(s): 754adc8
created readme
Browse files
README.md
CHANGED
|
@@ -13,3 +13,109 @@ inference: true
|
|
| 13 |
---
|
| 14 |
|
| 15 |
# Stable Diffusion v2 GGUF Model Card
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
---
|
| 14 |
|
| 15 |
# Stable Diffusion v2 GGUF Model Card
|
| 16 |
+
|
| 17 |
+
Quantized versions of [stable-diffusion-2](https://huggingface.co/sd2-community/stable-diffusion-2) in **GGUF** format for use with [stable-diffusion.cpp](https://github.com/leejet/stable-diffusion.cpp).
|
| 18 |
+
|
| 19 |
+
At the time of publishing, no ready-made GGUF weights for SD2.0 were available for sd.cpp runtime — so here we are.
|
| 20 |
+
|
| 21 |
+

|
| 22 |
+
*Sample generation: "A lovely cat" · Q8_0 · 768x768*
|
| 23 |
+
|
| 24 |
+
---
|
| 25 |
+
|
| 26 |
+
## Available Quantizations
|
| 27 |
+
|
| 28 |
+
| File | Quantization | Description |
|
| 29 |
+
|------|-------------|-------------|
|
| 30 |
+
| `v1-5-pruned_Q8_0.gguf` | Q8_0 | High quality, ~half the size of bf16 |
|
| 31 |
+
| `v1-5-pruned_Q4_K.gguf` | Q4_K | Balanced quality/size |
|
| 32 |
+
| `v1-5-pruned_Q4_0.gguf` | Q4_0 | Smallest, fastest, slight quality loss |
|
| 33 |
+
|
| 34 |
+
---
|
| 35 |
+
|
| 36 |
+
## Quick Start
|
| 37 |
+
|
| 38 |
+
### 1. Download the model
|
| 39 |
+
|
| 40 |
+
```bash
|
| 41 |
+
wget https://huggingface.co/kostakoff/stable-diffusion-2-GGUF/resolve/main/768-v-ema-Q8_0.gguf
|
| 42 |
+
# Other quantizations:
|
| 43 |
+
# wget https://huggingface.co/kostakoff/stable-diffusion-2-GGUF/resolve/main/768-v-ema-Q4_K.gguf
|
| 44 |
+
# wget https://huggingface.co/kostakoff/stable-diffusion-2-GGUF/resolve/main/768-v-ema-Q4_0.gguf
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
+
### 2. Build stable-diffusion.cpp
|
| 48 |
+
|
| 49 |
+
> **Requirements:** CUDA-capable GPU, CMake ≥ 3.18, CUDA Toolkit
|
| 50 |
+
|
| 51 |
+
```bash
|
| 52 |
+
git clone https://github.com/leejet/stable-diffusion.cpp
|
| 53 |
+
cd stable-diffusion.cpp
|
| 54 |
+
git submodule init
|
| 55 |
+
git submodule update
|
| 56 |
+
mkdir build && cd build
|
| 57 |
+
cmake .. -DSD_CUDA=ON
|
| 58 |
+
cmake --build . --config Release
|
| 59 |
+
```
|
| 60 |
+
|
| 61 |
+
This was tested on commit `d950627` (version `master-520-d950627`). Check your version with:
|
| 62 |
+
|
| 63 |
+
```bash
|
| 64 |
+
./build/bin/sd-cli --version
|
| 65 |
+
```
|
| 66 |
+
|
| 67 |
+
### 3. Start the server
|
| 68 |
+
|
| 69 |
+
```bash
|
| 70 |
+
export CUDA_VISIBLE_DEVICES=0
|
| 71 |
+
./stable-diffusion.cpp/build/bin/sd-server \
|
| 72 |
+
-m ./768-v-ema-Q8_0.gguf \
|
| 73 |
+
--listen-ip 0.0.0.0 \
|
| 74 |
+
--listen-port 8081 \
|
| 75 |
+
--seed -1
|
| 76 |
+
```
|
| 77 |
+
|
| 78 |
+
The server exposes an OpenAI-compatible `/v1/images/generations` endpoint.
|
| 79 |
+
|
| 80 |
+
### 4. Generate an image
|
| 81 |
+
|
| 82 |
+
```bash
|
| 83 |
+
curl -s http://127.0.0.1:8081/v1/images/generations \
|
| 84 |
+
-H "Content-Type: application/json" \
|
| 85 |
+
-d '{
|
| 86 |
+
"model": "sd2.0",
|
| 87 |
+
"prompt": "A lovely cat",
|
| 88 |
+
"n": 1,
|
| 89 |
+
"size": "768x768",
|
| 90 |
+
"response_format": "b64_json"
|
| 91 |
+
}' | jq -r '.data[0].b64_json' | base64 --decode > output.png
|
| 92 |
+
```
|
| 93 |
+
|
| 94 |
+
Extra parameters are passed via `<sd_cpp_extra_args>` as a JSON snippet embedded directly in the `prompt` field.
|
| 95 |
+
|
| 96 |
+
---
|
| 97 |
+
|
| 98 |
+
## How the weights were created
|
| 99 |
+
|
| 100 |
+
Converted from the original [768-v-ema.safetensors](https://huggingface.co/sd2-community/stable-diffusion-2/blob/main/768-v-ema.safetensors) weights using the built-in `sd-cli` conversion tool:
|
| 101 |
+
|
| 102 |
+
```bash
|
| 103 |
+
# Q4_0
|
| 104 |
+
./stable-diffusion.cpp/build/bin/sd-cli -M convert \
|
| 105 |
+
-m ~/llm/models/sd2.0/768-v-ema.safetensors \
|
| 106 |
+
-o 768-v-ema-Q4_0.gguf -v --type q4_0
|
| 107 |
+
# Q4_K
|
| 108 |
+
./stable-diffusion.cpp/build/bin/sd-cli -M convert \
|
| 109 |
+
-m ~/llm/models/sd2.0/768-v-ema.safetensors \
|
| 110 |
+
-o ./768-v-ema-Q4_K.gguf -v --type q4_K
|
| 111 |
+
# Q8_0
|
| 112 |
+
./stable-diffusion.cpp/build/bin/sd-cli -M convert \
|
| 113 |
+
-m ~/llm/models/sd2.0/768-v-ema.safetensors \
|
| 114 |
+
-o ./768-v-ema-Q8_0.gguf -v --type q8_0
|
| 115 |
+
```
|
| 116 |
+
|
| 117 |
+
---
|
| 118 |
+
|
| 119 |
+
## License
|
| 120 |
+
|
| 121 |
+
This model inherits the license of the original: **CreativeML Open RAIL++-M**
|
out.png
ADDED
|
Git LFS Details
|