neverbiasu / ComfyUI-SAM2

A ComfyUI extension for Segment-Anything 2
46 stars 9 forks source link

'ImageEncoder' object has no attribute 'img_size' #7

Open windthunder opened 1 month ago

windthunder commented 1 month ago

圖片

If I use a prompt like horse, an error will be reported, but if I use something like cat that does not exist on the screen, a whole black picture will be output normally.

Trace:

!!! Exception during processing!!! 'ImageEncoder' object has no attribute 'img_size'
Traceback (most recent call last):
  File "C:\Users\User\Desktop\ComfyUI\execution.py", line 152, in recursive_execute
    output_data, output_ui = get_output_data(obj, input_data_all)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User\Desktop\ComfyUI\execution.py", line 82, in get_output_data
    return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User\Desktop\ComfyUI\execution.py", line 75, in map_node_over_list
    results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User\Desktop\ComfyUI\custom_nodes\comfyui_segment_anything\node.py", line 325, in main
    (images, masks) = sam_segment(
                      ^^^^^^^^^^^^
  File "C:\Users\User\Desktop\ComfyUI\custom_nodes\comfyui_segment_anything\node.py", line 240, in sam_segment
    predictor = SamPredictorHQ(sam_model, sam_is_hq)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User\Desktop\ComfyUI\custom_nodes\comfyui_segment_anything\sam_hq\predictor.py", line 22, in __init__
    super().__init__(sam_model=sam_model)
  File "C:\Users\User\AppData\Local\Programs\Python\Python312\Lib\site-packages\segment_anything\predictor.py", line 31, in __init__
    self.transform = ResizeLongestSide(sam_model.image_encoder.img_size)
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User\AppData\Local\Programs\Python\Python312\Lib\site-packages\torch\nn\modules\module.py", line 1729, in __getattr__
    raise AttributeError(f"'{type(self).__name__}' object has no attribute '{name}'")
AttributeError: 'ImageEncoder' object has no attribute 'img_size'
dhrumil-unada commented 1 month ago

i have the same error while i'm using the simple SAMModelLoader, and when i switch to SAM2ModelLoader i get this error



No available kernel. Aborting execution.

File "/workspace/ComfyUI/execution.py", line 152, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
File "/workspace/ComfyUI/execution.py", line 82, in get_output_data
return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
File "/workspace/ComfyUI/execution.py", line 75, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
File "/workspace/ComfyUI/custom_nodes/ComfyUI-SAM2/node.py", line 311, in main
(images, masks) = sam_segment(
File "/workspace/ComfyUI/custom_nodes/ComfyUI-SAM2/node.py", line 231, in sam_segment
masks, scores, _ = predictor.predict(
File "/workspace/ComfyUI/custom_nodes/ComfyUI-SAM2/sam2/sam2_image_predictor.py", line 271, in predict
masks, iou_predictions, low_res_masks = self._predict(
File "/venv/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
return func(*args, **kwargs)
File "/workspace/ComfyUI/custom_nodes/ComfyUI-SAM2/sam2/sam2_image_predictor.py", line 400, in _predict
low_res_masks, iou_predictions, _, _ = self.model.sam_mask_decoder(
File "/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1562, in _call_impl
return forward_call(*args, **kwargs)
File "/workspace/ComfyUI/custom_nodes/ComfyUI-SAM2/sam2/modeling/sam/mask_decoder.py", line 136, in forward
masks, iou_pred, mask_tokens_out, object_score_logits = self.predict_masks(
File "/workspace/ComfyUI/custom_nodes/ComfyUI-SAM2/sam2/modeling/sam/mask_decoder.py", line 213, in predict_masks
hs, src = self.transformer(src, pos_src, tokens)
File "/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1562, in _call_impl
return forward_call(*args, **kwargs)
File "/workspace/ComfyUI/custom_nodes/ComfyUI-SAM2/sam2/modeling/sam/transformer.py", line 101, in forward
queries, keys = layer(
File "/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1562, in _call_impl
return forward_call(*args, **kwargs)
File "/workspace/ComfyUI/custom_nodes/ComfyUI-SAM2/sam2/modeling/sam/transformer.py", line 167, in forward
queries = self.self_attn(q=queries, k=queries, v=queries)
File "/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1562, in _call_impl
return forward_call(*args, **kwargs)
File "/workspace/ComfyUI/custom_nodes/ComfyUI-SAM2/sam2/modeling/sam/transformer.py", line 255, in forward
out = F.scaled_dot_product_attention(q, k, v, dropout_p=dropout_p)```
neverbiasu commented 1 month ago

@windthunder The error u reported is from comfyui-segement-anything nodes.

neverbiasu commented 1 month ago

@dhrumil-unada U should check the torch version and whether compatible with CUDA version.

windthunder commented 1 month ago

@windthunder The error u reported is from comfyui-segement-anything nodes.

圖片 If I use SAM1, I can output normally, so I still put this question here.

neverbiasu commented 1 month ago

@windthunder I mean the error came from comfyui-segement-anything, which remind me I need to make ComfyUI-SAM2's node name different from comfyui-segement-anything.

kakaxixx commented 1 month ago

'ImageEncoder' object has no attribute 'img_size'

srgGH69 commented 1 month ago

is there no solution to this problem?

neverbiasu commented 1 month ago

using git clone https://github.com/neverbiasu/ComfyUI-SAM2 to install this node in custom_nodes folder.

gabrielhrr commented 1 month ago

using git clone https://github.com/neverbiasu/ComfyUI-SAM2 to install this node in custom_nodes folder.

it didn't work here, still with the error

image

gabrielhrr commented 1 month ago

image this is the error if i disable segment anything and keep only SAM2

LeoMusk commented 1 month ago

same+1

neverbiasu commented 1 month ago

image this is the error if i disable segment anything and keep only SAM2

Could u provide the complete error.

gabrielhrr commented 1 month ago
!!! Exception during processing!!! could not get source code
Traceback (most recent call last):
  File "D:\gabriel\Nova Instalacao ComfyUI\ComfyUI_windows_portable\ComfyUI\execution.py", line 152, in recursive_execute
    output_data, output_ui = get_output_data(obj, input_data_all)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\gabriel\Nova Instalacao ComfyUI\ComfyUI_windows_portable\ComfyUI\execution.py", line 82, in get_output_data
    return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\gabriel\Nova Instalacao ComfyUI\ComfyUI_windows_portable\ComfyUI\execution.py", line 75, in map_node_over_list
    results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\gabriel\Nova Instalacao ComfyUI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-SAM2\node.py", line 311, in main
    (images, masks) = sam_segment(
                      ^^^^^^^^^^^^
  File "D:\gabriel\Nova Instalacao ComfyUI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-SAM2\node.py", line 224, in sam_segment
    predictor = SAM2ImagePredictor(sam_model)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\gabriel\Nova Instalacao ComfyUI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-SAM2\sam2\sam2_image_predictor.py", line 41, in __init__
    self._transforms = SAM2Transforms(
                       ^^^^^^^^^^^^^^^
  File "D:\gabriel\Nova Instalacao ComfyUI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-SAM2\sam2\utils\transforms.py", line 28, in __init__
    self.transforms = torch.jit.script(
                      ^^^^^^^^^^^^^^^^^
  File "D:\gabriel\Nova Instalacao ComfyUI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\jit\_script.py", line 1338, in script
    return torch.jit._recursive.create_script_module(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\gabriel\Nova Instalacao ComfyUI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\jit\_recursive.py", line 555, in create_script_module
    concrete_type = get_module_concrete_type(nn_module, share_types)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\gabriel\Nova Instalacao ComfyUI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\jit\_recursive.py", line 504, in get_module_concrete_type
    concrete_type = concrete_type_store.get_or_create_concrete_type(nn_module)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\gabriel\Nova Instalacao ComfyUI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\jit\_recursive.py", line 436, in get_or_create_concrete_type
    concrete_type_builder = infer_concrete_type_builder(nn_module)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\gabriel\Nova Instalacao ComfyUI\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 "D:\gabriel\Nova Instalacao ComfyUI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\jit\_recursive.py", line 504, in get_module_concrete_type
    concrete_type = concrete_type_store.get_or_create_concrete_type(nn_module)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\gabriel\Nova Instalacao ComfyUI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\jit\_recursive.py", line 436, in get_or_create_concrete_type
    concrete_type_builder = infer_concrete_type_builder(nn_module)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\gabriel\Nova Instalacao ComfyUI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\jit\_recursive.py", line 396, in infer_concrete_type_builder
    attr_type, inferred = infer_type(name, value)
                          ^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\gabriel\Nova Instalacao ComfyUI\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 "D:\gabriel\Nova Instalacao ComfyUI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\jit\annotations.py", line 491, in try_ann_to_type
    scripted_class = torch.jit._script._recursive_compile_class(ann, loc)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\gabriel\Nova Instalacao ComfyUI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\jit\_script.py", line 1567, in _recursive_compile_class
    rcb = _jit_internal.createResolutionCallbackForClassMethods(obj)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\gabriel\Nova Instalacao ComfyUI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\_jit_internal.py", line 467, in createResolutionCallbackForClassMethods
    captures.update(get_type_hint_captures(fn))
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\gabriel\Nova Instalacao ComfyUI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\_jit_internal.py", line 383, 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
kakaxixx commented 1 month ago

the same error

bananasss00 commented 1 month ago

Could u provide the complete error.

!!! Exception during processing!!! 'ImageEncoder' object has no attribute 'img_size' Traceback (most recent call last): File "V:\comfyu_py311\ComfyUI\execution.py", line 152, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "V:\comfyu_py311\ComfyUI\execution.py", line 82, in get_output_data return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "V:\comfyu_py311\ComfyUI\custom_nodes\ComfyUI-0246\utils.py", line 381, in new_func res_value = old_func(*final_args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "V:\comfyu_py311\ComfyUI\execution.py", line 75, in map_node_over_list results.append(getattr(obj, func)(slice_dict(input_data_all, i))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "V:\comfyu_py311\ComfyUI\custom_nodes\comfyui_segment_anything\node.py", line 325, in main (images, masks) = sam_segment( ^^^^^^^^^^^^ File "V:\comfyu_py311\ComfyUI\custom_nodes\comfyui_segment_anything\node.py", line 240, in sam_segment predictor = SamPredictorHQ(sam_model, sam_is_hq) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "V:\comfyu_py311\ComfyUI\custom_nodes\comfyui_segment_anything\sam_hq\predictor.py", line 22, in init super().init(sam_model=sam_model) File "V:\comfyu_py311\python_embeded\Lib\site-packages\segment_anything\predictor.py", line 31, in init self.transform = ResizeLongestSide(sam_model.image_encoder.img_size) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "V:\comfyu_py311\python_embeded\Lib\site-packages\torch\nn\modules\module.py", line 1729, in getattr raise AttributeError(f"'{type(self).name}' object has no attribute '{name}'") AttributeError: 'ImageEncoder' object has no attribute 'img_size'

Vigilence commented 4 weeks ago

I am using the workflow from the image featured on this github and receive this error.

neverbiasu commented 4 weeks ago

@bananasss00 u r using comfyui-segment-anything, try to using ComfyUI-SAM2

aleph65 commented 4 weeks ago

same

aleph65 commented 4 weeks ago

by uninstalling segment anything v1 (comfyui_segment_anything), it now works :)

the node names were conflicting.

image

https://github.com/neverbiasu/ComfyUI-SAM2/issues/12

gabrielhrr commented 3 weeks ago

In my case, by uninstalling segment anything and recreating the nodes, I started to get this error message:

Error occurred when executing GroundingDinoSAMSegment (segment anything):

could not get source code

File "D:\gabriel\Nova Instalacao ComfyUI\ComfyUI_windows_portable\ComfyUI\execution.py", line 316, 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 "D:\gabriel\Nova Instalacao ComfyUI\ComfyUI_windows_portable\ComfyUI\execution.py", line 191, 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 "D:\gabriel\Nova Instalacao ComfyUI\ComfyUI_windows_portable\ComfyUI\execution.py", line 168, in _map_node_over_list
process_inputs(input_dict, i)
File "D:\gabriel\Nova Instalacao ComfyUI\ComfyUI_windows_portable\ComfyUI\execution.py", line 157, in process_inputs
results.append(getattr(obj, func)(**inputs))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\gabriel\Nova Instalacao ComfyUI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-SAM2\node.py", line 311, in main
(images, masks) = sam_segment(
^^^^^^^^^^^^
File "D:\gabriel\Nova Instalacao ComfyUI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-SAM2\node.py", line 224, in sam_segment
predictor = SAM2ImagePredictor(sam_model)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\gabriel\Nova Instalacao ComfyUI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-SAM2\sam2\sam2_image_predictor.py", line 41, in __init__
self._transforms = SAM2Transforms(
^^^^^^^^^^^^^^^
File "D:\gabriel\Nova Instalacao ComfyUI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-SAM2\sam2\utils\transforms.py", line 28, in __init__
self.transforms = torch.jit.script(
^^^^^^^^^^^^^^^^^
File "D:\gabriel\Nova Instalacao ComfyUI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\jit\_script.py", line 1338, in script
return torch.jit._recursive.create_script_module(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\gabriel\Nova Instalacao ComfyUI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\jit\_recursive.py", line 555, in create_script_module
concrete_type = get_module_concrete_type(nn_module, share_types)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\gabriel\Nova Instalacao ComfyUI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\jit\_recursive.py", line 504, in get_module_concrete_type
concrete_type = concrete_type_store.get_or_create_concrete_type(nn_module)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\gabriel\Nova Instalacao ComfyUI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\jit\_recursive.py", line 436, in get_or_create_concrete_type
concrete_type_builder = infer_concrete_type_builder(nn_module)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\gabriel\Nova Instalacao ComfyUI\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 "D:\gabriel\Nova Instalacao ComfyUI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\jit\_recursive.py", line 504, in get_module_concrete_type
concrete_type = concrete_type_store.get_or_create_concrete_type(nn_module)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\gabriel\Nova Instalacao ComfyUI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\jit\_recursive.py", line 436, in get_or_create_concrete_type
concrete_type_builder = infer_concrete_type_builder(nn_module)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\gabriel\Nova Instalacao ComfyUI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\jit\_recursive.py", line 396, in infer_concrete_type_builder
attr_type, inferred = infer_type(name, value)
^^^^^^^^^^^^^^^^^^^^^^^
File "D:\gabriel\Nova Instalacao ComfyUI\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 "D:\gabriel\Nova Instalacao ComfyUI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\jit\annotations.py", line 491, in try_ann_to_type
scripted_class = torch.jit._script._recursive_compile_class(ann, loc)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\gabriel\Nova Instalacao ComfyUI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\jit\_script.py", line 1567, in _recursive_compile_class
rcb = _jit_internal.createResolutionCallbackForClassMethods(obj)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\gabriel\Nova Instalacao ComfyUI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\_jit_internal.py", line 467, in createResolutionCallbackForClassMethods
captures.update(get_type_hint_captures(fn))
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\gabriel\Nova Instalacao ComfyUI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\_jit_internal.py", line 383, 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
SpaceWarpStudio commented 3 weeks ago

In my case, by uninstalling segment anything and recreating the nodes, I started to get this error message:


Error occurred when executing GroundingDinoSAMSegment (segment anything):

could not get source code

File "D:\gabriel\Nova Instalacao ComfyUI\ComfyUI_windows_portable\ComfyUI\execution.py", line 316, in execute
output_data, output_ui, has_subgraph = get_output_data(obj, input_data_all, execution_block_cb=execution_block_cb, 

Same here. I removed everything to do with Segment Anything, then restarted. The following is the output I got booting up, then installing this node, then attempting to run it...

standalone-build
[START] Security scan
[DONE] Security scan
## ComfyUI-Manager: installing dependencies done.
** ComfyUI startup time: 2024-08-21 13:52:18.055757
** Platform: Windows
** Python version: 3.11.9 (tags/v3.11.9:de54cf5, Apr  2 2024, 10:12:12) [MSC v.1938 64 bit (AMD64)]
** Python executable: D:\Unity Projects\iXtenda\Repos\AR-Box\ComfyUI_ARBox\python_embeded\python.exe
** ComfyUI Path: D:\Unity Projects\iXtenda\Repos\AR-Box\ComfyUI_ARBox\ComfyUI
** Log path: D:\Unity Projects\iXtenda\Repos\AR-Box\ComfyUI_ARBox\comfyui.log

Prestartup times for custom nodes:
   1.5 seconds: D:\Unity Projects\iXtenda\Repos\AR-Box\ComfyUI_ARBox\ComfyUI\custom_nodes\ComfyUI-Manager

Total VRAM 11264 MB, total RAM 65444 MB
pytorch version: 2.3.1+cu121
Set vram state to: NORMAL_VRAM
Device: cuda:0 NVIDIA GeForce RTX 2080 Ti : cudaMallocAsync
Using pytorch cross attention
[Prompt Server] web root: D:\Unity Projects\iXtenda\Repos\AR-Box\ComfyUI_ARBox\ComfyUI\web
A new version of Albumentations is available: 1.4.14 (you have 1.4.13). Upgrade using: pip install -U albumentations. To disable automatic update checks, set the environment variable NO_ALBUMENTATIONS_UPDATE to 1.
### Loading: ComfyUI-Manager (V2.50.1)
### ComfyUI Revision: 2590 [5e806f55] | Released on '2024-08-21'

Import times for custom nodes:
   0.0 seconds: D:\Unity Projects\iXtenda\Repos\AR-Box\ComfyUI_ARBox\ComfyUI\custom_nodes\websocket_image_save.py
   0.4 seconds: D:\Unity Projects\iXtenda\Repos\AR-Box\ComfyUI_ARBox\ComfyUI\custom_nodes\ComfyUI-Manager
   1.4 seconds: D:\Unity Projects\iXtenda\Repos\AR-Box\ComfyUI_ARBox\ComfyUI\custom_nodes\ComfyUI-Inspyrenet-Rembg

Starting server

To see the GUI go to: http://127.0.0.1:8188
[ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/alter-list.json[ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/model-list.json[ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/github-stats.json
[ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/extension-node-map.json
[ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/custom-node-list.json
FETCH DATA from: D:\Unity Projects\iXtenda\Repos\AR-Box\ComfyUI_ARBox\ComfyUI\custom_nodes\ComfyUI-Manager\extension-node-map.json [DONE]
FETCH DATA from: D:\Unity Projects\iXtenda\Repos\AR-Box\ComfyUI_ARBox\ComfyUI\custom_nodes\ComfyUI-Manager\.cache\1742899825_extension-node-map.json [DONE]
FETCH DATA from: D:\Unity Projects\iXtenda\Repos\AR-Box\ComfyUI_ARBox\ComfyUI\custom_nodes\ComfyUI-Manager\.cache\1514988643_custom-node-list.json [DONE]
FETCH DATA from: D:\Unity Projects\iXtenda\Repos\AR-Box\ComfyUI_ARBox\ComfyUI\custom_nodes\ComfyUI-Manager\.cache\746607195_github-stats.json [DONE]
FETCH DATA from: D:\Unity Projects\iXtenda\Repos\AR-Box\ComfyUI_ARBox\ComfyUI\custom_nodes\ComfyUI-Manager\custom-node-list.json [DONE]
FETCH DATA from: D:\Unity Projects\iXtenda\Repos\AR-Box\ComfyUI_ARBox\ComfyUI\custom_nodes\ComfyUI-Manager\.cache\1241942342_custom-node-list.json [DONE]
Install custom node 'ComfyUI SAM2(Segment Anything 2)'
Install: ['https://github.com/neverbiasu/ComfyUI-SAM2']
Download: git clone 'https://github.com/neverbiasu/ComfyUI-SAM2'
[!]
100%|██████████| 104.0/104.0 [00:00<00:00, 133.50it/s]
100%|██████████| 104.0/104.0 [00:00<00:00, 133.50it/s]
100%|██████████| 74.0/74.0 [00:00<00:00, 93.43it/s]
100%|██████████| 74.0/74.0 [00:00<00:00, 93.43it/s]
100%|██████████| 104.0/104.0 [00:00<00:00, 113.04it/s]
100%|██████████| 104.0/104.0 [00:00<00:00, 113.04it/s]
100%|██████████| 27.0/27.0 [00:00<00:00, 29.27it/s]
100%|██████████| 27.0/27.0 [00:00<00:00, 29.27it/s]
100%|██████████| 27.0/27.0 [00:01<00:00, 18.28it/s]
Install: pip packages
Installation was successful.
After restarting ComfyUI, please refresh the browser.

Restarting... [Legacy Mode]

[START] Security scan

D:\Unity Projects\iXtenda\Repos\AR-Box\ComfyUI_ARBox>pause
Press any key to continue . . . [DONE] Security scan
## ComfyUI-Manager: installing dependencies done.
** ComfyUI startup time: 2024-08-21 13:53:34.434715
** Platform: Windows
** Python version: 3.11.9 (tags/v3.11.9:de54cf5, Apr  2 2024, 10:12:12) [MSC v.1938 64 bit (AMD64)]
** Python executable: D:\Unity Projects\iXtenda\Repos\AR-Box\ComfyUI_ARBox\python_embeded\python.exe
** ComfyUI Path: D:\Unity Projects\iXtenda\Repos\AR-Box\ComfyUI_ARBox\ComfyUI
** Log path: D:\Unity Projects\iXtenda\Repos\AR-Box\ComfyUI_ARBox\comfyui.log

#######################################################################
[ComfyUI-Manager] Starting dependency installation/(de)activation for the extension

[SKIP] Downgrading pip package isn't allowed: numpy (cur=1.26.4)
[SKIP] Downgrading pip package isn't allowed: tqdm (cur=4.66.4)
[SKIP] Downgrading pip package isn't allowed: pillow (cur=10.4.0)
[SKIP] Downgrading pip package isn't allowed: matplotlib (cur=3.9.2)
[SKIP] Downgrading pip package isn't allowed: opencv-python (cur=4.10.0.84)

[ComfyUI-Manager] Startup script completed.
#######################################################################

Prestartup times for custom nodes:
   2.3 seconds: D:\Unity Projects\iXtenda\Repos\AR-Box\ComfyUI_ARBox\ComfyUI\custom_nodes\ComfyUI-Manager

Total VRAM 11264 MB, total RAM 65444 MB
pytorch version: 2.3.1+cu121
Set vram state to: NORMAL_VRAM
Device: cuda:0 NVIDIA GeForce RTX 2080 Ti : cudaMallocAsync
Using pytorch cross attention
[Prompt Server] web root: D:\Unity Projects\iXtenda\Repos\AR-Box\ComfyUI_ARBox\ComfyUI\web
A new version of Albumentations is available: 1.4.14 (you have 1.4.13). Upgrade using: pip install -U albumentations. To disable automatic update checks, set the environment variable NO_ALBUMENTATIONS_UPDATE to 1.
### Loading: ComfyUI-Manager (V2.50.1)
### ComfyUI Revision: 2590 [5e806f55] | Released on '2024-08-21'
[ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/alter-list.json
[ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/model-list.json
[ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/github-stats.json
[ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/extension-node-map.json
[ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/custom-node-list.json

Import times for custom nodes:
   0.0 seconds: D:\Unity Projects\iXtenda\Repos\AR-Box\ComfyUI_ARBox\ComfyUI\custom_nodes\websocket_image_save.py
   0.3 seconds: D:\Unity Projects\iXtenda\Repos\AR-Box\ComfyUI_ARBox\ComfyUI\custom_nodes\ComfyUI-Manager
   0.8 seconds: D:\Unity Projects\iXtenda\Repos\AR-Box\ComfyUI_ARBox\ComfyUI\custom_nodes\ComfyUI-SAM2
   1.4 seconds: D:\Unity Projects\iXtenda\Repos\AR-Box\ComfyUI_ARBox\ComfyUI\custom_nodes\ComfyUI-Inspyrenet-Rembg

Starting server

To see the GUI go to: http://127.0.0.1:8188
FETCH DATA from: D:\Unity Projects\iXtenda\Repos\AR-Box\ComfyUI_ARBox\ComfyUI\custom_nodes\ComfyUI-Manager\extension-node-map.json [DONE]

got prompt
Loaded checkpoint sucessfully
D:\Unity Projects\iXtenda\Repos\AR-Box\ComfyUI_ARBox\python_embeded\Lib\site-packages\torch\functional.py:512: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at ..\aten\src\ATen\native\TensorShape.cpp:3588.)
  return _VF.meshgrid(tensors, **kwargs)  # type: ignore[attr-defined]
final text_encoder_type: bert-base-uncased
A parameter name that contains `beta` will be renamed internally to `bias`. Please use a different name to suppress this warning.
A parameter name that contains `gamma` will be renamed internally to `weight`. Please use a different name to suppress this warning.
A parameter name that contains `beta` will be renamed internally to `bias`. Please use a different name to suppress this warning.
A parameter name that contains `gamma` will be renamed internally to `weight`. Please use a different name to suppress this warning.
A parameter name that contains `beta` will be renamed internally to `bias`. Please use a different name to suppress this warning.
A parameter name that contains `gamma` will be renamed internally to `weight`. Please use a different name to suppress this warning.
A parameter name that contains `beta` will be renamed internally to `bias`. Please use a different name to suppress this warning.
A parameter name that contains `gamma` will be renamed internally to `weight`. Please use a different name to suppress this warning.
A parameter name that contains `beta` will be renamed internally to `bias`. Please use a different name to suppress this warning.
A parameter name that contains `gamma` will be renamed internally to `weight`. Please use a different name to suppress this warning.
A parameter name that contains `beta` will be renamed internally to `bias`. Please use a different name to suppress this warning.
A parameter name that contains `gamma` will be renamed internally to `weight`. Please use a different name to suppress this warning.
A parameter name that contains `beta` will be renamed internally to `bias`. Please use a different name to suppress this warning.
A parameter name that contains `gamma` will be renamed internally to `weight`. Please use a different name to suppress this warning.
A parameter name that contains `beta` will be renamed internally to `bias`. Please use a different name to suppress this warning.
A parameter name that contains `gamma` will be renamed internally to `weight`. Please use a different name to suppress this warning.
A parameter name that contains `beta` will be renamed internally to `bias`. Please use a different name to suppress this warning.
A parameter name that contains `gamma` will be renamed internally to `weight`. Please use a different name to suppress this warning.
A parameter name that contains `beta` will be renamed internally to `bias`. Please use a different name to suppress this warning.
A parameter name that contains `gamma` will be renamed internally to `weight`. Please use a different name to suppress this warning.
A parameter name that contains `beta` will be renamed internally to `bias`. Please use a different name to suppress this warning.
A parameter name that contains `gamma` will be renamed internally to `weight`. Please use a different name to suppress this warning.
A parameter name that contains `beta` will be renamed internally to `bias`. Please use a different name to suppress this warning.
A parameter name that contains `gamma` will be renamed internally to `weight`. Please use a different name to suppress this warning.
A parameter name that contains `beta` will be renamed internally to `bias`. Please use a different name to suppress this warning.
A parameter name that contains `gamma` will be renamed internally to `weight`. Please use a different name to suppress this warning.
A parameter name that contains `beta` will be renamed internally to `bias`. Please use a different name to suppress this warning.
A parameter name that contains `gamma` will be renamed internally to `weight`. Please use a different name to suppress this warning.
A parameter name that contains `beta` will be renamed internally to `bias`. Please use a different name to suppress this warning.
A parameter name that contains `gamma` will be renamed internally to `weight`. Please use a different name to suppress this warning.
A parameter name that contains `beta` will be renamed internally to `bias`. Please use a different name to suppress this warning.
A parameter name that contains `gamma` will be renamed internally to `weight`. Please use a different name to suppress this warning.
A parameter name that contains `beta` will be renamed internally to `bias`. Please use a different name to suppress this warning.
A parameter name that contains `gamma` will be renamed internally to `weight`. Please use a different name to suppress this warning.
A parameter name that contains `beta` will be renamed internally to `bias`. Please use a different name to suppress this warning.
A parameter name that contains `gamma` will be renamed internally to `weight`. Please use a different name to suppress this warning.
A parameter name that contains `beta` will be renamed internally to `bias`. Please use a different name to suppress this warning.
A parameter name that contains `gamma` will be renamed internally to `weight`. Please use a different name to suppress this warning.
A parameter name that contains `beta` will be renamed internally to `bias`. Please use a different name to suppress this warning.
A parameter name that contains `gamma` will be renamed internally to `weight`. Please use a different name to suppress this warning.
A parameter name that contains `beta` will be renamed internally to `bias`. Please use a different name to suppress this warning.
A parameter name that contains `gamma` will be renamed internally to `weight`. Please use a different name to suppress this warning.
A parameter name that contains `beta` will be renamed internally to `bias`. Please use a different name to suppress this warning.
A parameter name that contains `gamma` will be renamed internally to `weight`. Please use a different name to suppress this warning.
A parameter name that contains `beta` will be renamed internally to `bias`. Please use a different name to suppress this warning.
A parameter name that contains `gamma` will be renamed internally to `weight`. Please use a different name to suppress this warning.
A parameter name that contains `beta` will be renamed internally to `bias`. Please use a different name to suppress this warning.
A parameter name that contains `gamma` will be renamed internally to `weight`. Please use a different name to suppress this warning.
A parameter name that contains `beta` will be renamed internally to `bias`. Please use a different name to suppress this warning.
A parameter name that contains `gamma` will be renamed internally to `weight`. Please use a different name to suppress this warning.
A parameter name that contains `beta` will be renamed internally to `bias`. Please use a different name to suppress this warning.
A parameter name that contains `gamma` will be renamed internally to `weight`. Please use a different name to suppress this warning.
D:\Unity Projects\iXtenda\Repos\AR-Box\ComfyUI_ARBox\python_embeded\Lib\site-packages\transformers\models\bert\modeling_bert.py:439: UserWarning: 1Torch was not compiled with flash attention. (Triggered internally at ..\aten\src\ATen\native\transformers\cuda\sdp_utils.cpp:455.)
  attn_output = torch.nn.functional.scaled_dot_product_attention(
D:\Unity Projects\iXtenda\Repos\AR-Box\ComfyUI_ARBox\python_embeded\Lib\site-packages\torch\utils\checkpoint.py:464: UserWarning: torch.utils.checkpoint: the use_reentrant parameter should be passed explicitly. In version 2.4 we will raise an exception if use_reentrant is not passed. use_reentrant=False is recommended, but if you need to preserve the current default behavior, you can pass use_reentrant=True. Refer to docs for more details on the differences between the two variants.
  warnings.warn(
D:\Unity Projects\iXtenda\Repos\AR-Box\ComfyUI_ARBox\python_embeded\Lib\site-packages\torch\utils\checkpoint.py:91: UserWarning: None of the inputs have requires_grad=True. Gradients will be None
  warnings.warn(
!!! Exception during processing !!! could not get source code
Traceback (most recent call last):
  File "D:\Unity Projects\iXtenda\Repos\AR-Box\ComfyUI_ARBox\ComfyUI\execution.py", line 316, 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 "D:\Unity Projects\iXtenda\Repos\AR-Box\ComfyUI_ARBox\ComfyUI\execution.py", line 191, 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 "D:\Unity Projects\iXtenda\Repos\AR-Box\ComfyUI_ARBox\ComfyUI\execution.py", line 168, in _map_node_over_list
    process_inputs(input_dict, i)
  File "D:\Unity Projects\iXtenda\Repos\AR-Box\ComfyUI_ARBox\ComfyUI\execution.py", line 157, in process_inputs
    results.append(getattr(obj, func)(**inputs))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Unity Projects\iXtenda\Repos\AR-Box\ComfyUI_ARBox\ComfyUI\custom_nodes\ComfyUI-SAM2\node.py", line 311, in main
    (images, masks) = sam_segment(
                      ^^^^^^^^^^^^
  File "D:\Unity Projects\iXtenda\Repos\AR-Box\ComfyUI_ARBox\ComfyUI\custom_nodes\ComfyUI-SAM2\node.py", line 224, in sam_segment
    predictor = SAM2ImagePredictor(sam_model)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Unity Projects\iXtenda\Repos\AR-Box\ComfyUI_ARBox\ComfyUI\custom_nodes\ComfyUI-SAM2\sam2\sam2_image_predictor.py", line 41, in __init__
    self._transforms = SAM2Transforms(
                       ^^^^^^^^^^^^^^^
  File "D:\Unity Projects\iXtenda\Repos\AR-Box\ComfyUI_ARBox\ComfyUI\custom_nodes\ComfyUI-SAM2\sam2\utils\transforms.py", line 28, in __init__
    self.transforms = torch.jit.script(
                      ^^^^^^^^^^^^^^^^^
  File "D:\Unity Projects\iXtenda\Repos\AR-Box\ComfyUI_ARBox\python_embeded\Lib\site-packages\torch\jit\_script.py", line 1338, in script
    return torch.jit._recursive.create_script_module(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Unity Projects\iXtenda\Repos\AR-Box\ComfyUI_ARBox\python_embeded\Lib\site-packages\torch\jit\_recursive.py", line 555, in create_script_module
    concrete_type = get_module_concrete_type(nn_module, share_types)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Unity Projects\iXtenda\Repos\AR-Box\ComfyUI_ARBox\python_embeded\Lib\site-packages\torch\jit\_recursive.py", line 504, in get_module_concrete_type
    concrete_type = concrete_type_store.get_or_create_concrete_type(nn_module)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Unity Projects\iXtenda\Repos\AR-Box\ComfyUI_ARBox\python_embeded\Lib\site-packages\torch\jit\_recursive.py", line 436, in get_or_create_concrete_type
    concrete_type_builder = infer_concrete_type_builder(nn_module)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Unity Projects\iXtenda\Repos\AR-Box\ComfyUI_ARBox\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 "D:\Unity Projects\iXtenda\Repos\AR-Box\ComfyUI_ARBox\python_embeded\Lib\site-packages\torch\jit\_recursive.py", line 504, in get_module_concrete_type
    concrete_type = concrete_type_store.get_or_create_concrete_type(nn_module)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Unity Projects\iXtenda\Repos\AR-Box\ComfyUI_ARBox\python_embeded\Lib\site-packages\torch\jit\_recursive.py", line 436, in get_or_create_concrete_type
    concrete_type_builder = infer_concrete_type_builder(nn_module)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Unity Projects\iXtenda\Repos\AR-Box\ComfyUI_ARBox\python_embeded\Lib\site-packages\torch\jit\_recursive.py", line 396, in infer_concrete_type_builder
    attr_type, inferred = infer_type(name, value)
                          ^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Unity Projects\iXtenda\Repos\AR-Box\ComfyUI_ARBox\python_embeded\Lib\site-packages\torch\jit\_recursive.py", line 235, in infer_type
    attr_type = torch._C._jit_try_infer_type(item)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Unity Projects\iXtenda\Repos\AR-Box\ComfyUI_ARBox\python_embeded\Lib\site-packages\torch\jit\annotations.py", line 491, in try_ann_to_type
    scripted_class = torch.jit._script._recursive_compile_class(ann, loc)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Unity Projects\iXtenda\Repos\AR-Box\ComfyUI_ARBox\python_embeded\Lib\site-packages\torch\jit\_script.py", line 1567, in _recursive_compile_class
    rcb = _jit_internal.createResolutionCallbackForClassMethods(obj)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Unity Projects\iXtenda\Repos\AR-Box\ComfyUI_ARBox\python_embeded\Lib\site-packages\torch\_jit_internal.py", line 467, in createResolutionCallbackForClassMethods
    captures.update(get_type_hint_captures(fn))
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Unity Projects\iXtenda\Repos\AR-Box\ComfyUI_ARBox\python_embeded\Lib\site-packages\torch\_jit_internal.py", line 383, in get_type_hint_captures
    src = inspect.getsource(fn)
          ^^^^^^^^^^^^^^^^^^^^^
  File "inspect.py", line 1258, in getsource
  File "inspect.py", line 1240, in getsourcelines
  File "inspect.py", line 1077, in findsource
OSError: could not get source code

Prompt executed in 4.10 seconds
SpaceWarpStudio commented 3 weeks ago

ChatGPT found me a solution...

ComfyUI-SAM2\sam2\utils\transforms.py

Replace...

        self.transforms = torch.jit.script(
            nn.Sequential(
                Resize((self.resolution, self.resolution)),
                Normalize(self.mean, self.std),
            )
        )

with...

        self.transforms = nn.Sequential(
            Resize((self.resolution, self.resolution)),
            Normalize(self.mean, self.std),
        )

After making this change and restarting the server, it is now working for me. Sadly though, so far my results are not as good as with SAM version 1.

If you would like to see how ChatGPT found the error..

https://chatgpt.com/share/973cd1d9-8240-46c6-a9d9-1b8596bd57ca

EDIT: To mention I also manually downloaded the models required under models\bert-base-uncased that were missing after my automatic setup, but that alone didn't resolve the issue.

curlysasha commented 2 days ago

@neverbiasu can you just rename this node?