Skip to content

AssertionError when using load() in example notebook #9

@KaijuML

Description

@KaijuML

Hey, thanks very much for your work, it looks awesome.

I hit an error, when trying to make the example notebook runtime.ipynb work:

from script.runtime import *

load()
Click here to see the error stack trace
Nodes: 529
---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
Cell In[1], line 4
      1 from script.runtime import *
      3 # load('http://127.0.0.1:8188/')
----> 4 load()
      6 # Nodes can only be imported after load()
      7 from script.runtime.nodes import *

File /mnt/c/Users/clementr/Projects/stablediffusion/ComfyUI/custom_nodes/ComfyScript/script/runtime/__init__.py:18, in load(api_endpoint, vars, watch, save_script_source)
     17 def load(api_endpoint: str = 'http://127.0.0.1:8188/', vars: dict | None = None, watch: bool = True, save_script_source: bool = True):
---> 18     asyncio.run(_load(api_endpoint, vars, watch, save_script_source))

File ~/miniconda3/envs/comfyui/lib/python3.10/site-packages/nest_asyncio.py:30, in _patch_asyncio.<locals>.run(main, debug)
     28 task = asyncio.ensure_future(main)
     29 try:
---> 30     return loop.run_until_complete(task)
     31 finally:
     32     if not task.done():

File ~/miniconda3/envs/comfyui/lib/python3.10/site-packages/nest_asyncio.py:98, in _patch_loop.<locals>.run_until_complete(self, future)
     95 if not f.done():
     96     raise RuntimeError(
     97         'Event loop stopped before Future completed.')
---> 98 return f.result()

File ~/miniconda3/envs/comfyui/lib/python3.10/asyncio/futures.py:201, in Future.result(self)
    199 self.__log_traceback = False
    200 if self._exception is not None:
--> 201     raise self._exception.with_traceback(self._exception_tb)
    202 return self._result

File ~/miniconda3/envs/comfyui/lib/python3.10/asyncio/tasks.py:232, in Task.__step(***failed resolving arguments***)
    228 try:
    229     if exc is None:
    230         # We use the `send` method directly, because coroutines
    231         # don't have `__iter__` and `__next__` methods.
--> 232         result = coro.send(None)
    233     else:
    234         result = coro.throw(exc)

File /mnt/c/Users/clementr/Projects/stablediffusion/ComfyUI/custom_nodes/ComfyScript/script/runtime/__init__.py:29, in _load(api_endpoint, vars, watch, save_script_source)
     26 nodes_info = await api._get_nodes_info()
     27 print(f'Nodes: {len(nodes_info)}')
---> 29 nodes.load(nodes_info, vars)
     31 # TODO: Stop watch if watch turns to False
     32 if watch:

File /mnt/c/Users/clementr/Projects/stablediffusion/ComfyUI/custom_nodes/ComfyScript/script/runtime/nodes.py:14, in load(nodes_info, vars)
     12 fact = VirtualRuntimeFactory()
     13 for node_info in nodes_info.values():
---> 14     fact.add_node(node_info)
     16 globals().update(fact.vars())
     17 __all__.extend(fact.vars().keys())

File /mnt/c/Users/clementr/Projects/stablediffusion/ComfyUI/custom_nodes/ComfyScript/script/runtime/factory.py:218, in RuntimeFactory.add_node(self, info)
    215                 config = {}
    216         inputs.append(f'{name}: {type_and_hint(type_info, name, optional, config.get("default"))[1]}')
--> 218 output_types = [type_and_hint(type, output=True)[0] for type in info['output']]
    220 outputs = len(info['output'])
    221 if outputs >= 2:

File /mnt/c/Users/clementr/Projects/stablediffusion/ComfyUI/custom_nodes/ComfyScript/script/runtime/factory.py:218, in <listcomp>(.0)
    215                 config = {}
    216         inputs.append(f'{name}: {type_and_hint(type_info, name, optional, config.get("default"))[1]}')
--> 218 output_types = [type_and_hint(type, output=True)[0] for type in info['output']]
    220 outputs = len(info['output'])
    221 if outputs >= 2:

File /mnt/c/Users/clementr/Projects/stablediffusion/ComfyUI/custom_nodes/ComfyScript/script/runtime/factory.py:117, in RuntimeFactory.add_node.<locals>.type_and_hint(type_info, name, optional, default, output)
    115 if isinstance(type_info, list):
    116     if output: print(type_info)
--> 117     assert not output
    118     if is_bool_enum(type_info):
    119         t = bool

AssertionError: 

From what i can tell, everything looks ok, my comfyui is running and works correctly.

When I investigate a bit i can add a line to script/runtime/factory.py>RuntimeFactory>add_node (at line L116):

[...]
L115            if isinstance(type_info, list):
L116                if output: print(type_info)
L117                assert not output
[...]

and i get the following list being printed, which appears to be the models i have downloaded from civitai

['cyberrealistic_v41BackToBasics.safetensors', 'dreamshaper_8.safetensors', 'realisticVisionV60B1_v20Novae.safetensors']

I don't understand the code enough to debug further, could you help me please?

Thanks very much,
Clement

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingruntime

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions