Commit Graph

983 Commits

Author SHA1 Message Date
psychedelicious
a15a5bc3b8 fix(api): correct get_batch response model 2023-08-21 19:51:02 +10:00
psychedelicious
535eb1db16
Merge branch 'main' into fix/stats/handle-exceptions 2023-08-21 19:19:32 +10:00
psychedelicious
d95773f50f Revert "feat(nodes): make fields that accept connection input optional in OpenAPI schema"
This reverts commit 7325cbdd250153f347e3782265dd42783f7f1d00.
2023-08-21 19:17:36 +10:00
psychedelicious
bf04e913c2 feat(nodes): make primitive outputs not optional, fix primitive invocation defaults 2023-08-21 19:17:36 +10:00
psychedelicious
cdc49456e8 feat(api): add additional class attribute to invocations and outputs in OpenAPI schema
It is `"invocation"` for invocations and `"output"` for outputs. Clients may use this to confidently and positively identify if an OpenAPI schema object is an invocation or output, instead of using a potentially fragile heuristic.
2023-08-21 19:17:36 +10:00
psychedelicious
37dc2d9d4d feat(nodes): update vae node tags 2023-08-21 19:17:36 +10:00
psychedelicious
6e1ddb671e feat(nodes): make fields that accept connection input optional in OpenAPI schema
Doing this via `BaseInvocation`'s `Config.schema_extra()` means all clients get an accurate OpenAPI schema.

Shifts the responsibility of correct types to the backend, where previously it was on the client.
2023-08-21 19:17:36 +10:00
psychedelicious
496a2db15c feat(nodes): make id, type required in BaseInvocation, BaseInvocationOutput
Doing this via these classes' `Config.schema_extra()` method makes it unintrusive and clients will get the correct types for these properties.

Shifts the responsibility of correct types to the backend, where previously it was on the client.
2023-08-21 19:17:36 +10:00
psychedelicious
5292eda0e4 feat(nodes): remove "Loader" from model nodes
They are not loaders, they are selectors - remove this to reduce confusion.
2023-08-21 19:17:36 +10:00
psychedelicious
0b9ae74192 fix(stats): RuntimeError: dictionary changed size during iteration 2023-08-21 19:17:36 +10:00
psychedelicious
484b572023 feat(nodes): primitives have value instead of a as field names 2023-08-21 19:17:36 +10:00
psychedelicious
cd9baf8092 fix(stats): fix InvocationStatsService types
- move docstrings to ABC
- `start_time: int` -> `start_time: float`
- remove class attribute assignments in `StatsContext`
- add `update_mem_stats()` to ABC
- add class attributes to ABC, because they are referenced in instances of the class. if they should not be on the ABC, then maybe there needs to be some restructuring
2023-08-21 19:17:36 +10:00
psychedelicious
81385d7d35 fix(stats): fix fail case when previous graph is invalid
When retrieving a graph, it is parsed through pydantic. It is possible that this graph is invalid, and an error is thrown.

