fix: accept Hugging Face configs without a model_type in HfModel - #2691
Open
Yuri Khrustalev (ykhrustalev) wants to merge 1 commit into
Open
Yuri Khrustalev (ykhrustalev) wants to merge 1 commit into
Yuri Khrustalev (ykhrustalev) wants to merge 1 commit into
Conversation
LiquidAI/LFM2.5-Audio-1.5B has no model_type in its config.json, so AutoConfig rejects it and HfModelHandler can't be built, though the ORT GenAI model builder supports it. Fall back to a plain PretrainedConfig then; unknown model types and untrusted remote-code configs still raise.
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Copilot started reviewing on behalf of
Yuri Khrustalev (ykhrustalev)
September 25, 2026 23:17
View session
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
No unresolved issues were identified, and all reviewed changes are covered by tests.
Review effort: Lite
Findings: None
What changed in this PR
Adds support for Hugging Face checkpoints whose configurations lack model_type, enabling HfModel and ModelBuilder processing.
Changes:
- Falls back to
PretrainedConfigwhile preserving load kwargs. - Retains validation for unknown types and untrusted remote code.
- Adds focused unit tests.
| File | Description |
|---|---|
test/common/test_hf.py |
Tests fallback behavior and error cases. |
olive/common/hf/utils.py |
Implements configuration fallback logic. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe your changes
Problem
LiquidAI/LFM2.5-Audio-1.5Bhas nomodel_typein itsconfig.json, soAutoConfigrejects it andHfModelHandlercan't be constructed. onnxruntime-genai's model builder already supports this checkpoint, so only Olive blocksModelBuilder.Solution
PretrainedConfiginget_model_configwhen the config has nomodel_typeAutoConfigdoestrust_remote_codeTesting
ModelBuilderon a tiny random checkpoint with the LFM2.5-Audio config layout: it producedmodel.onnxand agenai_config.jsonof typelfm2_audio_text(onnxruntime-genai 0.17.0)Checklist before requesting a review
lintrunner -aRelease note:
HfModelaccepts Hugging Face checkpoints whoseconfig.jsonhas nomodel_type, such asLiquidAI/LFM2.5-Audio-1.5B, soModelBuildercan convert them.