File export_sam2_onnx.py in deepstream_tools hangs and does not generate the .engine

• DGX A100 dGPU
• DeepStream 8.0

I’m trying to compile the 4 models to use the Mask Tracker, I’m using the run.sh that comes in deepstream_tools/sam2-onnx-tensorrt/ and that calls export_sam2_onnx.py within that same folder, when running it shows a missing dependency onnxscript whose version is not specified anywhere so I’m installing the latest 0.5.4, I’m in container DS 8.0 and when running the run without installing onnxscript it obviously crashes due to dependency, after installing the aforementioned version it also crashes because the parameter opset_config = 17 that comes in the code is not compatible, I changed to opset_config = 18 and although there seems to be no problems, the code stays … it’s been 40 minutes and it doesn’t compile even the first of the 4 models, please your kind help NVIDIA team, this problem is critical.

File export_sam2_onnx.py with opset_config = 18 (I changed it, original was 17)


Logs without progress after 50 minutes…

I had to downgrade onnxscript to version 0.4.0 but only 2 .onnx where created and then got an error…

Then I added this second parameter dynamo = False and the 4 .onnx were generated in about 5 minutes

Thank you for your feedback. I can reproduce this issue. Please try the following patch as a workaround. We will discuss this issue internally until a fix is ​​available.

diff --git a/sam2-onnx-tensorrt/setup.py b/sam2-onnx-tensorrt/setup.py
index fe95e94..ddafa2e 100644
--- a/sam2-onnx-tensorrt/setup.py
+++ b/sam2-onnx-tensorrt/setup.py
@@ -23,6 +23,7 @@ with open("README.md", "r", encoding="utf-8") as f:
 # Required dependencies
 REQUIRED_PACKAGES = [
     "torch>=2.5.1",
+    "torch<=2.8.1",
     "torchvision>=0.20.1",
     "numpy>=1.24.4",
     "tqdm>=4.66.1",
@@ -30,6 +31,7 @@ REQUIRED_PACKAGES = [
     "iopath>=0.1.10",
     "pillow>=9.4.0",
     "onnx>=1.18.0",
+    "onnxscript==0.4.0",
 ]
 
 EXTRA_PACKAGES = {

Nice, thank you very much!