Commit Graph

9648 Commits

Author SHA1 Message Date
psychedelicious
d9dc5d58be revert(nodes): revert making tensors/conditioning use item storage
Turns out they are just different enough in purpose that the implementations would be rather unintuitive. I've made a separate ObjectSerializer service to handle tensors and conditioning.

Refined the class a bit too.
2024-02-29 13:16:36 -05:00
psychedelicious
614f0e8086 feat(nodes): support custom exception in ephemeral disk storage 2024-02-29 13:16:36 -05:00
psychedelicious
723009e163 feat(nodes): support custom save and load functions in ItemStorageEphemeralDisk 2024-02-29 13:16:36 -05:00
psychedelicious
abdc87d5fc feat(nodes): create helper function to generate the item ID 2024-02-29 13:16:36 -05:00
psychedelicious
7cb8e29726 feat(nodes): use ItemStorageABC for tensors and conditioning
Turns out `ItemStorageABC` was almost identical to `PickleStorageBase`. Instead of maintaining separate classes, we can use `ItemStorageABC` for both.

There's only one change needed - the `ItemStorageABC.set` method must return the newly stored item's ID. This allows us to let the service handle the responsibility of naming the item, but still create the requisite output objects during node execution.

The naming implementation is improved here. It extracts the name of the generic and appends a UUID to that string when saving items.
2024-02-29 13:16:36 -05:00
psychedelicious
f593959bea tidy(nodes): do not refer to files as latents in PickleStorageTorch (again) 2024-02-29 13:16:36 -05:00
psychedelicious
c7218dc130 feat(nodes): ItemStorageABC typevar no longer bound to pydantic.BaseModel
This bound is totally unnecessary. There's no requirement for any implementation of `ItemStorageABC` to work only on pydantic models.
2024-02-29 13:16:36 -05:00
psychedelicious
ebc3a24d0d fix(nodes): add super init to PickleStorageTorch 2024-02-29 13:16:36 -05:00
psychedelicious
315681b491 tidy(nodes): do not refer to files as latents in PickleStorageTorch 2024-02-29 13:16:36 -05:00
psychedelicious
0c149cbd3b feat(nodes): replace latents service with tensors and conditioning services
- New generic class `PickleStorageBase`, implements the same API as `LatentsStorageBase`, use for storing non-serializable data via pickling
- Implementation `PickleStorageTorch` uses `torch.save` and `torch.load`, same as `LatentsStorageDisk`
- Add `tensors: PickleStorageBase[torch.Tensor]` to `InvocationServices`
- Add `conditioning: PickleStorageBase[ConditioningFieldData]` to `InvocationServices`
- Remove `latents` service and all `LatentsStorage` classes
- Update `InvocationContext` and all usage of old `latents` service to use the new services/context wrapper methods
2024-02-29 13:16:36 -05:00
psychedelicious
3563d4ecf7 tidy(nodes): delete onnx.py
It doesn't work and keeping it updated to prevent the app from starting was getting tedious. Deleted.
2024-02-29 13:16:36 -05:00
psychedelicious
c4ea96dec2 fix(nodes): rearrange fields.py to avoid needing forward refs 2024-02-29 13:16:36 -05:00
psychedelicious
06d0232841 tidy(nodes): remove unnecessary, shadowing class attr declarations 2024-02-29 13:16:36 -05:00
psychedelicious
bb8c71f706 feat(ui): revise graphs to not use LinearUIOutputInvocation
See this comment for context: https://github.com/invoke-ai/InvokeAI/pull/5491#discussion_r1480760629

- Remove this now-unnecessary node from all graphs
- Update graphs' terminal image-outputting nodes' `is_intermediate` and `board` fields appropriately
- Add util function to prepare the `board` field, tidy the utils
- Update `socketInvocationComplete` listener to work correctly with this change

