Skip to content

Infer whether a model needs to be exported to ONNX or not#2181

Merged
echarlaix merged 44 commits into
mainfrom
infer-export
Feb 12, 2025
Merged

Infer whether a model needs to be exported to ONNX or not#2181
echarlaix merged 44 commits into
mainfrom
infer-export

Conversation

@echarlaix

@echarlaix echarlaix commented Feb 4, 2025

Copy link
Copy Markdown
Collaborator

Infer whether the model should be exported or not by checking whether a .onnx file is present when loading the model, removing the need to specify the export argument

  from optimum.onnxruntime import ORTModelForCausalLM

  model_id = "optimum-internal-testing/tiny-random-llama"
- model = ORTModelForCausalLM.from_pretrained(model_id, export=True)
+ model = ORTModelForCausalLM.from_pretrained(model_id)

@echarlaix echarlaix changed the title Infer export Add _find_files_matching_pattern to infer export Feb 4, 2025
@echarlaix
echarlaix marked this pull request as ready for review February 4, 2025 17:18
@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

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.

@echarlaix echarlaix changed the title Add _find_files_matching_pattern to infer export Infer whether a model needs to be exported to ONNX or not Feb 6, 2025
@echarlaix

Copy link
Copy Markdown
Collaborator Author

Failing tests unrelated so merging

@echarlaix
echarlaix merged commit 6335599 into main Feb 12, 2025
@echarlaix
echarlaix deleted the infer-export branch February 12, 2025 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants