Startup 401 on a public model: the load sends a token the Hub rejects

#14
by nootxlm - opened

Every boot of this Space dies loading the tokenizer:

huggingface_hub.utils._errors.RepositoryNotFoundError: 401 Client Error.
Repository Not Found for url: https://huggingface.co/bigcode/santacoder/resolve/main/tokenizer_config.json
Invalid credentials in Authorization header

app.py reads a token from the HUB_TOKEN secret and passes it as use_auth_token on every from_pretrained call. The Hub's answer names the problem: the credentials in the Authorization header are invalid — the request is not anonymous, it is badly authenticated. And no authentication is needed here: bigcode/santacoder is a public model (its Hub API record reads gated: false, private: false), so a token adds nothing except a way to fail.

The fix is to drop the token from the loads — remove use_auth_token from the from_pretrained calls in app.py (the model it loads for generation, bigcode/christmas-models, should be checked the same way). Replacing the secret with a valid read token also works, but for public models the token is pure downside: it can expire or be revoked and take the demo down with it, exactly as happened here.

Check: after the change, a restart loads the tokenizer and the model with no Authorization header and reaches the Gradio launch.

Sign up or log in to comment