I've manually tested all graph permutations that were changed (I think this is all...) to ensure images go to the gallery as expected:
- ad-hoc upscaling
- t2i w/ sd1.5
- t2i w/ sd1.5 & hrf
- t2i w/ sdxl
- t2i w/ sdxl + refiner
- i2i w/ sd1.5
- i2i w/ sdxl
- i2i w/ sdxl + refiner
- canvas t2i w/ sd1.5
- canvas t2i w/ sdxl
- canvas t2i w/ sdxl + refiner
- canvas i2i w/ sd1.5
- canvas i2i w/ sdxl
- canvas i2i w/ sdxl + refiner
- canvas inpaint w/ sd1.5
- canvas inpaint w/ sdxl
- canvas inpaint w/ sdxl + refiner
- canvas outpaint w/ sd1.5
- canvas outpaint w/ sdxl
- canvas outpaint w/ sdxl + refiner
2024-02-29 13:16:36 -05:00
psychedelicious
c16f77bb23 chore(ui): regen types 2024-02-29 13:16:36 -05:00
psychedelicious
1e4b953ccd feat(nodes): add WithBoard field helper class
This class works the same way as `WithMetadata` - it simply adds a `board` field to the node. The context wrapper function is able to pull the board id from this. This allows image-outputting nodes to get a board field "for free", and have their outputs automatically saved to it.

This is a breaking change for node authors who may have a field called `board`, because it makes `board` a reserved field name. I'll look into how to avoid this - maybe by naming this invoke-managed field `_board` to avoid collisions?

Supporting changes:
- `WithBoard` is added to all image-outputting nodes, giving them the ability to save to board.
- Unused, duplicate `WithMetadata` and `WithWorkflow` classes are deleted from `baseinvocation.py`. The "real" versions are in `fields.py`.
- Remove `LinearUIOutputInvocation`. Now that all nodes that output images also have a `board` field by default, this node is no longer necessary. See comment here for context: https://github.com/invoke-ai/InvokeAI/pull/5491#discussion_r1480760629
- Without `LinearUIOutputInvocation`, the `ImagesInferface.update` method is no longer needed, and removed.

Note: This commit does not bump all node versions. I will ensure that is done correctly before merging the PR of which this commit is a part.

