Skip to content

feat(services/hf): honor HF_HUB_DISABLE_XET to force http download mode#7819

Open
AlJohri wants to merge 1 commit into
apache:mainfrom
AlJohri:services-hf-honor-hf-hub-disable-xet
Open

feat(services/hf): honor HF_HUB_DISABLE_XET to force http download mode#7819
AlJohri wants to merge 1 commit into
apache:mainfrom
AlJohri:services-hf-honor-hf-hub-disable-xet

Conversation

@AlJohri

@AlJohri AlJohri commented Jun 24, 2026

Copy link
Copy Markdown

Honor HF_HUB_DISABLE_XET (a huggingface_hub env var): when set non-empty and
no explicit download_mode is configured, force http instead of the Xet
default — matching the existing HF_HUB_DISABLE_IMPLICIT_TOKEN handling.

huggingface_hub documents HF_HUB_DISABLE_XET to disable the hf-xet integration and fall back to the classic resolve-redirect HTTP download. The services-huggingface backend already defaults download_mode to Xet and honors HF_ENDPOINT/HF_HOME, but had no equivalent to HF_HUB_DISABLE_XET.

Resolve download_mode via a new hf_download_mode(): an explicit .download_mode(...) config still wins; otherwise a set, non-empty HF_HUB_DISABLE_XET forces Http -- the same convention as the existing HF_HUB_DISABLE_IMPLICIT_TOKEN check; the default stays Xet. This lets downloads be forced through HF_ENDPOINT (e.g. a pull-through cache proxy) with no code change.

Signed-off-by: Al Johri <al.johri@gmail.com>
@AlJohri AlJohri marked this pull request as ready for review June 24, 2026 19:43
@AlJohri AlJohri requested a review from Xuanwo as a code owner June 24, 2026 19:43
@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. releases-note/feat The PR implements a new feature or has a title that begins with "feat" labels Jun 24, 2026

@erickguan erickguan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks! A documentation comment.

self
}

/// Set the download mode. Either `xet` (default) or `http`.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you document environment variable and resolution too? This is user documentation. We generate documentation for different language bindings.

And a http link to the environment variable is also helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

releases-note/feat The PR implements a new feature or has a title that begins with "feat" size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants