yuvraj108c/ComfyUI-Upscaler-Tensorrt

Converting HAT and DAT upscaler models

brbbbq opened this issue · 1 comments

I've been able to use the Tensorrt node for a few things, and it works really well for speeding up the upscaling process. Would it be possible to make it compatible with DAT and HAT formats as well? Currently I get this error when trying to convert a DAT .onnx file to an .engine file:

C:\Apps\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Upscaler-Tensorrt>export_trt.py
Enter the path to save the TensorRT engine (.engine) file: C:\Apps\ComfyUI_windows_portable\ComfyUI\models\tensorrt\upscaler\4xNomos8kDAT.engine

Enter the path to the ONNX model file (.onnx): C:\Apps\ComfyUI_windows_portable\ComfyUI\models\onnx\4xNomos8kDAT.onnx

Building TensorRT engine for C:\Apps\ComfyUI_windows_portable\ComfyUI\models\onnx\4xNomos8kDAT.onnx: C:\Apps\ComfyUI_windows_portable\ComfyUI\models\tensorrt\upscaler\4xNomos8kDAT.engine

Building engine:  50%|█████████████████████████████████▌                                 | 3/6 [00:39<00:39, 13.21s/it][W] 'colored' module is not installed, will not use colors when logging. To enable colors, please install the 'colored' module: python3 -m pip install colored

[E] 10: Could not find any implementation for node {ForeignNode[ONNXTRT_castHelper_24857_output[Constant].../layers.0/blocks.0/attn/Transpose_6 + /layers.0/blocks.0/attn/Reshape_9]}.

Building engine: 100%|███████████████████████████████████████████████████████████████████| 6/6 [00:39<00:00,  6.61s/it]

[E] 10: [optimizer.cpp::nvinfer1::builder::cgraph::LeafCNode::computeCosts::4105] Error Code 10: Internal Error (Could not find any implementation for node {ForeignNode[ONNXTRT_castHelper_24857_output[Constant].../layers.0/blocks.0/attn/Transpose_6 + /layers.0/blocks.0/attn/Reshape_9]}.)

[!] Invalid Engine. Please ensure the engine was built correctly
ERROR:root:Failed to build engine: Invalid Engine. Please ensure the engine was built correctly
Time taken to build: 47.896575689315796 seconds

Are there other resources out there that can do the conversion already? I tried searching around, but couldn't find anything.

This is where I got the DAT .onnx file:
https://openmodeldb.info/models/4x-Nomos8kDAT

Related issue: #2

only models with ESRGAN architecture are working. I haven't been able to figure out the issue