Skip to content

Fix fallback for backbone-only EAT checkpoints#167

Open
nkundiushuti wants to merge 1 commit intomainfrom
fix/eat-backbone-only-embeddings-fallback
Open

Fix fallback for backbone-only EAT checkpoints#167
nkundiushuti wants to merge 1 commit intomainfrom
fix/eat-backbone-only-embeddings-fallback

Conversation

@nkundiushuti
Copy link
Copy Markdown
Contributor

When a checkpoint has no classifier and no label mapping, automatically switch to embedding mode for models that support return_features_only.
More details:

  • list_model_layers() loads esp_aves2_eat_* with return_features_only=False, but those checkpoints are backbone-only (no classifier / label map), triggering num_classes must be > 0.
  • load_model() now detects “checkpoint present but no classifier found” and automatically switches to return_features_only=True when supported.
  • Added a unit test covering backbone-only checkpoint fallback.

When a checkpoint has no classifier and no label mapping, automatically switch to
embedding mode for models that support return_features_only.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 enable return_features_only=True when a checkpoint exists but num_classes can’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.

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