diff --git a/optimum/onnxruntime/modeling_decoder.py b/optimum/onnxruntime/modeling_decoder.py index 5afb31637b..ae160d1b34 100644 --- a/optimum/onnxruntime/modeling_decoder.py +++ b/optimum/onnxruntime/modeling_decoder.py @@ -161,6 +161,7 @@ def __init__( setattr(self.generation_config, param_name, param_value) setattr(self.config, param_name, None) + self.model_path = Path(model._model_path) self.use_merged = "use_cache_branch" in self.input_names self.model_type = self.config.model_type diff --git a/optimum/onnxruntime/optimization.py b/optimum/onnxruntime/optimization.py index 99b9ab272d..fd6958bba7 100644 --- a/optimum/onnxruntime/optimization.py +++ b/optimum/onnxruntime/optimization.py @@ -104,7 +104,7 @@ def from_pretrained( "Please re-export your model. This can be done by using the optimum-cli ONNX export tool or `ORTModelForCausalLM.from_pretrained(..., export=True, use_merged=False)`." ) else: - onnx_model_path.append(model_or_path.model._model_path) + onnx_model_path.append(model_or_path.model_path) config = model_or_path.config elif os.path.isdir(model_or_path): from_ortmodel = False