Handle this by deleting the failed graph from the stats if this occurs.
2023-08-21 19:17:36 +10:00
psychedelicious
3d84e7756a fix(nodes): fix field names 2023-08-21 19:17:36 +10:00
psychedelicious
98431b3de4 feat: add Scheduler as field type
- update node schemas
- add `UIType.Scheduler`
- add field type to schema parser, input components
2023-08-21 19:17:36 +10:00
psychedelicious
0909812c84 chore: black 2023-08-21 19:17:15 +10:00
psychedelicious
66c0aea9e7 fix(nodes): removed duplicate node 2023-08-21 19:17:15 +10:00
Damian Stewart
2bcded78e1 add BlendInvocation 2023-08-21 19:17:15 +10:00
Sergey Borisov
beb3e5aeb7 Report correctly to compel if we want get pooled in future(affects blend computation) 2023-08-21 19:05:40 +10:00
Lincoln Stein
5b6069b916 blackify (again) 2023-08-20 16:06:01 -04:00
Lincoln Stein
766cb887e4 resolve more flake8 problems 2023-08-20 15:57:15 -04:00
Lincoln Stein
8e6d88e98c resolve merge conflicts 2023-08-20 15:26:52 -04:00
Brandon Rising
137fbacb92 Fix flake8 2023-08-18 15:47:27 -04:00
Brandon Rising
4b6d9a73ed Merge branch 'main' into feat/batch-graphs 2023-08-18 15:40:34 -04:00
Brandon Rising
3e26214b83 Add a few more endpoints for managing batches 2023-08-18 15:38:16 -04:00
Brandon Rising
0282f46c71 Add runs field for running the same batch multiple times 2023-08-18 13:41:07 -04:00
Brandon Rising
99e03fe92e Run unmodified graph if no batch data is provided 2023-08-18 13:33:09 -04:00
psychedelicious
1b70bd1380 fix(stats): fix InvocationStatsService types
- move docstrings to ABC
- `start_time: int` -> `start_time: float`
- remove class attribute assignments in `StatsContext`
- add `update_mem_stats()` to ABC
- add class attributes to ABC, because they are referenced in instances of the class. if they should not be on the ABC, then maybe there needs to be some restructuring
2023-08-18 21:35:03 +10:00
psychedelicious
d1d2d5a47d fix(stats): fix fail case when previous graph is invalid
When retrieving a graph, it is parsed through pydantic. It is possible that this graph is invalid, and an error is thrown.

Handle this by deleting the failed graph from the stats if this occurs.
2023-08-18 21:34:55 +10:00
Millun Atluri
3798c8bdb0
Merge branch 'main' into feat_compel_and 2023-08-18 17:04:03 +10:00
psychedelicious
c49851e027 chore: minor cleanup after merge & flake8 2023-08-18 16:05:39 +10:00
psychedelicious
3c43594c26 Merge branch 'main' into fix/inpaint_gen 2023-08-18 15:57:48 +10:00
Martin Kristiansen
537ae2f901 Resolving merge conflicts for flake8 2023-08-18 15:52:04 +10:00
Kevin Turner
654dcd453f feat(dev_reload): use jurigged to hot reload changes to Python source 2023-08-17 19:02:44 -07:00
Sergey Borisov
cfd827cfad Added node for creating mask inpaint 2023-08-18 04:07:40 +03:00
Lincoln Stein
e9a294f733
Merge branch 'main' into fix/inpaint_gen 2023-08-17 16:13:33 -04:00
Lincoln Stein
b69f26c85c add support for "balanced" attention slice size 2023-08-17 16:11:09 -04:00
Lincoln Stein
23b4e1cea0
Merge branch 'main' into refactor/rename-performance-options 2023-08-17 14:43:00 -04:00
Lincoln Stein
635a814dfb fix up documentation 2023-08-17 14:32:05 -04:00
Brandon Rising
cb65526880 More session not found handling 2023-08-17 14:23:12 -04:00
Lincoln Stein
c19835c2d0 wired attention configuration into backend 2023-08-17 14:20:45 -04:00
Lincoln Stein
ed38eaa10c refactor InvokeAIAppConfig 2023-08-17 13:47:26 -04:00
blessedcoolant
b213335316 feat: Add InpaintMask Field type 2023-08-18 04:54:23 +12:00
Sergey Borisov
ff5c725586 Update mask field type 2023-08-17 19:35:03 +03:00
Sergey Borisov
bf0dfcac2f Add inapint mask field class 2023-08-17 19:19:07 +03:00
psychedelicious
59bc9ed399 fix(backend): handle BatchSessionNotFoundException in BatchManager._process()
The internal `BatchProcessStorage.get_session()` method throws when it finds nothing, but we were not catching any exceptions.

This caused a exception when the batch manager handles a `graph_execution_state_complete` event that did not originate from a batch.

Fixed by handling the exception.
2023-08-17 13:58:11 +10:00
psychedelicious
e62d5478fd fix(backend): fix sqlite cannot commit - no transaction is active
The `commit()` was called even if we hadn't executed anything
2023-08-17 13:55:38 +10:00
psychedelicious
cc3c2756bd feat(backend): rename batch changes variable
`updateSession` -> `changes`
2023-08-17 13:32:32 +10:00
Lincoln Stein
503e3bca54 revise config but need to migrate old format to new 2023-08-16 23:30:00 -04:00
psychedelicious
67cf594bb3 feat(backend): add missing types to batch_manager_storage.py 2023-08-17 13:29:19 +10:00
psychedelicious
c5b963f1a6 fix(backend): typo
`relavent` -> `relevant`
2023-08-17 12:47:58 +10:00
psychedelicious
4d2dd6bb10 feat(backend): rename BatchManager.process to _process
Just to make it clear that this is not a method on the ABC.
2023-08-17 12:47:05 +10:00
psychedelicious
7e4beab4ff feat(backend): surface BatchSessionNodeFoundException
Catch this exception in the router and return an appropriate `HTTPException`.
2023-08-17 12:45:32 +10:00
psychedelicious
e16b5f7cdc feat(backend): deserialize batch session directly
If the values from the `session_dict` are invalid, the model instantiation will fail, or if we end up with an invalid `batch_id`, the app will not run. So I think just parsing the dict directly is equivalent.

Also the LSP analyser is pleased now - no red squigglies.
2023-08-17 12:37:03 +10:00
psychedelicious
1f355d5810 feat(backend): update batch_manager_storage.py docstrings 2023-08-17 12:31:51 +10:00
psychedelicious
df7370f9d9 chore(backend): remove unused code 2023-08-17 12:16:34 +10:00
psychedelicious
5bec64d65b fix(backend): fix typings in batch_manager.py
- `batch_indicies` is `tuple[int]` not `list[int]`
- explicit `None` return values
2023-08-17 12:07:20 +10:00
psychedelicious
8cf9bd47b2 chore(backend): remove unnecessary batch validation function
The `Batch` model is fully validated by pydantic on instantiation; we do not need any validation logic for it.
2023-08-17 11:59:47 +10:00
psychedelicious
c91621b46c fix(backend): BatchProcess.batch_id is required
Providing a `default_factory` is enough for pydantic to know to create the attribute on instantiation if it's not already provided. We can then make make the typing just `str`.
2023-08-17 11:58:29 +10:00
psychedelicious
f246b236dd fix(api): fix start_batch route responses 2023-08-17 11:51:14 +10:00
Lincoln Stein
daf75a1361 blackify 2023-08-16 21:47:29 -04:00
Lincoln Stein
c39f8b478b fix misplaced ram_used and ram_changed attributes 2023-08-16 21:39:18 -04:00
Lincoln Stein
2ca8611723 add +/- sign in front of RAM delta 2023-08-16 15:53:01 -04:00
Brandon Rising
f7277a8b21 Run python black 2023-08-16 15:44:52 -04:00
Brandon Rising
796ff34c8a Testing out Spencer's batch data structure 2023-08-16 15:21:11 -04:00
Brandon Rising
d6a5c2dbe3 Fix tests 2023-08-16 14:35:49 -04:00
Brandon
ef8dc2e8c5
Merge branch 'main' into feat/batch-graphs 2023-08-16 14:03:34 -04:00
Lincoln Stein
b12cf315a8
Merge branch 'main' into feat/collect-more-stats 2023-08-16 09:19:33 -04:00
psychedelicious
43b30355e4 feat: make primitive node titles consistent 2023-08-16 23:04:36 +10:00
Lincoln Stein
a93bd01353 fix bad merge 2023-08-16 08:53:07 -04:00
Lincoln Stein
be8edaf3fd
Merge branch 'main' into feat/collect-more-stats 2023-08-16 08:48:14 -04:00
Brandon
314891a125
Merge branch 'main' into feat/batch-graphs 2023-08-15 22:42:49 -04:00
Lincoln Stein
21e1c0a5f0 tweaked formatting 2023-08-15 22:25:30 -04:00
psychedelicious
8b1ec2685f chore: black 2023-08-16 12:07:34 +10:00
psychedelicious
60c2c877d7 fix: add response model for star/unstar routes
- also implement pessimistic updates for starring, only changing the images that were successfully updated by backend
- some autoformat changes crept in
2023-08-16 12:07:34 +10:00
maryhipp
80b0c5eab4 change from pin to star 2023-08-16 12:07:34 +10:00
maryhipp
ee6a26a97d update list images endpoint to sort by pinnedness and then created_at 2023-08-16 12:07:34 +10:00
maryhipp
04a9894e77 (api) add ability to pin and unpin images 2023-08-16 12:07:34 +10:00
Lincoln Stein
f9958de6be added memory used to load models 2023-08-15 21:56:19 -04:00
Brandon Rising
2d3094f988 Run python black 2023-08-15 21:51:45 -04:00
Brandon Rising
abf09fc8fa Switch sqlite clients to only use one connection 2023-08-15 21:46:24 -04:00
Lincoln Stein
ec10aca91e report RAM and RAM cache statistics 2023-08-15 21:00:30 -04:00
psychedelicious
2b7dd3e236 feat: add missing primitive collections
- add missing primitive collections
- remove `Seed` and `LoRAField` (they don't exist)
2023-08-16 09:54:38 +10:00
psychedelicious
fa884134d9 feat: rename ui_type_hint to ui_type
Just a bit more succinct while not losing any clarity.
2023-08-16 09:54:38 +10:00
psychedelicious
c48fd9c083 feat(nodes): refactor parameter/primitive nodes
Refine concept of "parameter" nodes to "primitives":
- integer
- float
- string
- boolean
- image
- latents
- conditioning
- color

Each primitive has:
- A field definition, if it is not already python primitive value. The field is how this primitive value is passed between nodes. Collections are lists of the field in node definitions. ex: `ImageField` & `list[ImageField]`
- A single output class. ex: `ImageOutput`
- A collection output class. ex: `ImageCollectionOutput`
- A node, which functions to load or pass on the primitive value. ex: `ImageInvocation` (in this case, `ImageInvocation` replaces `LoadImage`)

Plus a number of related changes:
- Reorganize these into `primitives.py`
- Update all nodes and logic to use primitives
- Consolidate "prompt" outputs into "string" & "mask" into "image" (there's no reason for these to be different, the function identically)
- Update default graphs & tests
- Regen frontend types & minor frontend tidy related to changes
2023-08-16 09:54:38 +10:00
psychedelicious
f49fc7fb55 feat: node editor
squashed rebase on main after backendd refactor
2023-08-16 09:54:38 +10:00
Lincoln Stein
a4b029d03c write RAM usage and change after each generation 2023-08-15 18:21:31 -04:00
Brandon Rising
15e7ca1baa Break apart create/start logic 2023-08-15 16:28:47 -04:00
Brandon Rising
6cb90e01de Graph is required in batch create 2023-08-15 16:13:51 -04:00
Brandon Rising
faa4574970 Turn off WAL mode 2023-08-15 15:59:42 -04:00
Brandon
cc5755d5b1
Update invokeai/app/services/batch_manager_storage.py
Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com>
2023-08-15 15:54:57 -04:00
Brandon
85105fc070
Update invokeai/app/services/batch_manager_storage.py
Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com>
2023-08-15 15:54:17 -04:00
Brandon Rising
f8d8b16267 Run python black 2023-08-14 11:01:31 -04:00
Brandon Rising
69f541075c Merge branch 'main' into feat/batch-graphs 2023-08-14 10:32:35 -04:00
psychedelicious
9d3cd85bdd chore: black 2023-08-14 13:02:33 +10:00
Sergey Borisov
409e5d01ba Fix cpu_only schedulers(unipc) 2023-08-14 05:14:05 +03:00
Sergey Borisov
d63bb39475 Make dpmpp_sde(_k) use not random seed 2023-08-14 00:24:38 +03:00
Sergey Borisov
59ba9fc0f6 Flip bits in seed for sde/ancestral schedulers to have different noise from initial 2023-08-13 19:50:16 +03:00
Sergey Borisov
6e0beb1ed4 Fixes for second order scheduler timesteps 2023-08-13 19:31:47 +03:00
Sergey Borisov
94636ddb03 Fix empty prompt handling 2023-08-13 19:31:14 +03:00