Skip to content

Allow HF endpoint override via HF_ENDPOINT env var#140

Open
yeruoforever wants to merge 1 commit intohuggingface:mainfrom
yeruoforever:main
Open

Allow HF endpoint override via HF_ENDPOINT env var#140
yeruoforever wants to merge 1 commit intohuggingface:mainfrom
yeruoforever:main

Conversation

@yeruoforever
Copy link
Copy Markdown

Summary

Allow HF_ENDPOINT environment variable to be respected when using local cache for model/dataset updates.

Motivation / Problem Statement

Currently, when users specify a custom Hugging Face endpoint via HF_ENDPOINT environment variable for downloading models or datasets, this setting is not persisted or respected during subsequent cache operations.

Scenario:

  1. User sets HF_ENDPOINT=https://hf-mirror.com to download a model from a mirror server
  2. The model is cached locally in ~/.cache/huggingface/
  3. Later, when checking for model updates or refreshing cache, the system defaults to https://huggingface.co instead of respecting the originally configured HF_ENDPOINT

This breaks the expected behavior where users consistently want to use their specified mirror server for all Hugging Face Hub operations, including cache refresh and version updates.

Proposed Changes
Update endpoint resolution logic to read from environment variable with appropriate fallback:

let endpoint = std::env::var(HF_ENDPOINT).unwrap_or("https://huggingface.co".to_string());

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.

1 participant