mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-01-14 15:57:59 -05:00
- We don't need to copy the init file. Just crawl the custom nodes dir for modules and import them all. Dunno why I didn't do this initially. - Pass the logger in as an arg. There was a race condition where if we got the logger directly in the load_custom_nodes function, the config would not have been loaded fully yet and we'd end up with the wrong custom nodes path! - Remove permissions-setting logic, I do not believe it is relevant for custom nodes - Minor cleanup of the utility
Custom Nodes / Node Packs
Copy your node packs to this directory.
When nodes are added or changed, you must restart the app to see the changes.
Directory Structure
For a node pack to be loaded, it must be placed in a directory alongside this file. Here's an example structure:
.
├── __init__.py # Invoke-managed custom node loader
│
├── cool_node
│ ├── __init__.py # see example below
│ └── cool_node.py
│
└── my_node_pack
├── __init__.py # see example below
├── tasty_node.py
├── bodacious_node.py
├── utils.py
└── extra_nodes
└── fancy_node.py
Node Pack __init__.py
Each node pack must have an __init__.py file that imports its nodes.
The structure of each node or node pack is otherwise not important.
Here are examples, based on the example directory structure.
cool_node/__init__.py
from .cool_node import CoolInvocation
my_node_pack/__init__.py
from .tasty_node import TastyInvocation
from .bodacious_node import BodaciousInvocation
from .extra_nodes.fancy_node import FancyInvocation
Only nodes imported in the __init__.py file are loaded.