Skip to content

Commit 33b6a14

Browse files
authored
ci: Fix TensorRT engine build error for vision models (#8479)
1 parent 31ebf6a commit 33b6a14

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

qa/common/gen_qa_image_models.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python3
22

3-
# Copyright 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3+
# Copyright 2024-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
44
#
55
# Redistribution and use in source and binary forms, with or without
66
# modification, are permitted provided that the following conditions
@@ -99,14 +99,16 @@ def export_vgg19(models_dir, model_name="model.onnx"):
9999
model.eval()
100100
dummy_input = torch.randn(1, 3, 224, 224) # (batch, channels, height, width)
101101

102-
# Export the model to ONNX format
102+
# Use legacy TorchScript-based ONNX export
103+
# TODO: Update to use new torch.export-based ONNX exporter (default dynamo=True)
103104
torch.onnx.export(
104105
model,
105106
dummy_input,
106107
model_path,
107108
input_names=["input"],
108109
output_names=["output"],
109110
dynamic_axes={"input": {0: "batch_size"}, "output": {0: "batch_size"}},
111+
dynamo=False,
110112
)
111113

112114
print(f"VGG19 model exported to: {model_path}")
@@ -129,14 +131,16 @@ def export_resnet152(models_dir, model_name="model.onnx"):
129131
model.eval()
130132
dummy_input = torch.randn(1, 3, 224, 224) # (batch, channels, height, width)
131133

132-
# Export the model to ONNX format
134+
# Use legacy TorchScript-based ONNX export
135+
# TODO: Update to use new torch.export-based ONNX exporter (default dynamo=True)
133136
torch.onnx.export(
134137
model,
135138
dummy_input,
136139
model_path,
137140
input_names=["input"],
138141
output_names=["output"],
139142
dynamic_axes={"input": {0: "batch_size"}, "output": {0: "batch_size"}},
143+
dynamo=False,
140144
)
141145

142146
print(f"ResNet-152 model exported to: {model_path}")
@@ -159,14 +163,16 @@ def export_resnet50(models_dir, model_name="model.onnx"):
159163
model.eval()
160164
dummy_input = torch.randn(1, 3, 224, 224) # (batch, channels, height, width)
161165

162-
# Export the model to ONNX format
166+
# Use legacy TorchScript-based ONNX export
167+
# TODO: Update to use new torch.export-based ONNX exporter (default dynamo=True)
163168
torch.onnx.export(
164169
model,
165170
dummy_input,
166171
model_path,
167172
input_names=["input"],
168173
output_names=["output"],
169174
dynamic_axes={"input": {0: "batch_size"}, "output": {0: "batch_size"}},
175+
dynamo=False,
170176
)
171177

172178
print(f"ResNet-50 model exported to: {model_path}")

0 commit comments

Comments
 (0)