Skip to content

Commit 0206d8d

Browse files
authored
[https://nvbugs/5606136][fix] Fix torch.onnx.export with pytorch upgrade to fallback to dynamo=False. (#8917)
Signed-off-by: Simeng Liu <[email protected]>
1 parent c329f5f commit 0206d8d

File tree

4 files changed

+24
-25
lines changed

4 files changed

+24
-25
lines changed

examples/models/contrib/dit/vae_decoder_trt.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,18 @@ def export_onnx(self, onnxFile):
3434
*self.latent_shape).cuda()
3535
self.pytorch_model.cuda().eval()
3636
with torch.inference_mode():
37-
torch.onnx.export(self.pytorch_model,
38-
latent,
39-
onnxFile,
40-
opset_version=17,
41-
input_names=['input'],
42-
output_names=['output'],
43-
dynamic_axes={'input': {
44-
0: 'batch'
45-
}})
37+
torch.onnx.export(
38+
self.pytorch_model,
39+
latent,
40+
onnxFile,
41+
opset_version=17,
42+
input_names=['input'],
43+
output_names=['output'],
44+
dynamic_axes={'input': {
45+
0: 'batch'
46+
}},
47+
# Required for pytorch>=2.9.0 as dynamo becomes the default and introduces bugs as it does not support opset_version=17 natively
48+
dynamo=False)
4649

4750
def generate_trt_engine(self, onnxFile, planFile):
4851
print(f"Start exporting TRT model to {planFile}!")

examples/models/core/qwenvl/vit_onnx_trt.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ def export_onnx(self, onnx_file_path, pretrained_model_path, image_url):
8989
dynamic_axes={"input": {
9090
0: "batch"
9191
}},
92-
)
92+
# Required for pytorch>=2.9.0 as dynamo becomes the default and introduces bugs as it does not support opset_version=17 natively
93+
dynamo=False)
9394
release_gc() # Further release memory
9495
print(
9596
f"Export to ONNX file successfully! The ONNX file stays in {onnx_file_path}"

tensorrt_llm/tools/multimodal_builder.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,16 @@ def export_onnx(model,
163163
logger.log(trt.Logger.INFO, f"Exporting onnx to {onnx_dir}/{onnx_name}")
164164
os.makedirs(onnx_dir, exist_ok=True)
165165

166-
torch.onnx.export(model,
167-
input,
168-
f'{onnx_dir}/{onnx_name}',
169-
opset_version=17,
170-
input_names=input_names,
171-
output_names=output_names,
172-
dynamic_axes=dynamic_axes)
166+
torch.onnx.export(
167+
model,
168+
input,
169+
f'{onnx_dir}/{onnx_name}',
170+
opset_version=17,
171+
input_names=input_names,
172+
output_names=output_names,
173+
dynamic_axes=dynamic_axes,
174+
# Required for pytorch>=2.9.0 as dynamo becomes the default and introduces bugs as it does not support opset_version=17 natively
175+
dynamo=False)
173176

174177

175178
def build_trt_engine(model_type,

tests/integration/test_lists/waives.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -343,14 +343,6 @@ full:H20-3e/accuracy/test_llm_api_pytorch.py::TestNemotronUltra::test_auto_dtype
343343
full:H20-3e/accuracy/test_llm_api_pytorch.py::TestKimiK2::test_fp8_blockscale[latency] SKIP (slow I/O)
344344
full:H20-3e/test_e2e.py::test_ptp_quickstart_advanced_multi_gpus[DeepSeek-V3-671B-FP8-DeepSeek-V3-0324-8] SKIP (slow I/O)
345345
disaggregated/test_disaggregated_single_gpu.py::test_disaggregated_spec_dec_batch_slot_limit[False-False-EAGLE3-LLaMA3.1-Instruct-8B-Llama-3.1-8B-Instruct] SKIP (https://nvbugs/5608743)
346-
triton_server/test_triton_llm.py::test_mistral_small_3_1_24b_pixtral[TYPE_FP16-TYPE_BF16-False-1---False-True-False-0-1-disableDecoupleMode-inflight_fused_batching-disableTrtOverlap--0.7-guaranteed_no_evict---1-1-1-False-ensemble] SKIP (https://nvbugs/5606136)
347-
triton_server/test_triton_llm.py::test_mistral_small_3_1_24b_pixtral[TYPE_FP16-TYPE_BF16-False-1---False-True-False-0-1-disableDecoupleMode-inflight_fused_batching-disableTrtOverlap--0.7-max_utilization---1-1-1-False-ensemble] SKIP (https://nvbugs/5606136)
348-
triton_server/test_triton_llm.py::test_mistral_small_3_1_24b_pixtral[TYPE_FP16-TYPE_BF16-False-1---False-True-False-0-1-enableDecoupleMode-inflight_fused_batching-disableTrtOverlap--0.7-guaranteed_no_evict---1-1-1-False-ensemble] SKIP (https://nvbugs/5606136)
349-
triton_server/test_triton_llm.py::test_mistral_small_3_1_24b_pixtral[TYPE_FP16-TYPE_BF16-False-1---False-True-False-0-1-enableDecoupleMode-inflight_fused_batching-disableTrtOverlap--0.7-max_utilization---1-1-1-False-ensemble] SKIP (https://nvbugs/5606136)
350-
triton_server/test_triton_llm.py::test_mistral_small_3_1_24b_pixtral[TYPE_FP16-TYPE_BF16-False-1---False-True-False-0-1-disableDecoupleMode-inflight_fused_batching-disableTrtOverlap--0.7-guaranteed_no_evict---1-1-1-False-tensorrt_llm_bls] SKIP (https://nvbugs/5606136)
351-
triton_server/test_triton_llm.py::test_mistral_small_3_1_24b_pixtral[TYPE_FP16-TYPE_BF16-False-1---False-True-False-0-1-disableDecoupleMode-inflight_fused_batching-disableTrtOverlap--0.7-max_utilization---1-1-1-False-tensorrt_llm_bls] SKIP (https://nvbugs/5606136)
352-
triton_server/test_triton_llm.py::test_mistral_small_3_1_24b_pixtral[TYPE_FP16-TYPE_BF16-False-1---False-True-False-0-1-enableDecoupleMode-inflight_fused_batching-disableTrtOverlap--0.7-guaranteed_no_evict---1-1-1-False-tensorrt_llm_bls] SKIP (https://nvbugs/5606136)
353-
triton_server/test_triton_llm.py::test_mistral_small_3_1_24b_pixtral[TYPE_FP16-TYPE_BF16-False-1---False-True-False-0-1-enableDecoupleMode-inflight_fused_batching-disableTrtOverlap--0.7-max_utilization---1-1-1-False-tensorrt_llm_bls] SKIP (https://nvbugs/5606136)
354346
accuracy/test_cli_flow.py::TestMinitron4BBase::test_fp8 SKIP (https://nvbugs/5606233)
355347
examples/test_gpt.py::test_llm_minitron_fp8_with_pseudo_loras[4b] SKIP (https://nvbugs/5606233)
356348
disaggregated/test_disaggregated_single_gpu.py::test_disaggregated_simple_deepseek[True-False-DeepSeek-V3-Lite-fp8/fp8] SKIP (https://nvbugs/5626197)

0 commit comments

Comments
 (0)