Repository: pytorch
Issue:  DYNAMIC_TRT_MODEL_CONVERSION 0 INTERNAL ASSERT FAILED or, comfyui made me come here
Labels: oncall: jit

### 🐛 Describe the bug

DYNAMIC_TRT_MODEL_CONVERSION
0 INTERNAL ASSERT FAILED at "C:\\actions-runner\\_work\\pytorch\\pytorch\\builder\\windows\\pytorch\\torch\\csrc\\jit\\ir\\alias_analysis.cpp":621, please report a bug to PyTorch. We don't have an op for aten::view but it isn't a special case. Argument types: Tensor, int, Candidates: aten::view(Tensor(a) self, SymInt[] size) -> Tensor(a) aten::view.dtype(Tensor(a) self, ScalarType dtype) -> Tensor(a)


# ComfyUI Error Report
## Error Details
- **Node Type:** DYNAMIC_TRT_MODEL_CONVERSION
- **Exception Type:** RuntimeError
- **Exception Message:** 0 INTERNAL ASSERT FAILED at "C:\\actions-runner\\_work\\pytorch\\pytorch\\builder\\windows\\pytorch\\torch\\csrc\\jit\\ir\\alias_analysis.cpp":621, please report a bug to PyTorch. We don't have an op for aten::view but it isn't a special case.  Argument types: Tensor, int, 

Candidates:
	aten::view(Tensor(a) self, SymInt[] size) -> Tensor(a)
	aten::view.dtype(Tensor(a) self, ScalarType dtype) -> Tensor(a)
## Stack Trace
```
  File "C:\AI\pinokio\api\comfy.git\app\execution.py", line 317, 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:\AI\pinokio\api\comfy.git\app\execution.py", line 192, 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:\AI\pinokio\api\comfy.git\app\execution.py", line 169, in _map_node_over_list
    process_inputs(input_dict, i)

  File "C:\AI\pinokio\api\comfy.git\app\execution.py", line 158, in process_inputs
    results.append(getattr(obj, func)(**inputs))

  File "C:\AI\pinokio\api\comfy.git\app\custom_nodes\ComfyUI_TensorRT\tensorrt_convert.py", line 539, in convert
    return super()._convert(

  File "C:\AI\pinokio\api\comfy.git\app\custom_nodes\ComfyUI_TensorRT\tensorrt_convert.py", line 282, in _convert
    torch.onnx.export(

  File "C:\AI\pinokio\api\comfy.git\app\env\lib\site-packages\torch\onnx\utils.py", line 551, in export
    _export(

  File "C:\AI\pinokio\api\comfy.git\app\env\lib\site-packages\torch\onnx\utils.py", line 1648, in _export
    graph, params_dict, torch_out = _model_to_graph(

  File "C:\AI\pinokio\api\comfy.git\app\env\lib\site-packages\torch\onnx\utils.py", line 1170, in _model_to_graph
    graph, params, torch_out, module = _create_jit_graph(model, args)

  File "C:\AI\pinokio\api\comfy.git\app\env\lib\site-packages\torch\onnx\utils.py", line 1046, in _create_jit_graph
    graph, torch_out = _trace_and_get_graph_from_model(model, args)

  File "C:\AI\pinokio\api\comfy.git\app\env\lib\site-packages\torch\onnx\utils.py", line 950, in _trace_and_get_graph_from_model
    trace_graph, torch_out, inputs_states = torch.jit._get_trace_graph(

  File "C:\AI\pinokio\api\comfy.git\app\env\lib\site-packages\torch\jit\_trace.py", line 1497, in _get_trace_graph
    outs = ONNXTracedModule(

  File "C:\AI\pinokio\api\comfy.git\app\env\lib\site-packages\torch\nn\modules\module.py", line 1553, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)

  File "C:\AI\pinokio\api\comfy.git\app\env\lib\site-packages\torch\nn\modules\module.py", line 1562, in _call_impl
    return forward_call(*args, **kwargs)

  File "C:\AI\pinokio\api\comfy.git\app\env\lib\site-packages\torch\jit\_trace.py", line 141, in forward
    graph, out = torch._C._create_graph_by_tracing(

```
## System Information
- **ComfyUI Version:** v0.1.3-23-gbaa6b4d
- **Arguments:** main.py --cuda-malloc --preview-method taesd
- **OS:** nt
- **Python Version:** 3.10.14 | packaged by conda-forge | (main, Mar 20 2024, 12:40:08) [MSC v.1938 64 bit (AMD64)]
- **Embedded Python:** false
- **PyTorch Version:** 2.4.0+cu121
## Devices

- **Name:** cuda:0 NVIDIA GeForce RTX 3090 : cudaMallocAsync
  - **Type:** cuda
  - **VRAM Total:** 25769279488
  - **VRAM Free:** 15346121536
  - **Torch VRAM Total:** 10166992896
  - **Torch VRAM Free:** 1148402496

## Logs
```
2024-08-31 21:04:32,645 - root - INFO - Total VRAM 24576 MB, total RAM 65458 MB
2024-08-31 21:04:32,645 - root - INFO - pytorch version: 2.4.0+cu121
2024-08-31 21:04:32,648 - root - INFO - Set vram state to: NORMAL_VRAM
2024-08-31 21:04:32,648 - root - INFO - Device: cuda:0 NVIDIA GeForce RTX 3090 : cudaMallocAsync
2024-08-31 21:04:33,800 - root - INFO - Using pytorch cross attention
2024-08-31 21:04:35,216 - root - INFO - [Prompt Server] web root: C:\AI\pinokio\api\comfy.git\app\web
2024-08-31 21:04:36,786 - root - INFO - 
Import times for custom nodes:
2024-08-31 21:04:36,786 - root - INFO -    0.0 seconds: C:\AI\pinokio\api\comfy.git\app\custom_nodes\websocket_image_save.py
2024-08-31 21:04:36,786 - root - INFO -    0.0 seconds: C:\AI\pinokio\api\comfy.git\app\custom_nodes\cg-use-everywhere
2024-08-31 21:04:36,786 - root - INFO -    0.0 seconds: C:\AI\pinokio\api\comfy.git\app\custom_nodes\ComfyUI-NAI-styler
2024-08-31 21:04:36,787 - root - INFO -    0.0 seconds: C:\AI\pinokio\api\comfy.git\app\custom_nodes\ComfyUI-Universal-Styler
2024-08-31 21:04:36,787 - root - INFO -    0.0 seconds: C:\AI\pinokio\api\comfy.git\app\custom_nodes\ComfyUI-Custom-Scripts
2024-08-31 21:04:36,787 - root - INFO -    0.0 seconds: C:\AI\pinokio\api\comfy.git\app\custom_nodes\ComfyUI-GGUF
2024-08-31 21:04:36,787 - root - INFO -    0.1 seconds: C:\AI\pinokio\api\comfy.git\app\custom_nodes\ComfyUI-Flowty-LDSR
2024-08-31 21:04:36,787 - root - INFO -    0.2 seconds: C:\AI\pinokio\api\comfy.git\app\custom_nodes\ComfyUI_TensorRT
2024-08-31 21:04:36,787 - root - INFO -    0.3 seconds: C:\AI\pinokio\api\comfy.git\app\custom_nodes\ComfyUI-Manager
2024-08-31 21:04:36,788 - root - INFO -    0.4 seconds: C:\AI\pinokio\api\comfy.git\app\custom_nodes\ComfyUI-Fluxpromptenhancer
2024-08-31 21:04:36,788 - root - INFO - 
2024-08-31 21:04:36,800 - root - INFO - Starting server

2024-08-31 21:04:36,800 - root - INFO - To see the GUI go to: http://127.0.0.1:8188
2024-08-31 21:11:33,850 - root - INFO - got prompt
2024-08-31 21:11:33,993 - root - INFO - model weight dtype torch.bfloat16, manual cast: None
2024-08-31 21:11:33,995 - root - INFO - model_type FLUX
2024-08-31 21:11:34,049 - root - INFO - Requested to load Flux
2024-08-31 21:11:34,049 - root - INFO - Loading 1 new model
2024-08-31 21:11:41,506 - root - INFO - loaded completely 0.0 8592.597778320312 True
2024-08-31 21:11:50,425 - root - ERROR - !!! Exception during processing !!! 0 INTERNAL ASSERT FAILED at "C:\\actions-runner\\_work\\pytorch\\pytorch\\builder\\windows\\pytorch\\torch\\csrc\\jit\\ir\\alias_analysis.cpp":621, please report a bug to PyTorch. We don't have an op for aten::view but it isn't a special case.  Argument types: Tensor, int, 

Candidates:
	aten::view(Tensor(a) self, SymInt[] size) -> Tensor(a)
	aten::view.dtype(Tensor(a) self, ScalarType dtype) -> Tensor(a)
2024-08-31 21:11:50,463 - root - ERROR - Traceback (most recent call last):
  File "C:\AI\pinokio\api\comfy.git\app\execution.py", line 317, 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:\AI\pinokio\api\comfy.git\app\execution.py", line 192, 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:\AI\pinokio\api\comfy.git\app\execution.py", line 169, in _map_node_over_list
    process_inputs(input_dict, i)
  File "C:\AI\pinokio\api\comfy.git\app\execution.py", line 158, in process_inputs
    results.append(getattr(obj, func)(**inputs))
  File "C:\AI\pinokio\api\comfy.git\app\custom_nodes\ComfyUI_TensorRT\tensorrt_convert.py", line 539, in convert
    return super()._convert(
  File "C:\AI\pinokio\api\comfy.git\app\custom_nodes\ComfyUI_TensorRT\tensorrt_convert.py", line 282, in _convert
    torch.onnx.export(
  File "C:\AI\pinokio\api\comfy.git\app\env\lib\site-packages\torch\onnx\utils.py", line 551, in export
    _export(
  File "C:\AI\pinokio\api\comfy.git\app\env\lib\site-packages\torch\onnx\utils.py", line 1648, in _export
    graph, params_dict, torch_out = _model_to_graph(
  File "C:\AI\pinokio\api\comfy.git\app\env\lib\site-packages\torch\onnx\utils.py", line 1170, in _model_to_graph
    graph, params, torch_out, module = _create_jit_graph(model, args)
  File "C:\AI\pinokio\api\comfy.git\app\env\lib\site-packages\torch\onnx\utils.py", line 1046, in _create_jit_graph
    graph, torch_out = _trace_and_get_graph_from_model(model, args)
  File "C:\AI\pinokio\api\comfy.git\app\env\lib\site-packages\torch\onnx\utils.py", line 950, in _trace_and_get_graph_from_model
    trace_graph, torch_out, inputs_states = torch.jit._get_trace_graph(
  File "C:\AI\pinokio\api\comfy.git\app\env\lib\site-packages\torch\jit\_trace.py", line 1497, in _get_trace_graph
    outs = ONNXTracedModule(
  File "C:\AI\pinokio\api\comfy.git\app\env\lib\site-packages\torch\nn\modules\module.py", line 1553, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "C:\AI\pinokio\api\comfy.git\app\env\lib\site-packages\torch\nn\modules\module.py", line 1562, in _call_impl
    return forward_call(*args, **kwargs)
  File "C:\AI\pinokio\api\comfy.git\app\env\lib\site-packages\torch\jit\_trace.py", line 141, in forward
    graph, out = torch._C._create_graph_by_tracing(
RuntimeError: 0 INTERNAL ASSERT FAILED at "C:\\actions-runner\\_work\\pytorch\\pytorch\\builder\\windows\\pytorch\\torch\\csrc\\jit\\ir\\alias_analysis.cpp":621, please report a bug to PyTorch. We don't have an op for aten::view but it isn't a special case.  Argument types: Tensor, int, 

Candidates:
	aten::view(Tensor(a) self, SymInt[] size) -> Tensor(a)
	aten::view.dtype(Tensor(a) self, ScalarType dtype) -> Tensor(a)

2024-08-31 21:11:50,466 - root - INFO - Prompt executed in 16.61 seconds
```
## Attached Workflow
Please make sure that workflow does not contain any sensitive information such as API keys or passwords.
```
{"last_node_id":8,"last_link_id":1,"nodes":[{"id":8,"type":"DYNAMIC_TRT_MODEL_CONVERSION","pos":{"0":831,"1":287,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0},"size":{"0":352.79998779296875,"1":370},"flags":{},"order":1,"mode":0,"inputs":[{"name":"model","type":"MODEL","link":1}],"outputs":[],"properties":{"Node name for S&R":"DYNAMIC_TRT_MODEL_CONVERSION"},"widgets_values":["tensorrt/TRT-",1,1,2,1024,1216,1600,1024,832,1600,1,1,2,14]},{"id":7,"type":"UnetLoaderGGUF","pos":{"0":485,"1":288,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0},"size":{"0":315,"1":58},"flags":{},"order":0,"mode":0,"inputs":[],"outputs":[{"name":"MODEL","type":"MODEL","links":[1],"shape":3,"slot_index":0}],"properties":{"Node name for S&R":"UnetLoaderGGUF"},"widgets_values":["flux1-dev-Q5_1.gguf"]}],"links":[[1,7,0,8,0,"MODEL"]],"groups":[],"config":{},"extra":{"ds":{"scale":1,"offset":[0,0]}},"version":0.4}
```

## Additional Context

Trying to run a Flux GGUF model through Tensorrt:
![image](https://github.com/user-attachments/assets/9267b62a-cddf-4137-8c71-f6b248759ede)

hopefully the pinokio/comfyui logs will be helpful
[logs.zip](https://github.com/user-attachments/files/16826753/logs.zip)



### Versions

hopefully this zip has what you need
[logs.zip](https://github.com/user-attachments/files/16826754/logs.zip)


cc @EikanWang @jgong5 @wenzhe-nrv @sanchitintel