Skip to content

fix: resolve namespaced auto model identifiers - #1591

Open
tandede wants to merge 1 commit into
FlagOpen:masterfrom
tandede:fix/resolve-auto-model-identifiers
Open

fix: resolve namespaced auto model identifiers#1591
tandede wants to merge 1 commit into
FlagOpen:masterfrom
tandede:fix/resolve-auto-model-identifiers

Conversation

@tandede

@tandede tandede commented Aug 20, 2026

Copy link
Copy Markdown

Summary

  • resolve exact namespaced Hub model IDs before falling back to directory names
  • support local model and checkpoint directories through unambiguous basename matching
  • normalize trailing path separators consistently for auto embedders and rerankers

Problem

AUTO_RERANKER_MAPPING contains four namespaced model IDs, but FlagAutoReranker.from_finetuned() previously stripped the namespace before looking them up. As a result, every one of those supported entries raised ValueError before model loading began. The same basename-only parsing also failed for local paths whose mapped key includes a namespace, while trailing separators produced an empty model name.

The resolver now prefers an exact mapping key, preserves checkpoint parent resolution, and only uses a namespaced basename alias when it is unique. Ambiguous basenames remain unresolved instead of selecting an arbitrary model class.

Test plan

  • pytest -q tests (14 passed, 1 skipped with transformers 4.57.6)
  • ruff check --select E4,E7,E9,F,I on changed Python files
  • ruff format --check on the new resolver and regression test
  • python -m compileall -q FlagEmbedding/inference tests/test_auto_model_resolution.py

@tandede
tandede marked this pull request as ready for review August 20, 2026 10:48
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.

1 participant