Fix fallback for backbone-only EAT checkpoints#167
Open
nkundiushuti wants to merge 1 commit intomainfrom
Open
Conversation
When a checkpoint has no classifier and no label mapping, automatically switch to embedding mode for models that support return_features_only.
There was a problem hiding this comment.
Pull request overview
Adjusts model loading to gracefully handle backbone-only EAT checkpoints (no classifier head and no label mapping) by automatically falling back to embedding extraction mode when the model supports return_features_only.
Changes:
- Update
_load_from_modelspec()to enablereturn_features_only=Truewhen a checkpoint exists butnum_classescan’t be inferred and the model supports feature-only mode. - Add a unit test covering the “checkpoint present but no classifier detected” fallback behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
avex/models/utils/load.py |
Broadens the fallback logic so backbone-only checkpoints trigger embedding-mode loading when supported. |
tests/unittests/test_api_load.py |
Adds a unit test asserting that backbone-only checkpoints cause automatic fallback to return_features_only. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
When a checkpoint has no classifier and no label mapping, automatically switch to embedding mode for models that support return_features_only.
More details: