#!/bin/bash # HF Upload Script — run on VAE devspace after HF_TOKEN is set # Usage: # export HF_TOKEN=hf_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx # bash HF_UPLOAD_PLAN.sh set -euo pipefail : "${HF_TOKEN:?Set HF_TOKEN to an anonymous-account write token}" STAGE=~/bmvc_hf_release DATA_REPO_NAMES=( "anonymous-bmvc-2026-3d-contamination" "bmvc2026-3d-axes" "anon-bmvc26-contam-axes" ) echo "Logging in..." hf auth login --token "$HF_TOKEN" --add-to-git-credential 2>/dev/null || \ huggingface-cli login --token "$HF_TOKEN" --add-to-git-credential WHO=$(hf auth whoami 2>/dev/null || huggingface-cli whoami | head -1) echo "Logged in as: $WHO" # Try each name until one is free for both repos PICKED="" for NAME in "${DATA_REPO_NAMES[@]}"; do DATA_REPO="${WHO}/${NAME}-data" CKPT_REPO="${WHO}/${NAME}-checkpoints" # Try to create — if 409 (exists), skip to next if hf repo create "$DATA_REPO" --repo-type dataset --private false 2>&1 | grep -qiE "already exists|409"; then echo " $DATA_REPO already exists, trying next..." continue fi if hf repo create "$CKPT_REPO" --repo-type model --private false 2>&1 | grep -qiE "already exists|409"; then echo " $CKPT_REPO already exists, trying next..." continue fi PICKED="$NAME" break done if [ -z "$PICKED" ]; then echo "All candidate names were taken. Edit the DATA_REPO_NAMES list and retry." exit 1 fi DATA_REPO="${WHO}/${PICKED}-data" CKPT_REPO="${WHO}/${PICKED}-checkpoints" echo "Using: $DATA_REPO (dataset) + $CKPT_REPO (model)" # Upload data repo (everything except checkpoints/) echo "=== Uploading data repo ===" cd $STAGE # Upload README at root + all non-checkpoint dirs hf upload "$DATA_REPO" README.md README.md --repo-type dataset hf upload "$DATA_REPO" masks/ masks/ --repo-type dataset hf upload "$DATA_REPO" configs/ configs/ --repo-type dataset hf upload "$DATA_REPO" metrics/ metrics/ --repo-type dataset hf upload "$DATA_REPO" code/ code/ --repo-type dataset hf upload "$DATA_REPO" predictions/ predictions/ --repo-type dataset hf upload "$DATA_REPO" splits/ splits/ --repo-type dataset hf upload "$DATA_REPO" logs/ logs/ --repo-type dataset # Also upload claim map + reproduce as top-level docs hf upload "$DATA_REPO" CLAIM_TO_FILE_MAP.md CLAIM_TO_FILE_MAP.md --repo-type dataset hf upload "$DATA_REPO" REPRODUCE.md REPRODUCE.md --repo-type dataset hf upload "$DATA_REPO" CITATIONS.md CITATIONS.md --repo-type dataset hf upload "$DATA_REPO" LICENSE LICENSE --repo-type dataset # Upload checkpoint repo (model type for HF inference compatibility) echo "=== Uploading checkpoint repo ===" hf upload "$CKPT_REPO" README.md README.md --repo-type model hf upload "$CKPT_REPO" checkpoints/ . --repo-type model echo echo "Done. URLs:" echo " Data: https://huggingface.co/datasets/${DATA_REPO}" echo " Checkpoints: https://huggingface.co/${CKPT_REPO}"