Skip to content

Commit 888f05c

Browse files
committed
fix checking available files if from_onnx=True
1 parent 626006c commit 888f05c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

optimum/intel/openvino/modeling_base.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ def from_pretrained(
459459

460460
ov_files = _find_files_matching_pattern(
461461
model_dir,
462-
pattern=r"(.*)?openvino(.*)?\_model(.*)?.xml$",
462+
pattern=r"(.*)?openvino(.*)?\_model(.*)?.xml$" if kwargs.get("from_onnx", False) else r"model.onnx",
463463
subfolder=subfolder,
464464
use_auth_token=token,
465465
revision=revision,
@@ -477,6 +477,7 @@ def from_pretrained(
477477
f"No OpenVINO files were found for {model_id}, setting `export=True` to convert the model to the OpenVINO IR. "
478478
"Don't forget to save the resulting model with `.save_pretrained()`"
479479
)
480+
_export = False
480481
except Exception as exception:
481482
logger.warning(
482483
f"Could not infer whether the model was already converted or not to the OpenVINO IR, keeping `export={export}`.\n{exception}"

0 commit comments

Comments
 (0)