Commit Graph

3449 Commits

Author SHA1 Message Date
Lincoln Stein
1b62c781d7 temporarily disable run-patches 2023-03-13 09:33:32 -04:00
Lincoln Stein
c4de509983 fix failure to update to 2.3.2
- fixes #2930 #2941
2023-03-13 09:19:26 -04:00
Lincoln Stein
8d80802a35
improve support for V2 variant legacy checkpoints (#2926)
This commit enhances support for V2 variant (epsilon and v-predict)
import and conversion to diffusers, by prompting the user to select the
proper config file during startup time autoimport as well as in the
invokeai installer script. Previously the user was only prompted when
doing an `!import` from the command line or when using the WebUI Model
Manager.
2023-03-11 20:54:01 -05:00
Lincoln Stein
694925f427 improve support for V2 variant legacy checkpoints
This commit enhances support for V2 variant (epsilon and v-predict)
import and conversion to diffusers, by prompting the user to select
the proper config file during startup time autoimport as well as
in the invokeai installer script..
2023-03-11 19:34:10 -05:00
Lincoln Stein
61d5cb2536 rebuild frontend/dist 2023-03-11 18:34:17 -05:00
Lincoln Stein
c23fe4f6d2
Restore invokeai-update (#2909)
At some point `pyproject.toml` was modified to remove the
invokeai-update and invokeai-model-install scripts. This PR fixes the
issue.

If this was an intentional change, let me know and we'll discuss.
2023-03-11 18:31:30 -05:00
Lincoln Stein
e6e93bbb80
Merge branch 'v2.3' into bugfix/restore-update-command 2023-03-11 17:52:09 -05:00
blessedcoolant
b5bd5240b6
Support both v2-v and v2-e legacy ckpt models in v2.3 (#2907)
# Support SD version 2 "epsilon" and "v-predict" inference
configurations in v2.3

This is a port of the `main` PR #2870 back into V2.3. It allows both
"epsilon" inference V2 models (e.g. "v2-base") and "v-predict" models
(e.g. "V2-768") to be imported and converted into correct diffusers
models. This depends on picking the right configuration file to use, and
since there is no intrinsic difference between the two types of models,
when we detect that a V2 model is being imported, we fall back to asking
the user to select the model type.
2023-03-12 04:42:16 +13:00
blessedcoolant
827ac82d54
Merge branch 'v2.3' into bugfix/support-both-v2-variants 2023-03-12 04:18:11 +13:00
Lincoln Stein
9c2f3259ca
use diffusers 0.14 cache layout, upgrade transformers, safetensors, accelerate (#2913)
This PR ports the `main` PR #2871 to the v2.3 branch. This adjusts the
global diffusers model cache to work with the 0.14 diffusers layout of
placing models in HF_HOME/hub rather than HF_HOME/diffusers. It also
implements the one-time migration action to the new layout.
2023-03-11 10:17:46 -05:00
Lincoln Stein
6abe2bfe42
Merge branch 'v2.3' into bugfix/support-both-v2-variants 2023-03-11 10:01:32 -05:00
Lincoln Stein
acf955fc7b upgrade transformers, accelerate, safetensors 2023-03-10 06:58:46 -05:00
Lincoln Stein
023db8ac41 use diffusers 0.14 cache layout
This PR ports the `main` PR #2871 to the v2.3 branch. This adjusts
the global diffusers model cache to work with the 0.14 diffusers
layout of placing models in HF_HOME/hub rather than HF_HOME/diffusers.
2023-03-09 22:35:43 -05:00
Lincoln Stein
65cf733a0c
Merge branch 'v2.3' into bugfix/restore-update-command 2023-03-09 21:45:17 -05:00
Lincoln Stein
8323169864
Dynamic prompt generation script for parameter scans (#2831)
# Programatically generate a large number of images varying by prompt
and other image generation parameters

This is a little standalone script named `dynamic_prompting.py` that
enables the generation of dynamic prompts. Using YAML syntax, you
specify a template of prompt phrases and lists of generation parameters,
and the script will generate a cross product of prompts and generation
settings for you. You can save these prompts to disk for later use, or
pipe them to the invokeai CLI to generate the images on the fly.

Typical uses are testing step and CFG values systematically while
holding the seed and prompt constant, testing out various artist's
styles, and comparing the results of the same prompt across different
models.

A typical template will look like this:

```
model: stable-diffusion-1.5
steps: 30;50;10
seed: 50
dimensions: 512x512
cfg:
  - 7
  - 12
sampler:
  - k_euler_a
  - k_lms
prompt:
  style:
       - greg rutkowski
       - gustav klimt
  location:
       - the mountains
       - a desert
  object:
       - luxurious dwelling
       - crude tent
  template: a {object} in {location}, in the style of {style}
```

This will generate 96 different images, each of which varies by one of
the dimensions specified in the template. For example, the prompt axis
will generate a cross product list like:
```
a luxurious dwelling in the mountains, in the style of greg rutkowski
a luxurious dwelling in the mountains, in the style of gustav klimt
a luxious dwelling in a desert, in the style of greg rutkowski
... etc
```

A typical usage would be:
```
python scripts/dynamic_prompts.py --invoke --outdir=/tmp/scanning my_template.yaml
```
This will populate `/tmp/scanning` with each of the requested images,
and also generate a `log.md` file which you can open with an e-book
reader to show something like this:


![image](https://user-images.githubusercontent.com/111189/221970165-4bbd9070-3f32-4d89-8ff2-b03a82ada575.png)

Full instructions can be obtained using the `--instructions` switch, and
an example template can be printed out using `--example`:

```
python scripts/dynamic_prompts.py --instructions
python scripts/dynamic_prompts.py --example > my_first_template.yaml
```
2023-03-09 20:18:28 -05:00
Kevin Turner
bf5cd1bd3b
Merge branch 'v2.3' into enhance/simple-param-scanner-script 2023-03-09 16:08:27 -08:00
Lincoln Stein
c9db01e272
Disable built-in NSFW checker on models converted with --ckpt_convert (#2908)
When a legacy ckpt model was converted into diffusers in RAM, the
built-in NSFW checker was not being disabled, in contrast to models
converted and saved to disk. Because InvokeAI does its NSFW checking as
a separate post-processing step (in order to generate blurred images
rather than black ones), this defeated the
--nsfw and --no-nsfw switches.

This closes #2836 and #2580.

Note - this fix will be applied to `main` as a separate PR.
2023-03-09 18:06:40 -05:00
Lincoln Stein
6d5e9161fb make version pep 440 compliant 2023-03-09 18:00:31 -05:00
Lincoln Stein
0636348585 bump version number to +a0 2023-03-09 17:57:19 -05:00
Lincoln Stein
4c44523ba0 Restore invokeai-update
At some point `pyproject.toml` was modified to remove the
invokeai-update script, which in turn breaks the update
function in the launcher scripts. This PR fixes the
issue.

If this was an intentional change, let me know and we'll discuss.
2023-03-09 17:49:58 -05:00
Lincoln Stein
5372800e60 Disable built-in NSFW checker on models converted with --ckpt_convert
When a legacy ckpt model was converted into diffusers in RAM, the
built-in NSFW checker was not being disabled, in contrast to models
converted and saved to disk. Because InvokeAI does its NSFW checking
as a separate post-processing step (in order to generate blurred
images rather than black ones), this defeated the
--nsfw and --no-nsfw switches.

This closes #2836 and #2580.
2023-03-09 17:38:58 -05:00
Lincoln Stein
2ae396640b Support both v2-v and v2-e legacy ckpt models 2023-03-09 15:35:17 -05:00
Lincoln Stein
252f222068
Merge branch 'v2.3' into enhance/simple-param-scanner-script 2023-03-09 12:02:40 -05:00
Lincoln Stein
142ba8c8ea add logging, support for prompts with shell metachars 2023-03-09 11:57:44 -05:00
Lincoln Stein
84dfd2003e fix documentation of range syntax 2023-03-09 02:29:07 -05:00
blessedcoolant
5a633ba811
[WebUI] Fix 'Use All' Params not Respecting Hi-Res Fix (#2840)
This is a different source/base branch from
https://github.com/invoke-ai/InvokeAI/pull/2823 but is otherwise the
same content. `yarn build` was ran on this clean branch.

## What was the problem/requirement? (What/Why)
As part of a [change in
2.3.0](d74c4009cb),
the high resolution fix was no longer being applied when 'Use all' was
selected. This effectively meant that users had to manually analyze
images to ensure that the parameters were set to match.
~~Additionally, and never actually working, Upscaling and Face
Restoration parameters were also not pulling through with the action,
causing a similar usability issue.~~ See:
https://github.com/invoke-ai/InvokeAI/pull/2823#issuecomment-1445530362

## What was the solution? (How)
This change adds a new reducer to the `postprocessingSlice` file,
mimicking the `generationSlice` reducer to assign all parameters
appropriate for the post processing options. This reducer assigns:
* Hi-res's toggle button only if the type is `txt2img`, since `img2img`
hi-res was removed previously
* ~~Upscaling's toggle button, scale, denoising strength, and upscale
strength~~
* ~~Face Restoration's toggle button, type, strength, and fidelity (if
present/applicable)~~

### Minor
* Added `endOfLine: 'crlf'` to prettier's config to prevent all files
from being checked out on Windows due to difference of line endings (and
git not picking up those changes as modifications, causing ghost
modified files from Git)

### Revision 2:
* Removed out upscaling and face restoration pulling of parameters
### Revision 3:
* More defensive coding for the `hires_fix` not present (assume false)

### Out of Scope
* Hi-res strength (applied as img2img strength in the initial image that
is generated) is not in the metadata of the final image and can't be
reconstructed easily
* Upscaling and face restoration have some peculiarities for multi-post
processing outside of the UI, which complicates it enough to scope out
of this PR.

## How were these changes tested?
* `yarn dev` => Server started successfully
* Manual testing on the development server to ensure parameters pulled
correctly
* `yarn build` => Success

## Notes
As with `generationSlice`, this code assumes `action.payload.image` is
valid and doesn't do a formal check on it to ensure it is valid.
2023-03-08 22:38:41 +13:00
Lincoln Stein
f207647f0f CLI now writes hires_fix to metadata 2023-03-07 17:22:16 -08:00
blhook
ad16581ab8 Change to auto EoL and fix property missing from assignment of hires fix 2023-03-07 17:22:16 -08:00
blhook
fd722ddf7d Fix High Resolution not Pulling for Use All Parameters 2023-03-07 17:22:16 -08:00
Jonathan
d669e69755
Merge branch 'v2.3' into enhance/simple-param-scanner-script 2023-03-07 11:45:45 -06:00
Lincoln Stein
d912bab4c2 install the script as "invokeai-batch" 2023-03-07 10:10:18 -05:00
Lincoln Stein
68c2722c02
Prevent crash when converting models from within CLI using legacy model URL (#2846)
- Crash would occur at the end of this sequence:
  - launch CLI
  - !convert <URL pointing to a legacy ckpt file>
  - Answer "Y" when asked to delete original .ckpt file

- This commit modifies model_manager.heuristic_import() to silently
delete the downloaded legacy file after it has been converted into a
diffusers model. The user is no longer asked to approve deletion.

NB: This should be cherry-picked into main once refactor is done.
2023-03-07 00:09:11 -05:00
Jonathan
426fea9681
Merge branch 'v2.3' into bugfix/crash-on-unlink-after-convert 2023-03-06 20:51:58 -06:00
Lincoln Stein
62cfdb9f11
fix newlines causing negative prompt to be parsed incorrectly (#2838)
This is the same fix that was applied to main in PR 2837.
2023-03-06 18:37:44 -05:00
Lincoln Stein
46b4d6497c
Merge branch 'v2.3' into bugfix/crash-on-unlink-after-convert 2023-03-06 18:14:53 -05:00
Lincoln Stein
757c0a5775
Merge branch 'v2.3' into bugfix/negative_prompt_newline 2023-03-06 18:14:06 -05:00
Lincoln Stein
9c8f0b44ad
propose more restrictive codeowners (#2781)
For your consideration, here is a revised set of codeowners for the v2.3
branch. The previous set had the bad property that both @blessedcoolant
and @lstein were codeowners of everything, meaning that we had the
superpower of being able to put in a PR and get full approval if any
other member of the team (not a codeowner) approved.

The proposed file is a bit more sensible but needs many eyes on it.
Please take a look and make improvements. I wasn't sure where to put
some people, such as @netsvetaev or @GreggHelt2

I don't think it makes sense to tinker with the `main` CODEOWNERS until
the "Big Freeze" code reorganization happens.

I subscribed everyone to this PR. Apologies
2023-03-06 18:12:29 -05:00
Lincoln Stein
21433a948c
Merge branch 'v2.3' into dev/fix-codeowners 2023-03-06 18:11:19 -05:00
Lincoln Stein
183344b878
Merge branch 'v2.3' into bugfix/negative_prompt_newline 2023-03-06 12:06:58 -05:00
Kent Keirsey
fc164d5be2
updated template styles. 2023-03-06 00:34:49 -05:00
Lincoln Stein
45aa770cd1 implemented multiprocessing across multiple GPUs 2023-03-05 01:52:28 -05:00
Lincoln Stein
6d0e782d71 add perlin, init_img, threshold & strength 2023-03-04 17:28:19 -05:00
Lincoln Stein
117f70e1ec implement locking when acquiring next output file prefix 2023-03-04 09:13:17 -05:00
Lincoln Stein
c840bd8c12 this prevents a crash when converting models from CLI
- Crash would occur at the end of this sequence:
  - launch CLI
  - !convert <URL pointing to a legacy ckpt file>
  - Answer "Y" when asked to delete original .ckpt file

- This commit modifies model_manager.heuristic_import()
  to silently delete the downloaded legacy file after
  it has been converted into a diffusers model. The user
  is no longer asked to approve deletion.

NB: This should be cherry-picked into main once refactor
is done.
2023-03-02 10:49:53 -05:00
Lincoln Stein
3c64fad379
Merge branch 'v2.3' into enhance/simple-param-scanner-script 2023-03-02 08:11:57 -05:00
Lincoln Stein
bc813e4065
Introduce pre-commit, black, isort, ... (#2822)
basically the changes I tried to introduce in #2687 (which could imho be
closed then 🙈)
2023-02-28 23:11:28 -05:00
Lincoln Stein
7c1d2422f0
Merge branch 'v2.3' into dev/v2.3/add-dev-tools 2023-02-28 22:45:38 -05:00
Lincoln Stein
a5b11e1071 fix newlines causing negative prompt to be parsed incorrectly
This is the same fix that was applied to main in PR 2837.
2023-02-28 17:32:17 -05:00
Lincoln Stein
c7e4daf431 add support for templates written in JSON 2023-02-28 17:27:37 -05:00
Lincoln Stein
4c61f3a514 add multiple enhancements
- ability to cycle through models and dimensions
- process automatically through invokeai
- create an .md file to display the grid results
2023-02-28 15:10:20 -05:00