Skip to content

download: honour HF_ENDPOINT in the curl path - #753

Open
gaook wants to merge 1 commit into
antirez:mainfrom
gaook:hf-endpoint
Open

download: honour HF_ENDPOINT in the curl path#753
gaook wants to merge 1 commit into
antirez:mainfrom
gaook:hf-endpoint

Conversation

@gaook

@gaook gaook commented Aug 9, 2026

Copy link
Copy Markdown

Problem

download_model.sh has two download paths, and they disagree about which host to use.

The pro-*, glm-*, and ds4f-mxfp4 targets go through the official Hugging Face CLI, which already reads HF_ENDPOINT, so those can be pointed at a mirror today. The curl path used for the smaller DeepSeek Flash GGUFs hardcodes huggingface.co, so exactly the targets most people download — ds4f-q2 and friends — cannot use one.

Where huggingface.co is slow or unreachable, an 81 GB download is the difference between a working and a non-working setup, and there is currently no way to redirect it short of editing the script.

Change

Read the same HF_ENDPOINT variable in the curl path and in the two "from ..." progress messages, so both downloaders resolve to the same host. Also document it in the Environment: help block next to DS4_GGUF_DIR.

Unset behaviour is unchanged: ${HF_ENDPOINT:-https://huggingface.co} yields the current URL, so no existing invocation changes.

3 substituted lines + 4 lines of help text. No inference code touched.

Testing

Machine: MacBook Pro M5 Max, 128 GB, macOS 26.4, Metal backend.
Model quant: ds4f-q2 (...chat-v2-imatrix-0731.gguf, 80.76 GiB).

  • Downloaded the full ds4f-q2 target through HF_ENDPOINT=https://hf-mirror.com with this patch applied: completed in one attempt, and the resulting file is byte-exact against the size huggingface.co reports (86720111488).
  • Verified the model afterwards: ./ds4 --inspect reports the expected 43 layers / 1328 tensors / 284.33 B parameters, and ./ds4 -p ... --nothink generates correctly.
  • Verified the unset path still resolves to https://huggingface.co/... (default preserved).
  • sh -n download_model.sh clean; ./download_model.sh --help renders the new Environment: entry.

No correctness or speed regression tests were run, as the change is confined to the download shell script and cannot affect any inference backend.

The official Hugging Face CLI already reads HF_ENDPOINT, so the pro-*, glm-*,
and ds4f-mxfp4 targets can already be pointed at a mirror. The curl path used
by the smaller DeepSeek Flash GGUFs hardcoded huggingface.co, so the two
downloaders disagreed and the most commonly downloaded files (ds4f-q2 and
friends) could not use one.

Read the same variable in the curl path and in the two progress messages, so
both downloaders resolve to the same host. Unset behaviour is unchanged:
${HF_ENDPOINT:-https://huggingface.co} still yields the current URL.

This matters where huggingface.co is slow or unreachable; an 81GB download
over a mirror is the difference between a working and a non-working setup.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.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.

1 participant