Skip to content

Commit 9696222

Browse files
committed
removes fallback arguments in torch.onnx.export
1 parent 76f5c53 commit 9696222

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

olive/passes/onnx/conversion.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,6 @@ def _export_pytorch_model(
194194
# is taken, the old export always writes a model to the disk. When that happens we need to
195195
# load the model back into IR and load all the external tensor to memory
196196
with tempfile.TemporaryDirectory(prefix="olive_tmp") as tmp_dir:
197-
tmp_model_path = resolve_onnx_path(tmp_dir)
198-
199197
if dynamo:
200198
# Take the "release" version so that dev builds like 2.5.0dev1234 are treated as 2.5.0
201199
if _torch_is_older_than("2.7.0") and (
@@ -239,15 +237,13 @@ def _export_pytorch_model(
239237
onnx_program = torch.onnx.export( # pylint: disable=unexpected-keyword-arg,no-value-for-parameter
240238
pytorch_model,
241239
dummy_inputs,
242-
tmp_model_path, # needed for fallback=True
243240
kwargs=dummy_kwargs,
244241
opset_version=config.target_opset,
245242
input_names=io_config.input_names,
246243
output_names=io_config.output_names,
247244
dynamic_axes=dynamic_axes_for_export,
248245
dynamic_shapes=io_config.dynamic_shapes,
249246
dynamo=True,
250-
fallback=False,
251247
optimize=config.optimize,
252248
report=logger.isEnabledFor(logging.DEBUG),
253249
)
@@ -264,6 +260,8 @@ def _export_pytorch_model(
264260
# default is True in 2.9.0 and later
265261
dynamo_args["dynamo"] = False
266262

263+
tmp_model_path = resolve_onnx_path(tmp_dir)
264+
267265
torch.onnx.export(
268266
pytorch_model,
269267
dummy_inputs,

0 commit comments

Comments
 (0)