Skip to content

fix: skip config.json download counter when HF_HUB_OFFLINE is set#62

Open
haosenwang1018 wants to merge 1 commit intoNVIDIA:mainfrom
haosenwang1018:fix/skip-hf-download-in-offline-mode
Open

fix: skip config.json download counter when HF_HUB_OFFLINE is set#62
haosenwang1018 wants to merge 1 commit intoNVIDIA:mainfrom
haosenwang1018:fix/skip-hf-download-in-offline-mode

Conversation

@haosenwang1018
Copy link

Problem

Line 429 in server.py calls hf_hub_download(args.hf_repo, "config.json") unconditionally to increment the download counter. When HF_HUB_OFFLINE=1 is set, this fails because the HuggingFace Hub client cannot reach the server.

Fix

Guard the download counter call with os.environ.get("HF_HUB_OFFLINE"). The call is only used for analytics and is not required for the server to function.

Fixes #54

The hf_hub_download call for config.json (used only to increment
the download counter) fails when HF_HUB_OFFLINE=1. Guard the call
with an environment variable check.

Fixes NVIDIA#54

Signed-off-by: haosenwang1018 <haosenwang1018@users.noreply.github.com>
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.

Disabling Huggingface access causes failure

1 participant