Skip to content

Error; failed to get source using inspect.getsouce #91

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
sl33pyC01E opened this issue Oct 30, 2024 · 0 comments
Open

Error; failed to get source using inspect.getsouce #91

sl33pyC01E opened this issue Oct 30, 2024 · 0 comments

Comments

@sl33pyC01E
Copy link

GroundingDinoSAM2Segment (segment anything2)
Failed to get source for <function Enum.generate_next_value at 0x000002E4B01EEE80> using inspect.getsource

OSError: could not get source code

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\forre\OneDrive\Documents\ComfyUI_windows_portable\ComfyUI\execution.py", line 323, in execute
    output_data, output_ui, has_subgraph = get_output_data(obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\forre\OneDrive\Documents\ComfyUI_windows_portable\ComfyUI\execution.py", line 198, in get_output_data
    return_values = _map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\forre\OneDrive\Documents\ComfyUI_windows_portable\ComfyUI\execution.py", line 169, in _map_node_over_list
    process_inputs(input_dict, i)
  File "C:\Users\forre\OneDrive\Documents\ComfyUI_windows_portable\ComfyUI\execution.py", line 158, in process_inputs
    results.append(getattr(obj, func)(**inputs))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\forre\OneDrive\Documents\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-SAM2\node.py", line 323, in main
    (images, masks) = sam_segment(
                      ^^^^^^^^^^^^
  File "C:\Users\forre\OneDrive\Documents\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-SAM2\node.py", line 236, in sam_segment
    predictor = SAM2ImagePredictor(sam_model)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\forre\OneDrive\Documents\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-SAM2\sam2\sam2_image_predictor.py", line 41, in __init__
    self._transforms = SAM2Transforms(
                       ^^^^^^^^^^^^^^^
  File "C:\Users\forre\OneDrive\Documents\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-SAM2\sam2\utils\transforms.py", line 28, in __init__
    self.transforms = torch.jit.script(
                      ^^^^^^^^^^^^^^^^^
  File "C:\Users\forre\OneDrive\Documents\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\jit\_script.py", line 1429, in script
    ret = _script_impl(
          ^^^^^^^^^^^^^
  File "C:\Users\forre\OneDrive\Documents\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\jit\_script.py", line 1147, in _script_impl
    return torch.jit._recursive.create_script_module(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\forre\OneDrive\Documents\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\jit\_recursive.py", line 554, in create_script_module
    concrete_type = get_module_concrete_type(nn_module, share_types)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\forre\OneDrive\Documents\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\jit\_recursive.py", line 503, in get_module_concrete_type
    concrete_type = concrete_type_store.get_or_create_concrete_type(nn_module)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\forre\OneDrive\Documents\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\jit\_recursive.py", line 435, in get_or_create_concrete_type
    concrete_type_builder = infer_concrete_type_builder(nn_module)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\forre\OneDrive\Documents\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\jit\_recursive.py", line 285, in infer_concrete_type_builder
    sub_concrete_type = get_module_concrete_type(item, share_types)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\forre\OneDrive\Documents\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\jit\_recursive.py", line 503, in get_module_concrete_type
    concrete_type = concrete_type_store.get_or_create_concrete_type(nn_module)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\forre\OneDrive\Documents\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\jit\_recursive.py", line 435, in get_or_create_concrete_type
    concrete_type_builder = infer_concrete_type_builder(nn_module)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\forre\OneDrive\Documents\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\jit\_recursive.py", line 395, in infer_concrete_type_builder
    attr_type, inferred = infer_type(name, value)
                          ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\forre\OneDrive\Documents\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\jit\_recursive.py", line 235, in infer_type
    attr_type = torch._C._jit_try_infer_type(item)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\forre\OneDrive\Documents\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\jit\annotations.py", line 492, in try_ann_to_type
    scripted_class = torch.jit._script._recursive_compile_class(ann, loc)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\forre\OneDrive\Documents\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\jit\_script.py", line 1604, in _recursive_compile_class
    rcb = _jit_internal.createResolutionCallbackForClassMethods(obj)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\forre\OneDrive\Documents\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\_jit_internal.py", line 588, in createResolutionCallbackForClassMethods
    captures.update(get_type_hint_captures(fn))
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\forre\OneDrive\Documents\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\_jit_internal.py", line 502, in get_type_hint_captures
    raise OSError(
OSError: Failed to get source for <function Enum._generate_next_value_ at 0x000002E4B01EEE80> using inspect.getsource

2024-10-30 19:11:05,935 - root - INFO - Prompt executed in 0.32 seconds
2024-10-30 19:11:17,164 - root - INFO - got prompt
2024-10-30 19:11:18,923 - root - ERROR - !!! Exception during processing !!! Failed to get source for <function Enum._generate_next_value_ at 0x000002E4B01EEE80> using inspect.getsource
2024-10-30 19:11:18,924 - root - ERROR - Traceback (most recent call last):
  File "C:\Users\forre\OneDrive\Documents\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\_jit_internal.py", line 500, in get_type_hint_captures
    src = inspect.getsource(fn)
          ^^^^^^^^^^^^^^^^^^^^^
  File "inspect.py", line 1262, in getsource
  File "inspect.py", line 1244, in getsourcelines
  File "inspect.py", line 1081, in findsource
OSError: could not get source code

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\forre\OneDrive\Documents\ComfyUI_windows_portable\ComfyUI\execution.py", line 323, in execute
    output_data, output_ui, has_subgraph = get_output_data(obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\forre\OneDrive\Documents\ComfyUI_windows_portable\ComfyUI\execution.py", line 198, in get_output_data
    return_values = _map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\forre\OneDrive\Documents\ComfyUI_windows_portable\ComfyUI\execution.py", line 169, in _map_node_over_list
    process_inputs(input_dict, i)
  File "C:\Users\forre\OneDrive\Documents\ComfyUI_windows_portable\ComfyUI\execution.py", line 158, in process_inputs
    results.append(getattr(obj, func)(**inputs))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\forre\OneDrive\Documents\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-SAM2\node.py", line 323, in main
    (images, masks) = sam_segment(
                      ^^^^^^^^^^^^
  File "C:\Users\forre\OneDrive\Documents\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-SAM2\node.py", line 236, in sam_segment
    predictor = SAM2ImagePredictor(sam_model)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\forre\OneDrive\Documents\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-SAM2\sam2\sam2_image_predictor.py", line 41, in __init__
    self._transforms = SAM2Transforms(
                       ^^^^^^^^^^^^^^^
  File "C:\Users\forre\OneDrive\Documents\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-SAM2\sam2\utils\transforms.py", line 28, in __init__
    self.transforms = torch.jit.script(
                      ^^^^^^^^^^^^^^^^^
  File "C:\Users\forre\OneDrive\Documents\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\jit\_script.py", line 1429, in script
    ret = _script_impl(
          ^^^^^^^^^^^^^
  File "C:\Users\forre\OneDrive\Documents\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\jit\_script.py", line 1147, in _script_impl
    return torch.jit._recursive.create_script_module(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\forre\OneDrive\Documents\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\jit\_recursive.py", line 554, in create_script_module
    concrete_type = get_module_concrete_type(nn_module, share_types)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\forre\OneDrive\Documents\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\jit\_recursive.py", line 503, in get_module_concrete_type
    concrete_type = concrete_type_store.get_or_create_concrete_type(nn_module)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\forre\OneDrive\Documents\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\jit\_recursive.py", line 435, in get_or_create_concrete_type
    concrete_type_builder = infer_concrete_type_builder(nn_module)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\forre\OneDrive\Documents\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\jit\_recursive.py", line 285, in infer_concrete_type_builder
    sub_concrete_type = get_module_concrete_type(item, share_types)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\forre\OneDrive\Documents\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\jit\_recursive.py", line 503, in get_module_concrete_type
    concrete_type = concrete_type_store.get_or_create_concrete_type(nn_module)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\forre\OneDrive\Documents\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\jit\_recursive.py", line 435, in get_or_create_concrete_type
    concrete_type_builder = infer_concrete_type_builder(nn_module)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\forre\OneDrive\Documents\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\jit\_recursive.py", line 395, in infer_concrete_type_builder
    attr_type, inferred = infer_type(name, value)
                          ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\forre\OneDrive\Documents\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\jit\_recursive.py", line 235, in infer_type
    attr_type = torch._C._jit_try_infer_type(item)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\forre\OneDrive\Documents\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\jit\annotations.py", line 492, in try_ann_to_type
    scripted_class = torch.jit._script._recursive_compile_class(ann, loc)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\forre\OneDrive\Documents\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\jit\_script.py", line 1604, in _recursive_compile_class
    rcb = _jit_internal.createResolutionCallbackForClassMethods(obj)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\forre\OneDrive\Documents\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\_jit_internal.py", line 588, in createResolutionCallbackForClassMethods
    captures.update(get_type_hint_captures(fn))
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\forre\OneDrive\Documents\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\_jit_internal.py", line 502, in get_type_hint_captures
    raise OSError(
OSError: Failed to get source for <function Enum._generate_next_value_ at 0x000002E4B01EEE80> using inspect.getsource

2024-10-30 19:11:18,926 - root - INFO - Prompt executed in 1.73 seconds

Attached Workflow

Please make sure that workflow does not contain any sensitive information such as API keys or passwords.

{"last_node_id":28,"last_link_id":13,"nodes":[{"id":27,"type":"LoadImage","pos":{"0":552,"1":300},"size":[315,314],"flags":{},"order":0,"mode":0,"inputs":[],"outputs":[{"name":"IMAGE","type":"IMAGE","links":[12],"slot_index":0},{"name":"MASK","type":"MASK","links":null}],"properties":{"Node name for S&R":"LoadImage"},"widgets_values":["0c3de037-ac45-4536-8d07-0197863d63c1.png","image"]},{"id":28,"type":"PreviewImage","pos":{"0":1355.451171875,"1":779.4844970703125},"size":[210,246],"flags":{},"order":5,"mode":0,"inputs":[{"name":"images","type":"IMAGE","link":13}],"outputs":[],"properties":{"Node name for S&R":"PreviewImage"}},{"id":25,"type":"SAM2ModelLoader (segment anything2)","pos":{"0":1283,"1":293},"size":[294,58],"flags":{},"order":1,"mode":0,"inputs":[],"outputs":[{"name":"SAM2_MODEL","type":"SAM2_MODEL","links":[8],"slot_index":0}],"properties":{"Node name for S&R":"SAM2ModelLoader (segment anything2)"},"widgets_values":["sam2_hiera_large.pt"]},{"id":21,"type":"ImageResizeKJ","pos":{"0":888,"1":295},"size":{"0":315,"1":266},"flags":{},"order":3,"mode":0,"inputs":[{"name":"image","type":"IMAGE","link":12},{"name":"get_image_size","type":"IMAGE","link":null,"shape":7},{"name":"width_input","type":"INT","link":null,"widget":{"name":"width_input"},"shape":7},{"name":"height_input","type":"INT","link":null,"widget":{"name":"height_input"},"shape":7}],"outputs":[{"name":"IMAGE","type":"IMAGE","links":[11],"slot_index":0,"shape":3},{"name":"width","type":"INT","links":null,"shape":3},{"name":"height","type":"INT","links":null,"shape":3}],"properties":{"Node name for S&R":"ImageResizeKJ"},"widgets_values":[1024,1024,"lanczos",true,2,0,0,"disabled"]},{"id":24,"type":"GroundingDinoSAM2Segment (segment anything2)","pos":{"0":1969,"1":466},"size":{"0":554.4000244140625,"1":122},"flags":{},"order":4,"mode":0,"inputs":[{"name":"sam_model","type":"SAM2_MODEL","link":8},{"name":"grounding_dino_model","type":"GROUNDING_DINO_MODEL","link":7},{"name":"image","type":"IMAGE","link":11}],"outputs":[{"name":"IMAGE","type":"IMAGE","links":[13],"slot_index":0},{"name":"MASK","type":"MASK","links":null}],"properties":{"Node name for S&R":"GroundingDinoSAM2Segment (segment anything2)"},"widgets_values":["face",0.5]},{"id":23,"type":"GroundingDinoModelLoader (segment anything2)","pos":{"0":1288,"1":390},"size":[369.6000061035156,58],"flags":{},"order":2,"mode":0,"inputs":[],"outputs":[{"name":"GROUNDING_DINO_MODEL","type":"GROUNDING_DINO_MODEL","links":[7],"slot_index":0}],"properties":{"Node name for S&R":"GroundingDinoModelLoader (segment anything2)"},"widgets_values":["GroundingDINO_SwinB (938MB)"]}],"links":[[7,23,0,24,1,"GROUNDING_DINO_MODEL"],[8,25,0,24,0,"SAM2_MODEL"],[11,21,0,24,2,"IMAGE"],[12,27,0,21,0,"IMAGE"],[13,24,0,28,0,"IMAGE"]],"groups":[],"config":{},"extra":{"ds":{"scale":0.620921323059155,"offset":[-150.78966300000098,231.91578100000024]}},"version":0.4}
## Additional Context
(Please add any additional context or steps to reproduce the error here)
the workflow can run with no prompt or a prompt that isn't detected. However, if an object is detected, the pipe fails.

I have recently fully updated my ComfyUI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant