Download scripts/hf_pull.sh from scs09/zenex-ai-project: direct link, hf CLI and curl.
- Browser
- Download file 1.88 kB
-
https://huggingface.co/datasets/scs09/zenex-ai-project/resolve/main/scripts/hf_pull.sh
- Command line
-
hf download hf://datasets/scs09/zenex-ai-project/scripts/hf_pull.sh
-
curl -L -o hf_pull.sh https://huggingface.co/datasets/scs09/zenex-ai-project/resolve/main/scripts/hf_pull.sh
1.88 kB
| # Download Zenex checkpoint from Hugging Face Model Hub | |
| # | |
| # Usage: | |
| # scripts/hf_pull.sh # pull latest.pt to checkpoints/train-zenex-moe/artifacts/ | |
| # scripts/hf_pull.sh v3 # pull from HF repo but save as train-zenex-moe-v3 | |
| set -euo pipefail | |
| HF_USERNAME="${HF_USERNAME:-shashankmacherla09}" | |
| HF_REPO_NAME="${HF_REPO_NAME:-zenex-moe}" | |
| HF_REPO="$HF_USERNAME/$HF_REPO_NAME" | |
| VARIANT="${1:-}" | |
| ROOT="$(cd "$(dirname "$0")/.." && pwd)" | |
| CHECKPOINT_DIR="$ROOT/checkpoints/train-zenex-moe" | |
| if [[ -n "$VARIANT" && "$VARIANT" != --* ]]; then | |
| CHECKPOINT_DIR="$ROOT/checkpoints/train-zenex-moe-$VARIANT" | |
| fi | |
| ARTIFACTS_DIR="$CHECKPOINT_DIR/artifacts" | |
| mkdir -p "$ARTIFACTS_DIR" | |
| echo "==> Hugging Face Pull Configuration" | |
| echo " Repo: $HF_REPO" | |
| echo " Target: $ARTIFACTS_DIR" | |
| echo "" | |
| export PATH="$HOME/Library/Python/3.9/bin:$HOME/.local/bin:$PATH" | |
| echo "==> Downloading from $HF_REPO..." | |
| python3 - "$HF_REPO" "$ARTIFACTS_DIR" "$TOKENIZER_DIR" <<'PYTHON' | |
| import sys, os | |
| from pathlib import Path | |
| from huggingface_hub import hf_hub_download | |
| repo_id, artifacts_dir, tokenizer_dir = sys.argv[1:4] | |
| # Download checkpoint | |
| try: | |
| Path(artifacts_dir).mkdir(parents=True, exist_ok=True) | |
| ckpt = hf_hub_download(repo_id, "latest.pt", repo_type="model", local_dir=artifacts_dir) | |
| print(f"✓ Checkpoint: {ckpt}") | |
| except Exception as e: | |
| print(f"⚠ Checkpoint error: {e}") | |
| # Download tokenizer | |
| Path(tokenizer_dir).mkdir(parents=True, exist_ok=True) | |
| for fname in ["tokenizer.model", "tokenizer.vocab"]: | |
| try: | |
| path = hf_hub_download(repo_id, fname, repo_type="model", local_dir=tokenizer_dir) | |
| print(f"✓ {fname}") | |
| except Exception as e: | |
| print(f"⚠ {fname}: {e}") | |
| print(f"\n==> Ready at:") | |
| print(f" Checkpoint: {artifacts_dir}/latest.pt") | |
| print(f" Tokenizer: {tokenizer_dir}/") | |
| PYTHON | |