echoctx's picture
Upload folder using huggingface_hub
ceea1a6 verified
Raw
History Blame Contribute Delete
2.87 kB
#!/usr/bin/env bash
# Stage the gate-passing `soup3` candidate into a PRIVATE HF repo so a future
# beatable throne costs one `commit` intent instead of an upload race.
#
# PRIVATE on purpose: SN3 has an observed weight-recycling rival (a prior cycle
# found the throne holder re-pushing another miner's weights). A public
# candidate can be fetched and committed by someone else first. Flip to public
# at commit time (one API call) — the validator only needs it public then.
set -uo pipefail
cd /var/lib/mining/work/tmix63
STATUS=soup3_stage_status.json
REPO=echoctx/sn3-soup3-candidate
say() { echo "[$(date -u +%H:%M:%S)] $*"; }
mkdir -p soup3
say "downloading soup3 from mining-checkpoints (explicit file paths: dir-get hits Errno 21)"
FILES="model.safetensors config.json generation_config.json configuration_qwen3_5.py modeling_qwen3_5.py"
for f in $FILES; do
if [ -s "soup3/$f" ]; then say " have $f"; continue; fi
say " get $f"
modal volume get mining-checkpoints "soup3/$f" "soup3/$f" -e mining || say " MISS $f"
done
ls -la soup3/ | sed 's/^/ /'
# The validator loads the repo with AutoModel+tokenizer; soup3 on the volume has
# no tokenizer files. Take them from the reigning king's PUBLIC repo (tokenizer
# is shared across the whole teutonic family — weights are what differ).
say "fetching tokenizer files from the king repo (weights NOT copied)"
hf download bluecolor/teutonic-q3-5ek5kr57gg-647127189391-rn-cp0 \
--include "token*" "*.txt" "special_tokens_map.json" "preprocessor*" \
--local-dir soup3-tok || say " tokenizer fetch failed (non-fatal)"
if [ -d soup3-tok ]; then
find soup3-tok -maxdepth 1 -type f ! -name "*.safetensors" -exec cp {} soup3/ \; 2>/dev/null
fi
ls -la soup3/ | sed 's/^/ /'
say "creating PRIVATE repo $REPO"
hf repos create sn3-soup3-candidate --type model --private 2>&1 | tail -2
say "uploading (this is ~20GB; may take a while)"
hf upload "$REPO" soup3 . --repo-type model 2>&1 | tail -5
RC=$?
SHA=$(curl -s -H "Authorization: Bearer $HF_TOKEN" \
"https://huggingface.co/api/models/$REPO" | python3 -c \
'import sys,json;d=json.load(sys.stdin);print(d.get("sha",""))' 2>/dev/null)
NFILES=$(curl -s -H "Authorization: Bearer $HF_TOKEN" \
"https://huggingface.co/api/models/$REPO" | python3 -c \
'import sys,json;d=json.load(sys.stdin);print(len(d.get("siblings",[])))' 2>/dev/null)
cat > "$STATUS" <<EOF
{
"repo": "$REPO",
"private": true,
"upload_rc": $RC,
"hf_commit_sha": "$SHA",
"n_files_api": "$NFILES",
"finished_at": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
"why_private": "rival weight-recycling observed on SN3; flip to public at commit time",
"not_yet": "NO commit intent enqueued; 1-hotkey-1-eval means the shot stays unspent until lcb999>0.0015 vs the REIGNING king",
"local_dir": "/var/lib/mining/work/tmix63/soup3"
}
EOF
say "done -> $STATUS"
cat "$STATUS"