[GH-ISSUE #41] onxxruntime error - TensorRT does not natively support INT64 #31

Closed
opened 2026-10-30 21:08:35 +00:00 by bsakaguchi · 2 comments
Owner

Originally created by @mykeehu on GitHub (May 9, 2024).
Original GitHub issue: https://github.com/AUTOMATIC1111/stable-diffusion-webui-rembg/issues/41

There is one bug I can't solve. I put the image in the Extras page, tick the Remove background option at the bottom, and when I launch it, I get this error:

2024-05-09 11:49:43.9136844 [W:onnxruntime:Default, tensorrt_execution_provider.h:83 onnxruntime::TensorrtLogger::log] [2024-05-09 09:49:43 WARNING] onnx2trt_utils.cpp:369: Your ONNX model has been generated with INT64 weights, while TensorRT does not natively support INT64. Attempting to cast down to INT32.
2024-05-09 11:50:18.0986453 [W:onnxruntime:Default, tensorrt_execution_provider.h:83 onnxruntime::TensorrtLogger::log] [2024-05-09 09:50:18 WARNING] The getMaxBatchSize() function should not be used with an engine built from a network created with NetworkDefinitionCreationFlag::kEXPLICIT_BATCH flag. This function will always return 1.
2024-05-09 11:50:18.1983962 [W:onnxruntime:Default, tensorrt_execution_provider.h:83 onnxruntime::TensorrtLogger::log] [2024-05-09 09:50:18 WARNING] The getMaxBatchSize() function should not be used with an engine built from a network created with NetworkDefinitionCreationFlag::kEXPLICIT_BATCH flag. This function will always return 1.

How do I fix this, because even though I deleted the onxxruntime and tensorrt folders, the error still persists.

Originally created by @mykeehu on GitHub (May 9, 2024). Original GitHub issue: https://github.com/AUTOMATIC1111/stable-diffusion-webui-rembg/issues/41 There is one bug I can't solve. I put the image in the Extras page, tick the Remove background option at the bottom, and when I launch it, I get this error: ``` 2024-05-09 11:49:43.9136844 [W:onnxruntime:Default, tensorrt_execution_provider.h:83 onnxruntime::TensorrtLogger::log] [2024-05-09 09:49:43 WARNING] onnx2trt_utils.cpp:369: Your ONNX model has been generated with INT64 weights, while TensorRT does not natively support INT64. Attempting to cast down to INT32. 2024-05-09 11:50:18.0986453 [W:onnxruntime:Default, tensorrt_execution_provider.h:83 onnxruntime::TensorrtLogger::log] [2024-05-09 09:50:18 WARNING] The getMaxBatchSize() function should not be used with an engine built from a network created with NetworkDefinitionCreationFlag::kEXPLICIT_BATCH flag. This function will always return 1. 2024-05-09 11:50:18.1983962 [W:onnxruntime:Default, tensorrt_execution_provider.h:83 onnxruntime::TensorrtLogger::log] [2024-05-09 09:50:18 WARNING] The getMaxBatchSize() function should not be used with an engine built from a network created with NetworkDefinitionCreationFlag::kEXPLICIT_BATCH flag. This function will always return 1. ``` How do I fix this, because even though I deleted the onxxruntime and tensorrt folders, the error still persists.
Author
Owner

@mykeehu commented on GitHub (May 15, 2024):

Ok, I found a solution, it seems!

  • deleted the onnxruntime folders from the stable-diffusion-webui\venv\Lib\site-packages folder
  • deleted stable-diffusion-webui\models\rem_bg folder
  • went into venv and manually installed CUDA 12.1 with the following commands:
pip install onnxruntime-gpu --extra-index-url https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/onnxruntime-cuda-12/pypi/simple/
pip install rembg[gpu,cli]

Then the background removal worked like lightning.

<!-- gh-comment-id:2112666976 --> @mykeehu commented on GitHub (May 15, 2024): Ok, I found a solution, it seems! - deleted the onnxruntime folders from the stable-diffusion-webui\venv\Lib\site-packages folder - deleted stable-diffusion-webui\models\rem_bg folder - went into venv and manually installed CUDA 12.1 with the following commands: ``` pip install onnxruntime-gpu --extra-index-url https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/onnxruntime-cuda-12/pypi/simple/ pip install rembg[gpu,cli] ``` Then the background removal worked like lightning.
Author
Owner

@stanleyshek commented on GitHub (Jun 17, 2024):

pip install rembg[gpu,cli]

I got a similar problem. Tried follow your steps but still get error with these messages. Any hint?

Screenshot 2024-06-18 004713

<!-- gh-comment-id:2173881107 --> @stanleyshek commented on GitHub (Jun 17, 2024): > pip install rembg[gpu,cli] I got a similar problem. Tried follow your steps but still get error with these messages. Any hint? ![Screenshot 2024-06-18 004713](https://github.com/AUTOMATIC1111/stable-diffusion-webui-rembg/assets/4930397/deb00c98-72db-4d06-b9b4-f518f3188cf2)
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
AUTOMATIC1111/stable-diffusion-webui-rembg#31
No description provided.