Skip to content

fix(loader): resolve registered custom architectures and validate weights - #1459

Draft
Qiong Wu (qiowu) (DingmaomaoBJTU) wants to merge 2 commits into
mainfrom
codex/fix-checkpoint-loader-resolution
Draft

Qiong Wu (qiowu) (DingmaomaoBJTU) wants to merge 2 commits into
mainfrom
codex/fix-checkpoint-loader-resolution

Conversation

@DingmaomaoBJTU

@DingmaomaoBJTU Qiong Wu (qiowu) (DingmaomaoBJTU) commented Sep 29, 2026 •

Copy link
Copy Markdown
Collaborator

The declared Wav2Vec2ForSpeechClassification architecture is not a Transformers class, so automatic loading could select a different head. Resolve registered custom architectures using native model_type, architecture and required config fields instead of an exact Hugging Face repository ID. The emotion regression registration reuses the existing EmotionModel and export variant; default performance settings remain unchanged. Renamed repositories and local copies follow the same metadata-based route.

Explicit task/class/type choices retain precedence. Ambiguous declarations and incompatible registered configs fail explicitly. EmotionModel opts into complete checkpoint loading checks: missing, unexpected, mismatched weights or loading errors reject the model instead of silently using a partially initialized head. This validates compatibility with an explicitly registered architecture, not arbitrary inference of forward semantics.

Validation: 721 loader/build-config tests passed; the restored direct-loader tests separately passed (27 tests). Ruff and diff checks passed. Real local-checkpoint automatic loading reached the custom model/export path without -c; the subsequent full ONNX export attempt failed due to insufficient disk space, so no complete build claim is made for this revision. No NPU benchmark or performance change is included.

Comment thread src/winml/modelkit/models/hf/wav2vec2.py Fixed
@DingmaomaoBJTU Qiong Wu (qiowu) (DingmaomaoBJTU) changed the title fix(loader): resolve custom checkpoint heads without recipe configs fix(loader): resolve registered custom architectures and validate weights Sep 29, 2026
EMOTION_REGRESSION_MODEL_TYPE = "wav2vec2_emotion_regression"

# Architecture identity selects the custom head, never performance settings.
ARCHITECTURE_LOADER_DEFAULTS = {

This branch has not been deployed

No deployments
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