Skip to content

fix(inference): pass the token through when loading the encoder - #362

Merged
stephantul merged 2 commits into
MinishLab:mainfrom
serhiizghama:fix/pipeline-token-passthrough
Sep 10, 2026
Merged

fix(inference): pass the token through when loading the encoder#362
stephantul merged 2 commits into
MinishLab:mainfrom
serhiizghama:fix/pipeline-token-passthrough

Conversation

@serhiizghama

Copy link
Copy Markdown
Contributor

StaticModelPipeline.from_pretrained documents that a private hub model needs a token, and it does use it — but only for head.safetensors. The encoder load right after it calls StaticModel.from_pretrained(folder_or_repo_path) with no token, so on a private repo the head downloads fine and the model itself then fails auth. Same call in convert_legacy_pipeline, so the legacy path has it too. Passed token through in both places.

test_load_pipeline_from_hub doesn't catch this because it patches StaticModel.from_pretrained wholesale and only asserts on the head download, so I added two tests that check the token actually reaches the encoder call — one per path. Both fail on main (assert None == 'secret') and pass with the change; full suite 295 passed, ruff clean.

@codecov

codecov Bot commented Sep 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
model2vec/inference/model.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@stephantul stephantul left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey @serhiizghama,

Thanks for spotting this, great find!

@stephantul
stephantul merged commit e8c8603 into MinishLab:main Sep 10, 2026
11 checks passed
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