Commit Graph

130 Commits

Author SHA1 Message Date
Lincoln Stein
b815aa2130
Merge branch 'development' into outpaint 2022-10-27 17:17:34 -04:00
Lincoln Stein
1200fbd3bd add threshold for switchover from Karras to LDM noise schedule 2022-10-27 17:07:50 -04:00
Damian at mba
245cf606a3 be more forgiving about prompts with ((words)) 2022-10-27 22:36:33 +02:00
Damian at mba
e20108878c fix attention weight inside .swap() 2022-10-27 21:17:23 +02:00
Damian at mba
f73d349dfe refactor hybrid and cross attention control codepaths for readability 2022-10-27 19:40:37 +02:00
Damian at mba
dc86fc92ce fix crash parsing empty prompt "" 2022-10-27 19:01:54 +02:00
Lincoln Stein
16e7cbdb38 tweaks to documentation and call signature for advanced prompting 2022-10-27 08:30:09 -04:00
Damian at mba
135c62f1a4 fix issue with hot-dog, improve () suppression 2022-10-27 07:37:48 -04:00
Lincoln Stein
799dc6d0df acceptable integration of new prompting system and inpainting
This was a difficult merge because both PR #1108 and #1243 made
changes to obscure parts of the diffusion code.

- prompt weighting, merging and cross-attention working
  - cross-attention does not work with runwayML inpainting
    model, but weighting and merging are tested and working
- CLI command parsing code rewritten in order to get embedded
  quotes right
- --hires now works with runwayML inpainting
- --embiggen does not work with runwayML and will give an error
- Added an --invert option to invert masks applied to inpainting
- Updated documentation
2022-10-27 01:51:35 -04:00
Lincoln Stein
2daf187bdb working with 1.4, 1.5, not with inpainting 1.5 2022-10-26 18:25:48 -04:00
Lincoln Stein
9b7159720f resolve conflicts between PR #1108 and #1243 2022-10-26 15:37:24 -04:00
Kyle Schouviller
d05373d35a Force RGB for img2img 2022-10-26 12:12:08 -07:00
Kyle Schouviller
bd8bb8c80b Adding outpainting implementation (as part of inpaint). 2022-10-26 12:12:08 -07:00
Kyle Schouviller
dac1ab0a05 Better inpainting color-correction 2022-10-26 12:12:08 -07:00
Lincoln Stein
2f1c1e7695 Merge branch 'fix-prompts' of https://github.com/damian0815/InvokeAI into merge-prompt-and-inpaint-model 2022-10-26 08:50:55 -04:00
Lincoln Stein
2b6d78e436 minor cleanups
- remove --fnformat from canonicalized dream prompt arguments
  (not needed for image reproducibility)
- add -tm to canonicalized dream prompt arguments
  (definitely needed for image reproducibility)
2022-10-26 08:32:54 -04:00
Lincoln Stein
b1da13a984 minor cleanups
- change default model back to 1.4
- remove --fnformat from canonicalized dream prompt arguments
  (not needed for image reproducibility)
- add -tm to canonicalized dream prompt arguments
  (definitely needed for image reproducibility)
2022-10-26 08:29:56 -04:00
Lincoln Stein
906dafe3cd make variations work with inpainting model 2022-10-26 00:18:31 -04:00
Lincoln Stein
d3047c7cb0 do not encode init image in starting latent 2022-10-25 22:44:42 -04:00
Lincoln Stein
ca2f579f43 prevent crash when providing empty quoted prompt ("") 2022-10-25 15:56:07 -04:00
Lincoln Stein
c732fd0740 Merge branch 'inpaint-model' of github.com:invoke-ai/InvokeAI into inpaint-model 2022-10-25 13:21:00 -04:00
Lincoln Stein
4352eb6628 stop crashes on non-square images 2022-10-25 13:17:06 -04:00
Lincoln Stein
1ae269b8e0
Merge branch 'development' into inpaint-model 2022-10-25 11:50:08 -04:00
Lincoln Stein
e33971fe2c plms works, bugs quashed
- The plms sampler now works with custom inpainting model
- Quashed bug that was causing generation on normal models to fail (oops!)
- Can now generate non-square images with custom inpainting model

Credits for advice and assistance during porting:

