comfyanonymous / ComfyUI_TensorRT

MIT License
444 stars 28 forks source link

create_execution_context persists after recreate all my models #59

Open Milor123 opened 1 month ago

Milor123 commented 1 month ago

Description

I've deleted my old tensorRT from custom nodes folder in comfyUI and it download it again using git clone https://github.com/comfyanonymous/ComfyUI_TensorRT/

Then I've deleted all my engine models. And recreate it again, but now when try use my new models i get create_execution_context, and is very strange becase in some cases when restart comfyui in some workflows i can use it but in other stuck in create_execution_context but if I dont restart comfy, then It bug persists for all worflows.

oading 1 new model
[Fooocus Model Management] Moving model(s) has taken 0.29 seconds
15:08:13.677 executed {'node': '11', 'output': {'images': [{'filename': 'ComfyUI_temp_pnubd_00001_.png', 'subfolder': '', 'type': 'temp'}]}, 'prompt_id': 'baa1cf23-de33-4218-ae4c-68d8d29ffe01'}
executed {'node': '11', 'output': {'images': [{'filename': 'ComfyUI_temp_pnubd_00001_.png', 'subfolder': '', 'type': 'temp'}]}, 'prompt_id': 'baa1cf23-de33-4218-ae4c-68d8d29ffe01'}
15:08:13.790 executed {'node': '125', 'output': {'images': [{'filename': 'ComfyUI_06152_.png', 'subfolder': '', 'type': 'output'}]}, 'prompt_id': 'baa1cf23-de33-4218-ae4c-68d8d29ffe01'}
executed {'node': '125', 'output': {'images': [{'filename': 'ComfyUI_06152_.png', 'subfolder': '', 'type': 'output'}]}, 'prompt_id': 'baa1cf23-de33-4218-ae4c-68d8d29ffe01'}
15:08:13.902 executed {'node': '21', 'output': {'images': [{'filename': 'ComfyUI_interior_normal_01070_.png', 'subfolder': '', 'type': 'output'}]}, 'prompt_id': 'baa1cf23-de33-4218-ae4c-68d8d29ffe01'}
executed {'node': '21', 'output': {'images': [{'filename': 'ComfyUI_interior_normal_01070_.png', 'subfolder': '', 'type': 'output'}]}, 'prompt_id': 'baa1cf23-de33-4218-ae4c-68d8d29ffe01'}
[08/03/2024-10:08:15] [TRT] [I] Loaded engine size: 4959 MiB
[08/03/2024-10:08:16] [TRT] [E] 1: [defaultAllocator.cpp::allocate::19] Error Code 1: Cuda Runtime (out of memory)
[08/03/2024-10:08:16] [TRT] [W] Requested amount of GPU memory (4468399104 bytes) could not be allocated. There may not be enough free memory for allocation to succeed.
[08/03/2024-10:08:16] [TRT] [E] 2: [myelinResourceManager.cpp::allocate::129] Error Code 2: OutOfMemory (no further information)
!!! Exception during processing!!! 'NoneType' object has no attribute 'create_execution_context'
Traceback (most recent call last):
  File "/home/noe/Documentos/ComfyUI/execution.py", line 152, in recursive_execute
    output_data, output_ui = get_output_data(obj, input_data_all)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/noe/Documentos/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 "/home/noe/Documentos/ComfyUI/execution.py", line 75, in map_node_over_list
    results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/noe/Documentos/ComfyUI/custom_nodes/ComfyUI_TensorRT/tensorrt_loader.py", line 123, in load_unet
    unet = TrTUnet(unet_path)
           ^^^^^^^^^^^^^^^^^^
  File "/home/noe/Documentos/ComfyUI/custom_nodes/ComfyUI_TensorRT/tensorrt_loader.py", line 42, in __init__
    self.context = self.engine.create_execution_context()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'create_execution_context'

Prompt executed in 22.53 seconds
15:08:16.482 no pending upload
no pending upload

Environment

TensorRT Version: the lastest updated to today using git clone from direct repo (I dont know how check it) NVIDIA GPU: NVIDIA GeForce RTX 4070 NVIDIA Driver Version: 550.100 CUDA Version: 12.5 CUDNN Version: cudnn 9.2.0.82-1 Operating System: Manjaro Python Version (if applicable): 3.11.7 Tensorflow Version (if applicable): 2.16.1 PyTorch Version (if applicable): 2.3.0 Baremetal or Container (if so, version): Baremetal Tested too in Python: 3.12 (same issue)

Jefferderp commented 1 month ago

+1

Milor123 commented 1 month ago

guys I still awaiting for help, it has not fixed still

acidSnkj commented 1 month ago

Same problem here