-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
032bb26
commit bc654d3
Showing
8 changed files
with
122 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
from typing import Any | ||
|
||
nodes: dict[str, Any] = {} | ||
'''A dict of loaded nodes keyed by their raw names. Compared to `comfy_script.runtime.nodes` module, `nodes` is more suitable for programmatic access. | ||
Example: | ||
``` | ||
from comfy_script.runtime import * | ||
load() | ||
print(node.nodes) | ||
# {'KSampler': <Node KSampler>, | ||
# 'CheckpointLoaderSimple': <Node CheckpointLoaderSimple>, | ||
# 'CLIPTextEncode': <Node CLIPTextEncode>, | ||
# ... | ||
# or: node.get('CheckpointLoaderSimple') | ||
loader = node.nodes['CheckpointLoaderSimple'] | ||
model, clip, vae = loader('v1-5-pruned-emaonly.ckpt') | ||
``` | ||
With type hint: | ||
``` | ||
from comfy_script.runtime.nodes import CheckpointLoaderSimple | ||
loader: type[CheckpointLoaderSimple] = node.nodes['CheckpointLoaderSimple'] | ||
model, clip, vae = loader('v1-5-pruned-emaonly.ckpt') | ||
``` | ||
With compile-time-only type hint: | ||
``` | ||
from typing import TYPE_CHECKING | ||
if TYPE_CHECKING: | ||
from comfy_script.runtime.nodes import CheckpointLoaderSimple | ||
loader: 'type[CheckpointLoaderSimple]' = node.nodes['CheckpointLoaderSimple'] | ||
model, clip, vae = loader('v1-5-pruned-emaonly.ckpt') | ||
``` | ||
''' | ||
|
||
def get(name: str) -> Any | None: | ||
return nodes.get(name, None) | ||
|
||
__all__ = [ | ||
'nodes', | ||
'get' | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
from typing import Any | ||
|
||
nodes: dict[str, Any] = {} | ||
'''A dict of loaded nodes keyed by their raw names. Compared to `comfy_script.runtime.real.nodes` module, `nodes` is more suitable for programmatic access. | ||
Example: | ||
``` | ||
from comfy_script.runtime.real import * | ||
load() | ||
print(node.nodes) | ||
# {'KSampler': <Node KSampler>, | ||
# 'CheckpointLoaderSimple': <Node CheckpointLoaderSimple>, | ||
# 'CLIPTextEncode': <Node CLIPTextEncode>, | ||
# ... | ||
# or: node.get('CheckpointLoaderSimple') | ||
loader = node.nodes['CheckpointLoaderSimple'] | ||
model, clip, vae = loader('v1-5-pruned-emaonly.ckpt') | ||
``` | ||
With type hint: | ||
``` | ||
from comfy_script.runtime.real.nodes import CheckpointLoaderSimple | ||
loader: type[CheckpointLoaderSimple] = node.nodes['CheckpointLoaderSimple'] | ||
model, clip, vae = loader('v1-5-pruned-emaonly.ckpt') | ||
``` | ||
With compile-time-only type hint: | ||
``` | ||
from typing import TYPE_CHECKING | ||
if TYPE_CHECKING: | ||
from comfy_script.runtime.real.nodes import CheckpointLoaderSimple | ||
loader: 'type[CheckpointLoaderSimple]' = node.nodes['CheckpointLoaderSimple'] | ||
model, clip, vae = loader('v1-5-pruned-emaonly.ckpt') | ||
``` | ||
''' | ||
|
||
def get(name: str) -> Any | None: | ||
return nodes.get(name, None) | ||
|
||
__all__ = [ | ||
'nodes', | ||
'get' | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters