msq-plurality-gap / code /fetch_models.sh
adeerkhan's picture
MSQ: the unstated premise
5264032 verified
Raw History Blame Contribute Delete
1.23 kB
#!/usr/bin/env bash
# Single-flight model fetch. One process at a time, revision pinned, so the
# LFS blobs are not fetched twice under two etags.
set -u
export HF_TOKEN="$(cat "$HOME/.config/fatima/hf_token")"
export PATH="/home/adeerkhan/github/fatima/.venv/bin:$PATH"
export HF_HUB_DISABLE_XET=1
export HF_HUB_ENABLE_HF_TRANSFER=1
declare -A REVS=(
[minicpm5-2b]="openbmb/MiniCPM5-2B:f97400052a43d642bbc6e9975e2397e3ae6a6b52"
[smollm3-3b]="HuggingFaceTB/SmolLM3-3B:main"
[qwen3-4b]="Qwen/Qwen3-4B-Instruct-2507:cdbee75f17c01a7cc42f958dc650907174af0554"
[phi4-mini]="microsoft/Phi-4-mini-instruct:main"
[minicpm5-2b-base]="openbmb/MiniCPM5-2B-Base:main"
[minicpm5-2b-sft]="openbmb/MiniCPM5-2B-SFT:main"
)
for name in "$@"; do
spec="${REVS[$name]:-}"
if [ -z "$spec" ]; then echo "unknown model $name"; continue; fi
repo="${spec%%:*}"; rev="${spec##*:}"
echo "[$(date +%T)] start $name -> $repo@$rev"
hf download "$repo" --revision "$rev" --max-workers 4 > "/home/adeerkhan/github/fatima/logs/dl_$name.log" 2>&1
rc=$?
sz=$(du -sm "$HOME/.cache/huggingface/hub/models--${repo//\//--}" 2>/dev/null | cut -f1)
echo "[$(date +%T)] done $name rc=$rc size=${sz}MB"
done
echo "[$(date +%T)] FETCH COMPLETE"