InvokeAI/invokeai/app/services/shared
psychedelicious d20f98fb4f fix(nodes): deep copy graph inputs
The change to memory session storage brings a subtle behaviour change.

Previously, we serialized and deserialized everything (e.g. field state, invocation outputs, etc) constantly. The meant we were effectively working with deep-copied objects at all time. We could mutate objects freely without worrying about other references to the object.

With memory storage, objects are now passed around by reference, and we cannot handle them in the same way.

This is problematic for nodes that mutate their own inputs. There are two ways this causes a problem:

- An output is used as input for multiple nodes. If the first node mutates the output object while `invoke`ing, the next node will get the mutated object.
- The invocation cache stores live python objects. When a node mutates an output pulled from the cache, the next node that uses the cached object will get the mutated object.

The solution is to deep-copy a node's inputs as they are set, effectively reproducing the same behaviour as we had with the SQLite session storage. Nodes can safely mutate their inputs and those changes never leave the node's scope.

Closes  #5665
2024-02-09 21:17:32 +11:00
..
sqlite tidy(migrator): remove logic to check if graph_executions exists in migration 5 2024-02-02 09:20:41 +11:00
sqlite_migrator Port the command-line tools to use model_manager2 (#5546) 2024-02-02 17:18:47 +00:00
__init__.py feat(backend): organise service dependencies 2023-10-12 12:15:06 -04:00
default_graphs.py chore: ruff check - fix flake8-comprensions 2023-11-11 10:55:23 +11:00
graph.py fix(nodes): deep copy graph inputs 2024-02-09 21:17:32 +11:00
pagination.py feat(api): chore: pydantic & fastapi upgrade 2023-10-17 14:59:25 +11:00