You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+8-132
Original file line number
Diff line number
Diff line change
@@ -202,26 +202,6 @@ arguments:
202
202
-v, --verbose print extra info
203
203
```
204
204
205
-
#### Quantization
206
-
207
-
You can specify the model weight type using the `--type` parameter. The weights are automatically converted when loading the model.
208
-
209
-
- `f16` for 16-bit floating-point
210
-
- `f32` for 32-bit floating-point
211
-
- `q8_0` for 8-bit integer quantization
212
-
- `q5_0` or `q5_1` for 5-bit integer quantization
213
-
- `q4_0` or `q4_1` for 4-bit integer quantization
214
-
215
-
#### Convert to GGUF
216
-
217
-
You can also convert weights in the formats `ckpt/safetensors/diffusers` to gguf and perform quantization in advance, avoiding the need for quantization every time you load them.
- You can specify the directory where the lora weights are stored via `--lora-model-dir`. If not specified, the default is the current working directory.
256
-
257
-
- LoRA is specified via prompt, just like [stable-diffusion-webui](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Features#lora).
258
-
259
-
Here's a simple example:
260
-
261
-
```
262
-
./bin/sd -m ../models/v1-5-pruned-emaonly.safetensors -p "a lovely cat<lora:marblesh:1>" --lora-model-dir ../models
263
-
```
264
-
265
-
`../models/marblesh.safetensors` or `../models/marblesh.ckpt` will be applied to the model
266
-
267
-
#### LCM/LCM-LoRA
268
-
269
-
- Download LCM-LoRA form https://huggingface.co/latent-consistency/lcm-lora-sdv1-5
270
-
- Specify LCM-LoRA by adding `<lora:lcm-lora-sdv1-5:1>` to prompt
271
-
- It's advisable to set `--cfg-scale` to `1.0` instead of the default `7.0`. For `--steps`, a range of `2-8` steps is recommended. For `--sampling-method`, `lcm`/`euler_a` is recommended.
- Specify the model path using the `--taesd PATH` parameter. example:
296
-
297
-
```bash
298
-
sd -m ../models/v1-5-pruned-emaonly.safetensors -p "a lovely cat" --taesd ../models/diffusion_pytorch_model.safetensors
299
-
```
300
-
301
-
#### Using ESRGAN to upscale results
302
-
303
-
You can use ESRGAN to upscale the generated images. At the moment, only the [RealESRGAN_x4plus_anime_6B.pth](https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.2.4/RealESRGAN_x4plus_anime_6B.pth) model is supported. Support for more models of this architecture will be added soon.
304
-
305
-
- Specify the model path using the `--upscale-model PATH` parameter. example:
306
-
307
-
```bash
308
-
sd -m ../models/v1-5-pruned-emaonly.safetensors -p "a lovely cat" --upscale-model ../models/RealESRGAN_x4plus_anime_6B.pth
309
-
```
310
-
311
-
#### Using PhotoMaker to personalize image generation
312
-
313
-
You can use [PhotoMaker](https://github.com/TencentARC/PhotoMaker) to personalize generated images with your own ID.
314
-
315
-
**NOTE**, currently PhotoMaker **ONLY** works with **SDXL** (any SDXL model files will work).
316
-
317
-
Download PhotoMaker model file (in safetensor format) [here](https://huggingface.co/bssrdf/PhotoMaker). The official release of the model file (in .bin format) does not work with ```stablediffusion.cpp```.
318
-
319
-
- Specify the PhotoMaker model path using the `--stacked-id-embd-dir PATH` parameter.
320
-
- Specify the input images path using the `--input-id-images-dir PATH` parameter.
321
-
- input images **must** have the same width and height for preprocessing (to be improved)
322
-
323
-
In prompt, make sure you have a class word followed by the trigger word ```"img"``` (hard-coded for now). The class word could be one of ```"man, woman, girl, boy"```. If input ID images contain asian faces, add ```Asian``` before the class
324
-
word.
325
-
326
-
Another PhotoMaker specific parameter:
327
-
328
-
-```--style-ratio (0-100)%```: default is 20 and 10-20 typically gets good results. Lower ratio means more faithfully following input ID (not necessarily better quality).
329
-
330
-
Other parameters recommended for running Photomaker:
331
-
332
-
-```--cfg-scale 5.0```
333
-
-```-H 1024```
334
-
-```-W 1024```
335
-
336
-
If on low memory GPUs (<= 8GB), recommend running with ```--vae-on-cpu``` option to get artifact free images.
337
-
338
-
Example:
339
-
340
-
```bash
341
-
bin/sd -m ../models/sdxlUnstableDiffusers_v11.safetensors --vae ../models/sdxl_vae.safetensors --stacked-id-embd-dir ../models/photomaker-v1.safetensors --input-id-images-dir ../assets/examples/scarletthead_woman -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" -n "realistic, photo-realistic, worst quality, greyscale, bad anatomy, bad hands, error, text" --cfg-scale 5.0 --sampling-method euler -H 1024 -W 1024 --style-ratio 10 --vae-on-cpu -o output.png
342
-
```
343
-
344
-
### Docker
345
-
346
-
#### Building using Docker
347
-
348
-
```shell
349
-
docker build -t sd .
350
-
```
351
-
352
-
#### Run
353
-
354
-
```shell
355
-
docker run -v /path/to/models:/models -v /path/to/output/:/output sd [args...]
356
-
# For example
357
-
# docker run -v ./models:/models -v ./build:/output sd -m /models/sd-v1-4.ckpt -p "a lovely cat" -v -o /output/output.png
You can use ESRGAN to upscale the generated images. At the moment, only the [RealESRGAN_x4plus_anime_6B.pth](https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.2.4/RealESRGAN_x4plus_anime_6B.pth) model is supported. Support for more models of this architecture will be added soon.
4
+
5
+
- Specify the model path using the `--upscale-model PATH` parameter. example:
6
+
7
+
```bash
8
+
sd -m ../models/v1-5-pruned-emaonly.safetensors -p "a lovely cat" --upscale-model ../models/RealESRGAN_x4plus_anime_6B.pth
- Download LCM-LoRA form https://huggingface.co/latent-consistency/lcm-lora-sdv1-5
4
+
- Specify LCM-LoRA by adding `<lora:lcm-lora-sdv1-5:1>` to prompt
5
+
- It's advisable to set `--cfg-scale` to `1.0` instead of the default `7.0`. For `--steps`, a range of `2-8` steps is recommended. For `--sampling-method`, `lcm`/`euler_a` is recommended.
- You can specify the directory where the lora weights are stored via `--lora-model-dir`. If not specified, the default is the current working directory.
4
+
5
+
- LoRA is specified via prompt, just like [stable-diffusion-webui](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Features#lora).
6
+
7
+
Here's a simple example:
8
+
9
+
```
10
+
./bin/sd -m ../models/v1-5-pruned-emaonly.safetensors -p "a lovely cat<lora:marblesh:1>" --lora-model-dir ../models
11
+
```
12
+
13
+
`../models/marblesh.safetensors` or `../models/marblesh.ckpt` will be applied to the model
## Using PhotoMaker to personalize image generation
2
+
3
+
You can use [PhotoMaker](https://github.com/TencentARC/PhotoMaker) to personalize generated images with your own ID.
4
+
5
+
**NOTE**, currently PhotoMaker **ONLY** works with **SDXL** (any SDXL model files will work).
6
+
7
+
Download PhotoMaker model file (in safetensor format) [here](https://huggingface.co/bssrdf/PhotoMaker). The official release of the model file (in .bin format) does not work with ```stablediffusion.cpp```.
8
+
9
+
- Specify the PhotoMaker model path using the `--stacked-id-embd-dir PATH` parameter.
10
+
- Specify the input images path using the `--input-id-images-dir PATH` parameter.
11
+
- input images **must** have the same width and height for preprocessing (to be improved)
12
+
13
+
In prompt, make sure you have a class word followed by the trigger word ```"img"``` (hard-coded for now). The class word could be one of ```"man, woman, girl, boy"```. If input ID images contain asian faces, add ```Asian``` before the class
14
+
word.
15
+
16
+
Another PhotoMaker specific parameter:
17
+
18
+
-```--style-ratio (0-100)%```: default is 20 and 10-20 typically gets good results. Lower ratio means more faithfully following input ID (not necessarily better quality).
19
+
20
+
Other parameters recommended for running Photomaker:
21
+
22
+
-```--cfg-scale 5.0```
23
+
-```-H 1024```
24
+
-```-W 1024```
25
+
26
+
If on low memory GPUs (<= 8GB), recommend running with ```--vae-on-cpu``` option to get artifact free images.
27
+
28
+
Example:
29
+
30
+
```bash
31
+
bin/sd -m ../models/sdxlUnstableDiffusers_v11.safetensors --vae ../models/sdxl_vae.safetensors --stacked-id-embd-dir ../models/photomaker-v1.safetensors --input-id-images-dir ../assets/examples/scarletthead_woman -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" -n "realistic, photo-realistic, worst quality, greyscale, bad anatomy, bad hands, error, text" --cfg-scale 5.0 --sampling-method euler -H 1024 -W 1024 --style-ratio 10 --vae-on-cpu -o output.png
You can also convert weights in the formats `ckpt/safetensors/diffusers` to gguf and perform quantization in advance, avoiding the need for quantization every time you load them.
0 commit comments