huggingface / optimum-intel

🤗 Optimum Intel: Accelerate inference with Intel optimization tools
https://huggingface.co/docs/optimum/main/en/intel/index
Apache License 2.0
388 stars 110 forks source link

optionally enable export if not exported model provided #722

Closed eaidova closed 4 weeks ago

eaidova commented 4 months ago

What does this PR do?

Fixes # (issue)

Before submitting

HuggingFaceDocBuilderDev commented 4 months ago

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

ilya-lavrenov commented 4 months ago

@echarlaix @AlexKoff88 @helena-intel could you please review and merge before next optimum release?

AlexKoff88 commented 4 months ago

I don't have strong objections but I wonder if there is a more elegant way to do the same without introducing so much code that mostly duplicated Transformers logic. @echarlaix should know it better.

Also a test is required.

echarlaix commented 4 months ago

I don't have strong objections but I wonder if there is a more elegant way to do the same without introducing so much code that mostly duplicated Transformers logic. @echarlaix should know it better.

Also a test is required.

Yes I think we can simplify this by using find_files_matching_pattern like :

pattern = r"(.*)?openvino(.*)?\_model.xml"
ov_files = find_files_matching_pattern(
    model_name_or_path,
    pattern,
    subfolder=subfolder,
    use_auth_token=token,
    revision=revision,
)

export = len(ov_files) == 0

also used in https://github.com/huggingface/optimum-intel/pull/740 for the openvino pipelines