Skip to content

Commit fb4dc7e

Browse files
authored
Merge branch 'development' into fix-disabled-prompt
2 parents a956bf9 + 71a1e0d commit fb4dc7e

File tree

21 files changed

+1243
-199
lines changed

21 files changed

+1243
-199
lines changed

assets/caution.png

33.2 KB
Loading

configs/models.yaml

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
# This file describes the alternative machine learning models
2-
# available to the dream script.
2+
# available to the dream script.
33
#
44
# To add a new model, follow the examples below. Each
55
# model requires a model config file, a weights file,
66
# and the width and height of the images it
77
# was trained on.
8-
98
stable-diffusion-1.4:
10-
config: configs/stable-diffusion/v1-inference.yaml
11-
weights: models/ldm/stable-diffusion-v1/model.ckpt
12-
vae: models/ldm/stable-diffusion-v1/vae-ft-mse-840000-ema-pruned.ckpt
13-
description: Stable Diffusion inference model version 1.4
14-
width: 512
15-
height: 512
9+
config: configs/stable-diffusion/v1-inference.yaml
10+
weights: models/ldm/stable-diffusion-v1/model.ckpt
11+
# vae: models/ldm/stable-diffusion-v1/vae-ft-mse-840000-ema-pruned.ckpt
12+
description: Stable Diffusion inference model version 1.4
13+
default: true
14+
width: 512
15+
height: 512
16+
default: true
1617
stable-diffusion-1.5:
17-
config: configs/stable-diffusion/v1-inference.yaml
18-
weights: models/ldm/stable-diffusion-v1/v1-5-pruned-emaonly.ckpt
19-
description: Stable Diffusion inference model version 1.5
20-
width: 512
21-
height: 512
18+
config: configs/stable-diffusion/v1-inference.yaml
19+
weights: models/ldm/stable-diffusion-v1/v1-5-pruned-emaonly.ckpt
20+
# vae: models/ldm/stable-diffusion-v1/vae-ft-mse-840000-ema-pruned.ckpt
21+
description: Stable Diffusion inference model version 1.5
22+
width: 512
23+
height: 512

docs/features/CLI.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ overridden on a per-prompt basis (see [List of prompt arguments](#list-of-prompt
8686
| `--model <modelname>` | | `stable-diffusion-1.4` | Loads model specified in configs/models.yaml. Currently one of "stable-diffusion-1.4" or "laion400m" |
8787
| `--full_precision` | `-F` | `False` | Run in slower full-precision mode. Needed for Macintosh M1/M2 hardware and some older video cards. |
8888
| `--png_compression <0-9>` | `-z<0-9>` | 6 | Select level of compression for output files, from 0 (no compression) to 9 (max compression) |
89+
| `--safety-checker` | | False | Activate safety checker for NSFW and other potentially disturbing imagery |
8990
| `--web` | | `False` | Start in web server mode |
9091
| `--host <ip addr>` | | `localhost` | Which network interface web server should listen on. Set to 0.0.0.0 to listen on any. |
9192
| `--port <port>` | | `9090` | Which port web server should listen for requests on. |
@@ -97,7 +98,6 @@ overridden on a per-prompt basis (see [List of prompt arguments](#list-of-prompt
9798
| `--embedding_path <path>` | | `None` | Path to pre-trained embedding manager checkpoints, for custom models |
9899
| `--gfpgan_dir` | | `src/gfpgan` | Path to where GFPGAN is installed. |
99100
| `--gfpgan_model_path` | | `experiments/pretrained_models/GFPGANv1.4.pth` | Path to GFPGAN model file, relative to `--gfpgan_dir`. |
100-
| `--device <device>` | `-d<device>` | `torch.cuda.current_device()` | Device to run SD on, e.g. "cuda:0" |
101101
| `--free_gpu_mem` | | `False` | Free GPU memory after sampling, to allow image decoding and saving in low VRAM conditions |
102102
| `--precision` | | `auto` | Set model precision, default is selected by device. Options: auto, float32, float16, autocast |
103103

docs/features/INPAINTING.md

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,18 @@ text2mask feature. The syntax is `!mask /path/to/image.png -tm <text>
8181
It will generate three files:
8282

8383
- The image with the selected area highlighted.
84+
- it will be named XXXXX.<imagename>.<prompt>.selected.png
8485
- The image with the un-selected area highlighted.
86+
- it will be named XXXXX.<imagename>.<prompt>.deselected.png
8587
- The image with the selected area converted into a black and white
86-
image according to the threshold level.
88+
image according to the threshold level
89+
- it will be named XXXXX.<imagename>.<prompt>.masked.png
8790

88-
Note that none of these images are intended to be used as the mask
89-
passed to invoke via `-M` and may give unexpected results if you try
90-
to use them this way. Instead, use `!mask` for testing that you are
91-
selecting the right mask area, and then do inpainting using the
92-
best selection term and threshold.
91+
The `.masked.png` file can then be directly passed to the `invoke>`
92+
prompt in the CLI via the `-M` argument. Do not attempt this with
93+
the `selected.png` or `deselected.png` files, as they contain some
94+
transparency throughout the image and will not produce the desired
95+
results.
9396

9497
Here is an example of how `!mask` works:
9598

@@ -120,7 +123,7 @@ It looks like we selected the hair pretty well at the 0.5 threshold
120123
let's have some fun:
121124

122125
```
123-
invoke> medusa with cobras -I ./test-pictures/curly.png -tm hair 0.5 -C20
126+
invoke> medusa with cobras -I ./test-pictures/curly.png -M 000019.curly.hair.masked.png -C20
124127
>> loaded input image of size 512x512 from ./test-pictures/curly.png
125128
...
126129
Outputs:
@@ -129,6 +132,13 @@ Outputs:
129132

130133
<img src="../assets/inpainting/000024.801380492.png">
131134

135+
You can also skip the `!mask` creation step and just select the masked
136+
137+
region directly:
138+
```
139+
invoke> medusa with cobras -I ./test-pictures/curly.png -tm hair -C20
140+
```
141+
132142
### Inpainting is not changing the masked region enough!
133143

134144
One of the things to understand about how inpainting works is that it

environment-mac.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ dependencies:
1919
# ```
2020
- albumentations==1.2.1
2121
- coloredlogs==15.0.1
22+
- diffusers==0.6.0
2223
- einops==0.4.1
2324
- grpcio==1.46.4
2425
- humanfriendly==10.0

environment.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ dependencies:
2626
- pyreadline3
2727
- torch-fidelity==0.3.0
2828
- transformers==4.21.3
29+
- diffusers==0.6.0
2930
- torchmetrics==0.7.0
3031
- flask==2.1.3
3132
- flask_socketio==5.3.0

0 commit comments

Comments
 (0)