Commit Graph

2194 Commits

Author SHA1 Message Date
Kevin Turner
061c5369a2 Merge remote-tracking branch 'origin/main' into dev/diffusers 2022-12-10 19:18:00 -08:00
Damian Stewart
8cbb50c204 avoid further crash under low-memory conditions 2022-12-10 15:32:11 -05:00
blessedcoolant
12a8d7fc14 Fix crash introduced in #1866 2022-12-10 15:32:11 -05:00
Matthias Wild
3d2b497eb0
Run more tests for PRs (#1895)
* run 3 tests for PR with different samplers
reduce tests for PR to do only 5 Iterations

* use correct txt file - delete unused old file
2022-12-10 20:07:14 +01:00
Kevin Turner
63532226a5 Merge remote-tracking branch 'origin/main' into dev/diffusers
# Conflicts:
#	backend/invoke_ai_web_server.py
#	ldm/generate.py
#	ldm/invoke/CLI.py
#	ldm/invoke/generator/base.py
#	ldm/invoke/generator/txt2img.py
#	ldm/models/diffusion/cross_attention_control.py
#	ldm/modules/attention.py
2022-12-10 08:43:37 -08:00
Kevin Turner
66d32b79b7 diffusers: work more better with more models.
fixed relative path problem with local models.

fixed models on hub not always having a `fp16` branch.
2022-12-10 08:29:12 -08:00
Kevin Turner
50c48cffc7 diffusers: make masked img2img behave better with multi-step schedulers
re-randomizing the noise each step was confusing them.
2022-12-10 08:27:46 -08:00
Kevin Turner
1a67836012 diffusers: use xformers when available
diffusers no longer auto-enables this as of 0.10.2.
2022-12-10 08:26:24 -08:00
Damian Stewart
786b8878d6
Save and display per-token attention maps (#1866)
* attention maps saving to /tmp

* tidy up diffusers branch backporting of cross attention refactoring

* base64-encoding the attention maps image for generationResult

* cleanup/refactor conditioning.py

* attention maps and tokens being sent to web UI

* attention maps: restrict count to actual token count and improve robustness

* add argument type hint to image_to_dataURL function

Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com>

Co-authored-by: damian <git@damianstewart.com>
Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com>
2022-12-10 15:57:41 +01:00
Kevin Turner
811dc23efb diffusers: update to 0.10 (and transformers to 4.25) 2022-12-09 10:45:16 -08:00
Kevin Turner
8e2da9a97e CI: default to diffusers-1.5 now that runwayml token requirement is gone 2022-12-09 10:37:55 -08:00
Kevin Turner
a3e41d63ec Merge remote-tracking branch 'origin/main' into dev/diffusers
# Conflicts:
#	.github/workflows/test-invoke-conda.yml
#	.github/workflows/test-invoke-pip.yml
#	environments-and-requirements/requirements-base.txt
2022-12-09 10:34:29 -08:00
Kevin Turner
c28f56daec diffusers(ModelCache): stopgap to make from_cpu compatible with diffusers 2022-12-09 10:23:39 -08:00
Lincoln Stein
55132f6463 pin diffusers to 0.9.0 2022-12-09 09:09:22 -05:00
Matthias Wild
ed9186b099
Add windows to test workflows (#1809)
* add windows to test runners

* disable fail-fast for debugging

* re-enable login shell for conda workflow
also fix expression to exclude windows from run tests

* enable fail-fast again

* fix condition, pin runner verisons

* remove feature branch from push trigger
since already being triggered now via PR

* use gfpgan from pypi for windows
curious if this would fix the installation here as well
since worked for #1802

* unpin basicsr for windows

* for curiosity enabling testing for windows as well

* disable pip cache
since windows failed with a memory error now
but was working before it had a cache

* use matrix.github-env

* set platform specific root and outdir

* disable tests for windows since memory error
I guess the windows installation uses more space than linux
and for this they have less swap memory
2022-12-09 14:21:38 +01:00
wfng92
d2026d0509 Fix error when init_mask=None and invert_mask=True
In the event where no `init_mask` is given and `invert_mask` is set to True, the script will raise the following error:

```bash
AttributeError: 'NoneType' object has no attribute 'mode'
```

The new implementation will only run inversion when both variables are valid.
2022-12-08 22:37:11 -05:00
Artur
0bc4ed14cd Prompt placeholder changed in PromptInput.tsx
Syntax examples were added
2022-12-08 22:35:41 -05:00
Jonathan
06369d07c0 Update CLI.py 2022-12-08 22:34:49 -05:00
Jonathan
4e61069821 Update embiggen.py 2022-12-08 22:34:49 -05:00
Kevin Turner
9199d698f8 diffusers: upgrade to diffusers 0.10, add Heun scheduler 2022-12-08 13:02:47 -08:00
Kevin Turner
30a8d4c2b3 diffusers: enable DPMSolver++ scheduler 2022-12-07 19:00:23 -08:00
Kevin Turner
9bcb3b1bf7 fixup! refactor(diffusers): reduce some code duplication amongst the different tasks 2022-12-07 18:26:08 -08:00
Kevin Turner
821c7df240 refactor(diffusers): reduce some code duplication amongst the different tasks 2022-12-07 18:20:56 -08:00
Kevin Turner
d6eef612d7 Merge remote-tracking branch 'origin/main' into dev/diffusers
# Conflicts:
#	ldm/invoke/generator/img2img.py
2022-12-07 17:06:08 -08:00
Daya Adianto
d7ba041007 Enable force free GPU memory in img2img 2022-12-07 19:25:21 -05:00
Sammy
3859302f1c Remove -e from "INSTALL_PATCHMATCH.md
The -e flag does NOT work in this case and results in a RemoteNotFound Error
2022-12-07 19:24:31 -05:00
Sammy
865439114b Arch Specific Patchmatch Instructions + Fixing linux conda installation 2022-12-07 19:24:31 -05:00
Lynne Whitehorn
4d76116152 Update invoke.bat.in isolate environment variables
Without locally scoped (to the script) environment variables, this script can only be run once and then you need to start a new cmd session to get a clean environment.

Surrounding the script with setlocal/endlocal achieves this.

https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/setlocal
https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/endlocal
2022-12-07 17:45:19 -05:00
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
Vedant Madane
04e77f3858 Fix Broken Link To Notebook
* The link pointed to https://github.com/invoke-ai/InvokeAI/blob/main/notebooks/Stable-Diffusion-local-Windows.ipynb which does not exist so it has been replaced with https://github.com/invoke-ai/InvokeAI/blob/main/notebooks/Stable_Diffusion_AI_Notebook.ipynb

* Add buttons for running on Colab 

* Tried adding running InvokeAI on Binder but the error was:
ERROR: Ignored the following versions that require a different python version: 0.55.2 Requires-Python <3.5
ERROR: Could not find a version that satisfies the requirement clipseg (from invokeai) (from versions: none)
ERROR: No matching distribution found for clipseg
Removing intermediate container 25be65428187
The command '/bin/sh -c ${KERNEL_PYTHON_PREFIX}/bin/pip install --no-cache-dir .' returned a non-zero code: 1

`## Running Online On JupyterHub Binder
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/invoke-ai/InvokeAI/main?labpath=https%3A%2F%2Fgithub.com%2Finvoke-ai%2FInvokeAI%2Fblob%2Fmain%2Fnotebooks%2FStable_Diffusion_AI_Notebook.ipynb)`

This will have to be added for having the Launch | Binder button after it runs properly.
2022-12-07 08:28:14 -05:00
Eugene Brodsky
1fc1eeec38
Fix docker push github action and expand with additional metadata (#1837)
* update docker build (cloud) action with additional metadata, new labels

* (docker) also add aarch64 cloud build and remove arch suffix

* (docker) architecture suffix is needed for now

* (docker) don't build aarch64 for now
2022-12-07 14:03:33 +01: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
Matthias Wild
556081695a
disable pushing the cloud container (#1831) 2022-12-06 18:06:48 +01:00
Eugene Brodsky
ad7917c7aa
Optimized Docker build with support for external working directory (#1544)
* add docker build optimized for size; do not copy models to image

useful for cloud deployments. attempts to utilize docker layer
caching as effectively as possible. also some quick tools to help with
building

* add workflow to build cloud img in ci

* push cloud image in addition to building

* (ci) also tag docker images with git SHA

* (docker) rework Makefile for easy cache population and local use

* support the new conda-less install; further optimize docker build

* (ci) clean up the build-cloud-img action

* improve the Makefile for local use

* move execution of invoke script from entrypoint to cmd, allows overriding the cmd if needed (e.g. in Runpod

* remove unnecessary copyright statements

* (docs) add a section on running InvokeAI in the cloud using Docker

* (docker) add patchmatch to the cloud image; improve build caching; simplify Makefile

* (docker) fix pip requirements path to use binary_installer directory
2022-12-06 13:28:07 +01:00
Kent Keirsey
39cca8139f Clean up readme 2022-12-06 06:58:26 -05: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
Lincoln Stein
44a0055571
correct regression in loading of PaperCut and VoxelArt models (#1730)
This corrects a regression in loading of these models due to
a change of the embedding_manager parameter `num_vectors_per_token`

Fixes #1718
2022-12-05 19:04:34 +01:00
Lincoln Stein
0cc01143d8
invoke script cds to its location before running (#1805) 2022-12-05 19:03:20 +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