Commit Graph

656 Commits

Author SHA1 Message Date
Lincoln Stein
0f4413da7d Merge branch 'inpainting-rebase' of https://github.com/psychedelicious/stable-diffusion into psychedelicious-inpainting-rebase 2022-10-29 13:42:00 -04:00
Lincoln Stein
fdf9b1c40c fix CLI inpainting crash 2022-10-29 11:47:06 -04:00
Kyle Schouviller
43de16cae4 Don't try to tile fill if image doesn't have an alpha layer 2022-10-29 04:25:27 +11:00
Damian at mba
864d080502 handle all unicode characters 2022-10-28 10:39:12 -04:00
Lincoln Stein
05b8de5300 fix --hires to support inpainting model 2022-10-27 23:12:21 -04:00
Lincoln Stein
387f796ebe
Merge branch 'development' into development 2022-10-27 23:04:04 -04:00
Lincoln Stein
3033331f65 remove unneeded warnings from attention.py 2022-10-27 22:50:06 -04:00
Lincoln Stein
362b234cd1 fix long-standing issue with metadata retrieval
The Args object would crap out when trying to retrieve metadata from
an image file that did not contain InvokeAI-generated metadata, such
as a JPG. This corrects that and returns dummy values (seed of zero,
prompt of '') to avoid downstream breakage.
2022-10-27 22:43:34 -04:00
Lincoln Stein
2115874587 resolve conflicts with outpainting implementation 2022-10-27 18:06:38 -04:00
Lincoln Stein
cd5141f3d1 fix issues with outpaint merge 2022-10-27 18:02:08 -04:00
Lincoln Stein
b815aa2130
Merge branch 'development' into outpaint 2022-10-27 17:17:34 -04:00
Lincoln Stein
19a6e904ec resolved whitespace difference 2022-10-27 17:12:22 -04:00
Lincoln Stein
1200fbd3bd add threshold for switchover from Karras to LDM noise schedule 2022-10-27 17:07:50 -04:00
Lincoln Stein
d25bf7a55a cut over from karras to model noise schedule for higher steps
The k_samplers come with a "karras" noise schedule which performs
very well at low step counts but becomes noisy at higher ones.

This commit introduces a threshold (currently 30 steps) at which the
k samplers will switch over from using karras to the older model
noise schedule.
2022-10-27 17:06:49 -04:00
Damian at mba
245cf606a3 be more forgiving about prompts with ((words)) 2022-10-27 22:36:33 +02:00
Lincoln Stein
943616044a Merge branch 'switch-ksampler-noise-scheduler-adaptively' into development
- This sets a step switchover point at which the k-samplers stop using the
  Karras noise schedule and start using the LatentDiffusion noise schedule.
  The advantage of this is that the Karras schedule produces excellent
  results at low step counts but starts to become unstable at high
  steps.

- A new command argument --karras_max, lets the user set where the
  switchover occurs. Default is 29 steps (1-29 steps Karras),
  (30 or greater LDM)

- Tildebyte, sorry to do a fast forward three-way merge for this
  but rebasing was just too painful due to extensive recent
  changes to the diffuser code.
2022-10-27 16:11:26 -04:00
Lincoln Stein
943808b925 add threshold for switchover from Karras to LDM noise schedule 2022-10-27 15:50:32 -04: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
aa785c3ef1 ready for merge after documentation added 2022-10-27 11:55:00 -04:00
Lincoln Stein
0eb07b7488 Merge branch 'outpaint' of https://github.com/Kyle0654/InvokeAI into Kyle0654-outpaint 2022-10-27 09:16:40 -04: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
Damian at mba
79689e87ce fix crash making embeddings from too-long prompts with attention weights 2022-10-26 22:42:17 -04:00
Lincoln Stein
0d0481ce75 inpaint model progress
- working with plain prompts, weighted prompts and merge prompts
- not tested with prompt2prompt
2022-10-26 22:40:01 -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
tyler
62412f8398 fixing aspect ratio on hires 2022-10-25 21:28:50 -05:00
Lincoln Stein
ca2f579f43 prevent crash when providing empty quoted prompt ("") 2022-10-25 15:56:07 -04:00
Lincoln Stein
3c1ef48fe2 fix crash when doing img2img with ddim sampler and SD 1.5 2022-10-25 13:57:42 -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