| # Upload repo contents to Hugging Face Hub via API (avoids broken git credential helpers). | |
| set -euo pipefail | |
| ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" | |
| cd "$ROOT" | |
| if [[ ! -f .env ]]; then | |
| echo "Missing .env with HF_TOKEN in $ROOT" | |
| exit 1 | |
| fi | |
| set -a | |
| # shellcheck disable=SC1091 | |
| source .env | |
| set +a | |
| if [[ -z "${HF_TOKEN:-}" ]]; then | |
| echo "HF_TOKEN is not set in .env" | |
| exit 1 | |
| fi | |
| REPO_ID="psidharth567/personal_math" | |
| echo "[*] Uploading $ROOT to https://huggingface.co/$REPO_ID (excluding .git and .env)..." | |
| hf auth login --token "$HF_TOKEN" --add-to-git-credential 2>/dev/null || true | |
| hf repos create "$REPO_ID" --repo-type model --exist-ok --token "$HF_TOKEN" || true | |
| hf upload "$REPO_ID" . \ | |
| --repo-type model \ | |
| --token "$HF_TOKEN" \ | |
| --exclude ".git/**" \ | |
| --exclude ".env" \ | |
| --exclude ".env.*" \ | |
| --commit-message "Sync full project: code, checkpoints, datasets, logs" \ | |
| --commit-description "Uploaded from local math denoising workspace." | |
| echo "[+] Done: https://huggingface.co/$REPO_ID" | |