Commit Graph

752 Commits

Author SHA1 Message Date
Kevin Turner
0390e6740d
Merge branch 'main' into dev/diffusers 2022-12-07 11:18:44 -08:00
spezialspezial
42f5bd4e12 Account for flat models
Merged models from auto11 merge board are flat for some reason. Current behavior of invoke is not changed by this modification.
2022-12-07 12:11:37 -05:00
Kevin Turner
04a5bc938e diffusers: txt2img2img (hires_fix)
with so much slicing and dicing of pipeline methods to stitch them together
2022-12-06 22:28:09 -08:00
Kevin Turner
bf6376417a diffusers: reset num_vectors_per_token
sync with 44a0055571
2022-12-06 15:52:49 -08:00
Kevin Turner
a0eb30a9b9 Merge remote-tracking branch 'origin/main' into dev/diffusers 2022-12-06 15:50:40 -08:00
blessedcoolant
1d1988683b Fix Embedding Dir not working 2022-12-05 22:24:31 -05:00
Kevin Turner
5c7e6751e0 inpainting for the normal model. I think it works this time. 2022-12-05 12:37:20 -08:00
Damian Stewart
69d42762de refactor common CrossAttention stuff into a mixin so that the old ldm code can still work if necessary 2022-12-05 20:00:18 +01:00
Damian Stewart
c6f31e5f36 fix off-by-one bug in cross-attention-control (#1774)
prompt token sequences begin with a "beginning-of-sequence" marker <bos> and end with a repeated "end-of-sequence" marker <eos> - to make a default prompt length of <bos> + 75 prompt tokens + <eos>. the .swap() code was failing to take the column for <bos> at index 0 into account. the changes here do that, and also add extra handling for a single <eos> (which may be redundant but which is included for completeness).

based on my understanding and some assumptions about how this all works, the reason .swap() nevertheless seemed to do the right thing, to some extent, is because over multiple steps the conditioning process in Stable Diffusion operates as a feedback loop. a change to token n-1 has flow-on effects to how the [1x4x64x64] latent tensor is modified by all the tokens after it, - and as the next step is processed, all the tokens before it as well. intuitively, a token's conditioning effects "echo" throughout the whole length of the prompt. so even though the token at n-1 was being edited when what the user actually wanted was to edit the token at n, it nevertheless still had some non-negligible effect, in roughly the right direction, often enough that it seemed like it was working properly.
2022-12-05 19:44:05 +01:00
Kevin Turner
f3570d8344 inpainting for the normal model [WIP]
This seems to be performing well until the LAST STEP, at which point it dissolves to confetti.
2022-12-04 23:36:12 -08:00
Kevin Turner
b2664e807e fix debug_image to not crash with non-RGB images. 2022-12-04 20:12:47 -08:00
Kevin Turner
875312080d diffusers support for the inpainting model 2022-12-04 20:12:04 -08:00
spezialspezial
1c0247d58a Eventually update APP_VERSION to 2.2.3
Not sure what the procedure is for the version number. Is this supposed to match every git tag or just major versions? Same question for setup.py
2022-12-04 14:33:16 -05:00
Damian Stewart
ff42027a00 add cross-attention control support to diffusers (fails on MPS)
For unknown reasons MPS produces garbage output with .swap(). Use
--always_use_cpu arg to invoke.py for now to test this code on MPS.
2022-12-04 16:07:54 +01:00
Damian Stewart
f48706efee add always_use_cpu arg to bypass MPS 2022-12-04 15:15:39 +01:00
Damian Stewart
d335f51e5f
fix off-by-one bug in cross-attention-control (#1774)
prompt token sequences begin with a "beginning-of-sequence" marker <bos> and end with a repeated "end-of-sequence" marker <eos> - to make a default prompt length of <bos> + 75 prompt tokens + <eos>. the .swap() code was failing to take the column for <bos> at index 0 into account. the changes here do that, and also add extra handling for a single <eos> (which may be redundant but which is included for completeness).

based on my understanding and some assumptions about how this all works, the reason .swap() nevertheless seemed to do the right thing, to some extent, is because over multiple steps the conditioning process in Stable Diffusion operates as a feedback loop. a change to token n-1 has flow-on effects to how the [1x4x64x64] latent tensor is modified by all the tokens after it, - and as the next step is processed, all the tokens before it as well. intuitively, a token's conditioning effects "echo" throughout the whole length of the prompt. so even though the token at n-1 was being edited when what the user actually wanted was to edit the token at n, it nevertheless still had some non-negligible effect, in roughly the right direction, often enough that it seemed like it was working properly.
2022-12-04 11:41:03 +01:00
Kevin Turner
e0495a7440 Merge remote-tracking branch 'origin/main' into dev/diffusers
# Conflicts:
#	scripts/configure_invokeai.py
2022-12-03 20:00:39 -08:00
Eugene Brodsky
6d6076d3c7 (config) fix permissions on configure_invokeai.py, improve documentation in globals.py comment 2022-12-03 14:33:21 -05:00
Damian Stewart
9ea10ece95 monkey-patch diffusers.attention and use Invoke lowvram code 2022-12-03 10:10:37 +01:00
Kevin Turner
9d7fe45702 Merge remote-tracking branch 'origin/main' into dev/diffusers
# Conflicts:
#	scripts/configure_invokeai.py
2022-12-01 21:38:46 -08:00
Lincoln Stein
878a3907e9 defer loading of Hugging Face concepts until needed
Some users have been complaining that the CLI "freezes" for a while
before the invoke> prompt appears. I believe this is due to internet
delay while the concepts library names are downloaded by the autocompleter.
I have changed logic so that the concepts are downloaded the first time
the user types a < and tabs.
2022-12-01 17:56:18 -05:00
Lincoln Stein
bde456f9fa fix startup messages and a startup crash
- make the warnings about patchmatch less redundant
- only warn about being unable to load concepts from Hugging Face
  library once
- do not crash when unable to load concepts from Hugging Face
  due to network connectivity issues
2022-12-01 07:42:31 -05:00
Lincoln Stein
9ee83380e6 fix missig history file in output director 2022-12-01 07:39:26 -05:00
Kevin Turner
ea1cf83c20 preliminary support for outpainting (no masking yet) 2022-11-30 22:05:58 -08:00
Kevin Turner
494936a8d2 🚧 post-rebase repair 2022-11-30 15:39:40 -08:00
Damian Stewart
adaa1c7c3e work around an apparent MPS torch bug that causes conditioning to have no effect 2022-11-30 15:34:19 -08:00
Kevin Turner
e9a0f07033 fix deprecated scheduler construction 2022-11-30 15:34:19 -08:00
Kevin Turner
7c558d5056 fix "config attributes…not expected" diffusers warnings. 2022-11-30 15:34:19 -08:00
Kevin Turner
8157bff4bc internal: avoid importing diffusers DummyObject
see https://github.com/huggingface/diffusers/issues/1479
2022-11-30 15:34:19 -08:00
Kevin Turner
ca1f76b7ba create an embedding_manager for diffusers 2022-11-30 15:34:19 -08:00
Kevin Turner
09728dd1e0 lint: correct AttributeError.name reference for Python 3.9. 2022-11-30 15:33:02 -08:00
Kevin Turner
56153c2ebf lint: correct annotations for Python 3.9. 2022-11-30 15:33:02 -08:00
Kevin Turner
b7864aa1a7 refactor: remove backported img2img.get_timesteps
now that we can use it directly from diffusers 0.8.1
2022-11-30 15:33:02 -08:00
Kevin Turner
ceb53ccdfb dev: upgrade to diffusers 0.8 (from 0.7.1)
We get to remove some code by using methods that were factored out in the base class.
2022-11-30 15:33:02 -08:00
Kevin Turner
efbb807905 diffusers integration: support img2img 2022-11-30 15:33:02 -08:00
Kevin Turner
f3f6213b97 fix(model_cache): don't check model.config in diffusers format
clean-up from recent merge.
2022-11-30 15:33:02 -08:00
Kevin Turner
01ff1cff58 model_cache: let offload_model work with DiffusionPipeline, sorta. 2022-11-30 15:03:20 -08:00
Kevin Turner
95db6e80ee cross_attention_control: stub (no-op) implementations for diffusers 2022-11-30 15:01:27 -08:00
Kevin Turner
b6b1a8d97c diffusers: use InvokeAIDiffuserComponent for conditioning 2022-11-30 15:01:18 -08:00
Kevin Turner
97dd4a2589 diffusers: fix set-sampler error following model switch 2022-11-30 15:01:18 -08:00
Kevin Turner
e99faeb8d7 diffusers: restore prompt weighting feature 2022-11-30 15:01:15 -08:00
Kevin Turner
05a1d68ef4 web server: update image_progress callback for diffusers data 2022-11-30 15:01:06 -08:00
Kevin Turner
1e98f4bafc diffusers: let the scheduler do its scaling of the initial latents
Remove IPNDM scheduler; it is not behaving.
2022-11-30 15:01:06 -08:00
Kevin Turner
d55e22981a txt2img: support switching diffusers schedulers 2022-11-30 15:01:06 -08:00
Kevin Turner
ae9b482acf model_cache: fix model default image dimensions 2022-11-30 15:01:06 -08:00
Kevin Turner
4c3858e079 model_cache: add ability to load a diffusers model pipeline
and update associated things in Generate & Generator to not instantly fail when that happens
2022-11-30 15:00:59 -08:00
Kevin Turner
9b274bd57c refactor(model_cache): factor out load_ckpt 2022-11-30 14:58:10 -08:00
Kevin Turner
dcfdb83513 doc: type hints for Generator 2022-11-30 14:56:30 -08:00
Kevin Turner
58ea3bf4c8 spike: proof of concept using diffusers for txt2img 2022-11-30 14:56:26 -08:00
Kevin Turner
1d43512d64 initial commit of DiffusionPipeline class 2022-11-30 14:54:24 -08:00