Skip to content

fix: load auto models from paths with trailing separators - #1621

Open
emme1t wants to merge 1 commit into
FlagOpen:masterfrom
emme1t:fix/auto-model-trailing-separator-1324
Open

emme1t wants to merge 1 commit into
FlagOpen:masterfrom
emme1t:fix/auto-model-trailing-separator-1324

Conversation

@emme1t

@emme1t emme1t commented Nov 1, 2026

Copy link
Copy Markdown

Fixes #1324.

Loading a local model directory ending in / currently produces an empty registry name and raises ValueError. Normalize the path used for model-class lookup in both auto loaders, including checkpoint-parent lookup, while forwarding the original path to the selected model constructor.

The earlier #1591 included path normalization; it was closed in favor of #1594, which updated four reranker registry keys. The trailing-separator failure remains on current master. This patch covers that remaining path case.

Validation on Windows / Python 3.12 / Torch 2.15.0 CPU / Transformers 5.22.1:

  • Offline regression tests save tiny local Bert embedding and reranking models, then compare actual inference for normal/checkpoint paths with single and repeated slash/native separators.
  • Original source: 16 failed, 4 passed. Fixed regression plus existing import and Trainer compatibility tests: 29 passed.
  • Changed-file Ruff checks, new-test formatting, compilation, dependency consistency and wheel build pass.

Full pretrained-model/GPU tests were not run.

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.

os.path.basename will get empty model_name if path is given end with "/"

1 participant