Skip to content

fix: guard HF_TOKEN env assignment against None when secret is not configured#576

Open
Dev-X25874 wants to merge 3 commits into
basetenlabs:mainfrom
Dev-X25874:fix/hf-token-none-assignment
Open

fix: guard HF_TOKEN env assignment against None when secret is not configured#576
Dev-X25874 wants to merge 3 commits into
basetenlabs:mainfrom
Dev-X25874:fix/hf-token-none-assignment

Conversation

@Dev-X25874

Copy link
Copy Markdown

This crashes the model at construction time — before load() is ever called —
with a confusing error unrelated to the actual missing configuration.

How

Wrap each assignment in a if self.hf_secret_token: guard, matching the pattern
already used correctly in flux.1-dev-trt-b200/model/model.py,
ngram-speculator/truss/model/model.py, and midnight/model/model.py.

Testing

The fix is a one-line guard per file. No functional change for deployments that
do supply hf_access_token; deployments against public models without the secret
configured will now load successfully instead of crashing.

@CLAassistant

CLAassistant commented May 16, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

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