@any-winter-4079 (http://github.com/any-winter-4079)
@db3000 (Danny Beer http://github.com/db3000)
2022-10-25 11:44:01 -04:00
Lincoln Stein
b101be041b add support for runwayML custom inpainting model
This is still a work in progress but seems functional. It supports
inpainting, txt2img and img2img on the ddim and k* samplers (plms
still needs work, but I know what to do).

To test this, get the file `sd-v1-5-inpainting.ckpt' from
https://huggingface.co/runwayml/stable-diffusion-inpainting and place it
at `models/ldm/stable-diffusion-v1/sd-v1-5-inpainting.ckpt`

Launch invoke.py with --model inpainting-1.5 and proceed as usual.

Caveats:

1. The inpainting model takes about 800 Mb more memory than the standard
   1.5 model. This model will not work on 4 GB cards.

2. The inpainting model is temperamental. It wants you to describe the
   entire scene and not just the masked area to replace. So if you want
   to replace the parrot on a man's shoulder with a crow, the prompt
   "crow" may fail. Try "man with a crow on shoulder" instead. The
   symptom of a failed inpainting is that the area will be erased and
   replaced with background.

3. This has not been tested well. Please report bugs.
2022-10-25 10:45:15 -04:00
Lincoln Stein
aaf7a4f1d3 inpaint and txt2img working with ddim sampler 2022-10-25 10:00:28 -04:00
Lincoln Stein
99d23c4d81 fix merge conflicts 2022-10-25 07:30:26 -04:00
Lincoln Stein
5e8d1ca19f resolve conflicts 2022-10-25 07:17:54 -04:00
Lincoln Stein
a2e53892ec fixed synax errors; now channel mismatch issue 2022-10-25 00:47:13 -04:00
Lincoln Stein
be8a992b85 add missing file 2022-10-25 00:38:24 -04:00
Lincoln Stein
9bef643bf5 fix a few more metadata bugs
- facetool and upscale arguments now written into metadata
- cleaned up handling of !fetch command
2022-10-25 00:31:43 -04:00
Lincoln Stein
f6b31d51e0 fix incorrect handling of single quotes in prompts 2022-10-25 00:31:43 -04:00
Lincoln Stein
543464182f inpainting fix per PR #1218
- This is a merge of the final version of PR #1218 "Inpainting
  Improvements"

  Various merge conflicts made it easier to commit directly.

Author: Kyle0654
Co-Author: lstein
2022-10-25 00:31:42 -04:00
Lincoln Stein
83a3cc9eb4 start support for 1.5 inpainting model, not complete 2022-10-25 00:30:48 -04:00
Damian at mba
61a4897b71 re-enable tokenization logging 2022-10-24 11:49:47 +02:00
Damian at mba
194c8e1c2e Merge branch 'development' into fix-prompts 2022-10-24 11:28:37 +02:00
Damian at mba
44e4090909 re-enable legacy blend syntax 2022-10-24 11:16:52 +02:00
Lincoln Stein
37d38f196e fix a few more metadata bugs
- facetool and upscale arguments now written into metadata
- cleaned up handling of !fetch command
2022-10-23 23:01:32 -04:00
Lincoln Stein
17aee48734 fix incorrect handling of single quotes in prompts 2022-10-23 23:01:32 -04:00
Lincoln Stein
5561a95232 inpainting fix per PR #1218
- This is a merge of the final version of PR #1218 "Inpainting
  Improvements"

  Various merge conflicts made it easier to commit directly.

Author: Kyle0654
Co-Author: lstein
2022-10-23 22:52:32 -04:00
Lincoln Stein
27f0f3e52b Merge branch 'inpaint-improvement' of https://github.com/Kyle0654/InvokeAI into add-safety-checker 2022-10-23 22:37:43 -04:00
Lincoln Stein
b159b2fe42 add support for safety checker (NSFW filter)
Now you can activate the Hugging Face `diffusers` library safety check
for NSFW and other potentially disturbing imagery.

To turn on the safety check, pass --safety_checker at the command
line. For developers, the flag is `safety_checker=True` passed to
ldm.generate.Generate(). Once the safety checker is turned on, it
cannot be turned off unless you reinitialize a new Generate object.

When the safety checker is active, suspect images will be blurred and
a warning icon is added. There is also a warning message printed in
the CLI, but it can be a little hard to see because of its positioning
in the output stream.

There is a slight but noticeable delay when the safety checker runs.

Note that invisible watermarking is *not* currently implemented. The
watermark code distributed by the CompViz distribution uses a library
that does not seem to be able to retrieve the watermarks it creates,
and it does not appear that Hugging Face `diffusers` or other SD
distributions are doing any watermarking.
2022-10-23 22:26:18 -04:00
Damian at mba
63902f3d34 also apply conditioing during hires fix upscale 2022-10-24 02:08:55 +02:00
Damian at mba
1fb15d5c81 fix hires fix 2022-10-24 02:02:42 +02:00
Damian at mba
cc2042bd4c keep the effect of _start and _end arguments consistent across k* and other samplers 2022-10-24 01:43:35 +02:00
Damian at mba
2619a0b286 allow longer substitutions without quotes for cross attention swap 2022-10-24 00:22:14 +02:00
Kyle Schouviller
0c34554170 Merge branch 'inpaint-improvement' of https://github.com/Kyle0654/InvokeAI into inpaint-improvement 2022-10-23 14:02:52 -07:00
Damian at mba
b0eb864a25 move attention weighting operations to postfix 2022-10-23 23:01:53 +02:00
Kyle Schouviller
1264cc2d36 Switch from dilate to erode to fix inpaint edges. Default model to 1.4 instead of 1.5. 2022-10-23 14:01:06 -07:00
Damian at mba
f7cd98c238 tweak default cross-attention values 2022-10-23 20:38:28 +02:00