Download get-model.sh from Entrit/llama.cpp-d2nl: direct link, hf CLI and curl.
- Browser
- Download file 1.36 kB
-
https://huggingface.co/Entrit/llama.cpp-d2nl/resolve/main/get-model.sh
- Command line
-
hf download hf://Entrit/llama.cpp-d2nl/get-model.sh
-
curl -L -o get-model.sh https://huggingface.co/Entrit/llama.cpp-d2nl/resolve/main/get-model.sh
1.36 kB
| # Download a model file from Hugging Face into models/. | |
| # | |
| # ./get-model.sh <repo> list the .gguf files in the repo | |
| # ./get-model.sh <repo> <file> download one of them | |
| # | |
| # Private repos need a token: export HF_TOKEN=hf_... (huggingface.co -> Settings -> Access Tokens) | |
| set -euo pipefail | |
| HERE=$(cd "$(dirname "$0")" && pwd) | |
| REPO=${1:?usage: ./get-model.sh <huggingface-repo> [file.gguf]} | |
| FILE=${2:-} | |
| AUTH=() | |
| [[ -n "${HF_TOKEN:-}" ]] && AUTH=(-H "Authorization: Bearer $HF_TOKEN") | |
| if [[ -z "$FILE" ]]; then | |
| echo "GGUF files in $REPO:" | |
| curl -fsSL ${AUTH[@]+"${AUTH[@]}"} "https://huggingface.co/api/models/$REPO" \ | |
| | grep -o '"rfilename":"[^"]*\.gguf"' | sed 's/"rfilename":"\(.*\)"/ \1/' \ | |
| || { echo "Could not read $REPO. Check the name, and set HF_TOKEN if the repo is private."; exit 1; } | |
| echo | |
| echo "Download one with: ./get-model.sh $REPO <file>" | |
| exit 0 | |
| fi | |
| mkdir -p "$HERE/models" | |
| OUT="$HERE/models/$(basename "$FILE")" | |
| echo "Downloading $FILE to models/ (it resumes if interrupted)" | |
| curl -fL -C - --progress-bar ${AUTH[@]+"${AUTH[@]}"} -o "$OUT" "https://huggingface.co/$REPO/resolve/main/$FILE" \ | |
| || { echo "Download failed. Check the file name, and set HF_TOKEN if the repo is private."; exit 1; } | |
| echo "Saved $OUT" | |
| echo "Run it with: ./run.sh models/$(basename "$FILE")" | |