From c26ca8b94d4b1020b9be58d9c525964dd0bd79fb Mon Sep 17 00:00:00 2001 From: zjgarvey <47986913+zjgarvey@users.noreply.github.com> Date: Thu, 14 Nov 2024 23:20:11 -0600 Subject: [PATCH] Fix a bug for large models in onnx importer. (#3875) The method `onnx.load_external_data_for_model` function does not admit `pathlib.Path` as an input. --- python/torch_mlir/tools/import_onnx/__main__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/torch_mlir/tools/import_onnx/__main__.py b/python/torch_mlir/tools/import_onnx/__main__.py index fa0e2a89dbba..4f852d34bb0a 100644 --- a/python/torch_mlir/tools/import_onnx/__main__.py +++ b/python/torch_mlir/tools/import_onnx/__main__.py @@ -137,7 +137,7 @@ def load_onnx_model(args: argparse.Namespace) -> onnx.ModelProto: # Load the temp file and the external data. inferred_model = onnx.load(temp_inferred_file, load_external_data=False) data_dir = Path(input_dir if args.temp_dir is None else args.data_dir) - onnx.load_external_data_for_model(inferred_model, data_dir) + onnx.load_external_data_for_model(inferred_model, str(data_dir)) # Remove the inferred shape file unless asked to keep it if not args.keep_temps: