Commit Graph

4617 Commits

Author SHA1 Message Date
Lincoln Stein
b31fc43bfa
Fix potential race condition in config system (#3466)
There was a potential gotcha in the config system that was previously
merged with main. The `InvokeAIAppConfig` object was configuring itself
from the command line and configuration file within its initialization
routine. However, this could cause it to read `argv` from the command
line at unexpected times. This PR fixes the object so that it only reads
from the init file and command line when its `parse_args()` method is
explicitly called, which should be done at startup time in any top level
script that uses it.

In addition, using the `get_invokeai_config()` function to get a global
version of the config object didn't feel pythonic to me, so I have
changed this to `InvokeAIAppConfig.get_config()` throughout.

## Updated Usage

In the main script, at startup time, do the following:

```
from invokeai.app.services.config import InvokeAIAppConfig
config = InvokeAIAppConfig.get_config()
config.parse_args()
```

In non-main scripts, it is not necessary (or recommended) to call
`parse_args()`:
```
from invokeai.app.services.config import InvokeAIAppConfig
config = InvokeAIAppConfig.get_config()
```

The configuration object properties can be overridden when
`get_config()` is called by passing initialization values in the usual
way. If a property is set this way, then it will not be changed by
subsequent calls to `parse_args()`, but can only be changed by
explicitly setting the property.

```
config = InvokeAIAppConfig.get_config(nsfw_checker=True)
config.parse_args(argv=['--no-nsfw_checker'])
config.nsfw_checker
# True
```

You may specify alternative argv lists and configuration files in
`parse_args()`:

```
config.parse_args(argv=['--no-nsfw_checker'],
                             conf = OmegaConf.load('/tmp/test.yaml')
)
```

For backward compatibility, the `get_invokeai_config()` function is
still available from the module, but has been removed from the rest of
the source tree.
2023-06-05 15:26:50 -07:00
Lincoln Stein
9bcf0b2251
Merge branch 'main' into lstein/config-management-fixes 2023-06-05 15:10:33 -07:00
blessedcoolant
bc892c535c
feat(ui): fix image fit (#3501)
- Prevent init, current & control images from overflowing
2023-06-05 20:48:55 +12:00
psychedelicious
099e1e7c08 feat(ui): fix image fit
- Prevent init, current & control images from overflowing
2023-06-05 17:16:30 +10:00
psychedelicious
b1000e30c1 feat(ui): disable keyboard dnd
Need to fix a bug w/ collision detection before enabling it. Will pursue later.
2023-06-05 15:24:24 +10:00
psychedelicious
7bd94eac0e feat(ui): support image dnd to canvas 2023-06-05 15:24:24 +10:00
psychedelicious
2c77563dcc feat(ui): move DropOverlay into its own IAIDropOverlay component 2023-06-05 15:24:24 +10:00
Lincoln Stein
9e31b1f387
Merge branch 'main' into lstein/config-management-fixes 2023-06-04 18:17:43 -04:00
blessedcoolant
25b8dd340a
Prompting: enable long prompts and compel's new .and() concatenating feature (#3497)
this PR adds long prompt support and enables compel's new `.and()`
concatenation feature which improves image quality especially with SD2.1

example of a long prompt:
> a moist sloppy pindlesackboy sloppy hamblin' bogomadong, Clem Fandango
is pissed-off, Wario's Woods in background, making a noise like
ga-woink-a
![000075 6dfd7adf
466129594](https://github.com/invoke-ai/InvokeAI/assets/144366/051608b6-8d52-463b-af10-04b695cda9c1)

the same prompt broken into fragments and concatenated using `.and()`
(syntax works like `.blend()`):
```
("a moist sloppy pindlesackboy sloppy hamblin' bogomadong", 
"Clem Fandango is pissed-off", 
"Wario's Woods in background", 
"making a noise like ga-woink-a").and()
```
![000076 68b1c320
466129594](https://github.com/invoke-ai/InvokeAI/assets/144366/3fee291f-5562-40f9-9c3c-a73765fc893a)


and a less silly example:

> A dream of a distant galaxy, by Caspar David Friedrich, matte
painting, trending on artstation, HQ
![000129 1b33b559
2793529321](https://github.com/invoke-ai/InvokeAI/assets/144366/d4113756-ed0d-49cd-bb2e-a2fc4a09e0af)

the same prompt broken into two fragments and concatenated:
```
("A dream of a distant galaxy, by Caspar David Friedrich, matte painting", 
"trending on artstation, HQ").and()
```
![000128 b5d5cd62
2793529321](https://github.com/invoke-ai/InvokeAI/assets/144366/c373c009-05db-4c42-8a1d-c89fbdb334ec)

as with `.blend()` you can also weight the parts eg `("a man eating an
apple", "sitting on the roof of a car", "high quality, trending on
artstation, 8K UHD").and(1, 0.5, 0.5)` which will assign weight `1` to
`a man eating an apple` and `0.5` to `sitting on the roof of a car` and
`high quality, trending on artstation, 8K UHD`.
2023-06-05 04:53:08 +12:00
blessedcoolant
fb06f5b892
Merge branch 'main' into feat_compel_longprompts_and_concat 2023-06-05 04:34:39 +12:00
Damian Stewart
cdcfda164d enable long prompts, upgrade compel to enable .and() (concatenating prompts) 2023-06-04 15:30:54 +02:00
blessedcoolant
966b154a1f
Update web README.md (#3496) 2023-06-05 00:56:00 +12:00
psychedelicious
95fa66661c
dummy commit to make github actions run 2023-06-04 22:55:35 +10:00
psychedelicious
6247b79111 docs(ui): update API_CLIENT 2023-06-04 22:46:53 +10:00
psychedelicious
5831364f9c
Update web README.md 2023-06-04 22:44:18 +10:00
psychedelicious
919b81cff1 fix(ui): fix rebase issue 2023-06-04 22:34:58 +10:00
psychedelicious
065fff7db5 fix(ui): fix wonkiness with image dnd 2023-06-04 22:34:58 +10:00
psychedelicious
a664ee30a2 feat(ui): do not change images if the dropped image is the same image 2023-06-04 22:34:58 +10:00
psychedelicious
03f3ad435a feat(ui): updated controlnet logic/ui 2023-06-04 22:34:58 +10:00
psychedelicious
2270c270ef feat(ui): add tooltip to IAISwitch 2023-06-04 22:34:58 +10:00
psychedelicious
4f7820719b feat(ui): add ellipsis direction to IAICustomSelect 2023-06-04 22:34:58 +10:00
psychedelicious
fa285883ad feat(ui): make OverlayDragImage translucent 2023-06-04 22:34:58 +10:00
psychedelicious
474fca8e6a feat(ui): add controlNetDenylist 2023-06-04 22:34:58 +10:00
psychedelicious
5dc0250b00 feat(ui): ControlNet layout tweaks 2023-06-04 22:34:58 +10:00
psychedelicious
f269377a01 feat(ui): "ProcessorOptionsContainer" -> "ProcessorWrapper", organise 2023-06-04 22:34:58 +10:00
psychedelicious
d0406024e3 feat(ui): IAICustomSelect tweak styles 2023-06-04 22:34:58 +10:00
blessedcoolant
aa3a969bd2 feat: Update ControlNet Model List & Map 2023-06-04 22:34:58 +10:00
blessedcoolant
73a95973a8 wip: Add Wrapper Container for Preprocessor Options
For fast altering of the layout across all pre-preocessors.
2023-06-04 22:34:58 +10:00
blessedcoolant
bf4fe3c1ac wip: Fixing layout shifts with the ControlNet tab 2023-06-04 22:34:58 +10:00
psychedelicious
d6c08ba469 feat(ui): add mini/advanced controlnet ui 2023-06-04 22:34:58 +10:00
psychedelicious
69f0ba65f1 chore(ui): bump react-icons 2023-06-04 22:34:58 +10:00
psychedelicious
828c86964d feat(ui): IAICustomSelect prevent label wrap 2023-06-04 22:34:58 +10:00
psychedelicious
54b7ddd63f feat(ui): IAIDndImage cursor: 'grab' 2023-06-04 22:34:58 +10:00
psychedelicious
a0dde66b5d feat(ui): more work on controlnet mini 2023-06-04 22:34:58 +10:00
psychedelicious
b6b3b9f99c feat(ui): make scrollbar less bright 2023-06-04 22:34:58 +10:00
psychedelicious
faa69f8a47 feat(ui): add alpha colors 2023-06-04 22:34:58 +10:00
psychedelicious
d92c7f5483 feat(ui): organize IAIDndImage component 2023-06-04 22:34:58 +10:00
psychedelicious
6b824eb112 feat(ui): initial mini controlnet UI, dnd improvements 2023-06-04 22:34:58 +10:00
psychedelicious
72b4371804 feat(ui): control image auto-process 2023-06-04 22:34:58 +10:00
psychedelicious
fa290aff8d feat(ui): add defaults for all processors 2023-06-04 22:34:58 +10:00
psychedelicious
3d99d7ae8b feat(ui): update handling of inProgess, do not allow cnet process when processing 2023-06-04 22:34:58 +10:00
psychedelicious
2eb367969c feat(ui): do not autoprocess control if invocation in progress 2023-06-04 22:34:58 +10:00
psychedelicious
9cdad95f48 feat(ui): add rest of controlnet processors 2023-06-04 22:34:58 +10:00
psychedelicious
707ed39300 chore(ui): regen api client 2023-06-04 22:34:58 +10:00
psychedelicious
6bbb5f061a feat(nodes): update controlnet names/descriptions 2023-06-04 22:34:58 +10:00
psychedelicious
6896e69e95 fix(ui): fix multiple controlnets 2023-06-04 22:34:58 +10:00
psychedelicious
b17f4c1650 feat(ui): more tweaking controlnet ui 2023-06-04 22:34:58 +10:00
psychedelicious
98493ed9e2 feat(ui): reorg parameter panel to make room for controlnet 2023-06-04 22:34:58 +10:00
psychedelicious
94c953deab feat(ui): get processed images back into controlnet ui 2023-06-04 22:34:58 +10:00
psychedelicious
fa4d88e163 feat(ui): improve drag and drop ux 2023-06-04 22:34:58 +10:00