Skip to content

Commit

Permalink
remove infer export in pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
echarlaix committed Jul 25, 2024
1 parent 27bfc3d commit b1e0b06
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions optimum/intel/pipelines/pipeline_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
is_ipex_available,
is_openvino_available,
)
from optimum.intel.utils.modeling_utils import _find_files_matching_pattern


if is_ipex_available():
Expand Down Expand Up @@ -229,20 +228,9 @@ def load_openvino_model(
model_kwargs = model_kwargs or {}
ov_model_class = SUPPORTED_TASKS[targeted_task]["class"][0]

if model is None:
model_id = SUPPORTED_TASKS[targeted_task]["default"]
model = ov_model_class.from_pretrained(model_id, export=True, **hub_kwargs, **model_kwargs)
elif isinstance(model, str):
model_id = model
pattern = r"(.*)?openvino(.*)?\_model.xml"
ov_files = _find_files_matching_pattern(
model,
pattern,
use_auth_token=hub_kwargs.get("token", None),
revision=hub_kwargs.get("revision", None),
)
export = len(ov_files) == 0
model = ov_model_class.from_pretrained(model, export=export, **hub_kwargs, **model_kwargs)
if isinstance(model, str) or model is None:
model_id = model or SUPPORTED_TASKS[targeted_task]["default"]
model = ov_model_class.from_pretrained(model_id, **hub_kwargs, **model_kwargs)
elif isinstance(model, OVBaseModel):
model_id = model.model_save_dir
else:
Expand Down

0 comments on commit b1e0b06

Please sign in to comment.