Note: A followup commit will implement the frontend changes to support this change.
2024-02-29 13:16:36 -05:00
psychedelicious
d6ce901ad2 remove unused configdict import 2024-02-29 13:16:36 -05:00
psychedelicious
060038a8c0 fix(ui): remove original l2i node in HRF graph 2024-02-29 13:16:36 -05:00
psychedelicious
e38d275e20 fix(nodes): do not freeze or cache config in context wrapper
- The config is already cached by the config class's `get_config()` method.
- The config mutates itself in its `root_path` property getter. Freezing the class makes any attempt to grab a path from the config error. Unfortunately this means we cannot easily freeze the class without fiddling with the inner workings of `InvokeAIAppConfig`, which is outside the scope here.
2024-02-29 13:16:36 -05:00
psychedelicious
3fea7a6f00 feat(nodes): context.data -> context._data 2024-02-29 13:16:36 -05:00
psychedelicious
57ae23b222 feat(nodes): context.__services -> context._services 2024-02-29 13:16:36 -05:00
psychedelicious
10a4f1df8a feat(nodes): cache invocation interface config 2024-02-29 13:16:36 -05:00
psychedelicious
0fde0d1ff7 feat(nodes): do not hide services in invocation context interfaces 2024-02-29 13:16:36 -05:00
psychedelicious
0ff466ebc4 fix(nodes): restore missing context type annotations 2024-02-29 13:16:36 -05:00
psychedelicious
c3bfb4a38f tests(nodes): fix mock InvocationContext 2024-02-29 13:16:36 -05:00
psychedelicious
a976130899 chore(nodes): add comments for ConfigInterface 2024-02-29 13:16:36 -05:00
psychedelicious
fcfc0c9a94 feat(nodes): export more things from `invocation_api" 2024-02-29 13:16:36 -05:00
psychedelicious
42c99efddf feat(nodes): add boards interface to invocation context 2024-02-29 13:16:36 -05:00
psychedelicious
87d28b2519 fix(nodes): restore type annotations for InvocationContext 2024-02-29 13:16:36 -05:00
psychedelicious
e600f495a2 feat(nodes): do not freeze InvocationContextData, prevents it from being subclassesd 2024-02-29 13:16:36 -05:00
psychedelicious
e4bf66ef5b feat: tweak pyright config 2024-02-29 13:16:36 -05:00
psychedelicious
4e266e7466 feat(nodes): create invocation_api.py
This is the public API for invocations.

Everything a custom node might need should be re-exported from this file.
2024-02-29 13:16:36 -05:00
psychedelicious
26b17d778d feat(nodes): move ConditioningFieldData to conditioning_data.py 2024-02-29 13:16:35 -05:00
psychedelicious
1ca6c0798f tests: fix missing arg for InvocationContext 2024-02-29 13:16:35 -05:00
psychedelicious
2515a2dffd feat(nodes): restore previous invocation context methods with deprecation warnings 2024-02-29 13:16:35 -05:00
psychedelicious
cc4a4f1275 chore: ruff 2024-02-29 13:16:35 -05:00
psychedelicious
c58951dfcc feat(nodes): tidy invocation_context.py, improve comments 2024-02-29 13:16:35 -05:00
psychedelicious
8dc1207790 tests: fix tests for new invocation context 2024-02-29 13:16:35 -05:00
psychedelicious
248176604f docs: update INVOCATIONS.md 2024-02-29 13:16:35 -05:00
psychedelicious
2254a0c078 feat(nodes): update all invocations to use new invocation context
Update all invocations to use the new context. The changes are all fairly simple, but there are a lot of them.

Supporting minor changes:
- Patch bump for all nodes that use the context
- Update invocation processor to provide new context
- Minor change to `EventServiceBase` to accept a node's ID instead of the dict version of a node
- Minor change to `ModelManagerService` to support the new wrapped context
- Fanagling of imports to avoid circular dependencies
2024-02-29 13:16:35 -05:00
psychedelicious
ff30ec4746 feat: add pyright config
I was having issues with mypy bother over- and under-reporting certain problems. I've added a pyright config.
2024-02-29 13:16:35 -05:00
psychedelicious
7657c361a3 feat(nodes): restricts invocation context power
Creates a low-power `InvocationContext` with simplified methods and data.

See `invocation_context.py` for detailed comments.
2024-02-29 13:16:35 -05:00
psychedelicious
c3f0d2e273 tidy(nodes): move all field things to fields.py
Unfortunately, this is necessary to prevent circular imports at runtime.
2024-02-29 13:16:35 -05:00
Васянатор
63ab5ff5a2 translationBot(ui): update translation (Russian)
Currently translated at 98.3% (1398 of 1422 strings)

Co-authored-by: Васянатор <ilabulanov339@gmail.com>
Translate-URL: https://hosted.weblate.org/projects/invokeai/web-ui/ru/
Translation: InvokeAI/Web UI
2024-02-29 23:27:36 +11:00
Samantha Morello
9a8a9c5848 translationBot(ui): update translation (Italian)
Currently translated at 98.0% (1441 of 1470 strings)

Co-authored-by: Samantha Morello <tildsart@gmail.com>
Translate-URL: https://hosted.weblate.org/projects/invokeai/web-ui/it/
Translation: InvokeAI/Web UI
2024-02-29 23:27:36 +11:00
Alexander Eichhorn
1a3ffb6e94 translationBot(ui): update translation (German)
Currently translated at 80.4% (1183 of 1470 strings)

Co-authored-by: Alexander Eichhorn <pfannkuchensack@einfach-doof.de>
Translate-URL: https://hosted.weblate.org/projects/invokeai/web-ui/de/
Translation: InvokeAI/Web UI
2024-02-29 23:27:36 +11:00
skunkworxdark
3a09bceea4 Update communityNodes.md
Updated description of metadata nodes
2024-02-26 14:20:09 -05:00
Riccardo Giovanetti
2ec6b51d8b translationBot(ui): update translation (Italian)
Currently translated at 97.2% (1430 of 1470 strings)

Co-authored-by: Riccardo Giovanetti <riccardo.giovanetti@gmail.com>
Translate-URL: https://hosted.weblate.org/projects/invokeai/web-ui/it/
Translation: InvokeAI/Web UI
2024-02-26 17:41:00 +11:00
B N
34b0ea20dc translationBot(ui): update translation (German)
Currently translated at 80.3% (1181 of 1470 strings)

translationBot(ui): update translation (German)

Currently translated at 80.1% (1178 of 1470 strings)

Co-authored-by: B N <berndnieschalk@gmail.com>
Translate-URL: https://hosted.weblate.org/projects/invokeai/web-ui/de/
Translation: InvokeAI/Web UI
2024-02-26 17:41:00 +11:00
Alexander Eichhorn
9986fce1a6 translationBot(ui): update translation (German)
Currently translated at 80.0% (1176 of 1470 strings)

Co-authored-by: Alexander Eichhorn <pfannkuchensack@einfach-doof.de>
Translate-URL: https://hosted.weblate.org/projects/invokeai/web-ui/de/
Translation: InvokeAI/Web UI
2024-02-23 07:57:15 +11:00