| # After data generation completes, upload the parquet shards + frames to HF. | |
| # Run with HF_TOKEN env var set, e.g.: | |
| # HF_TOKEN=hf_xxx OUT_DIR=./procthor_data REPO=whab13/prismvla-procthor-data bash upload_to_hf.sh | |
| set -e | |
| OUT_DIR="${OUT_DIR:-./procthor_data}" | |
| REPO="${REPO:-whab13/prismvla-procthor-data}" | |
| if [ -z "$HF_TOKEN" ]; then | |
| echo "Set HF_TOKEN first, e.g.: HF_TOKEN=hf_xxx bash upload_to_hf.sh" | |
| exit 1 | |
| fi | |
| source .venv/bin/activate | |
| pip install -q huggingface_hub | |
| # Use repo type DATASET | |
| python - <<PY | |
| import os | |
| from huggingface_hub import HfApi, create_repo | |
| api = HfApi(token="$HF_TOKEN") | |
| repo = "$REPO" | |
| try: | |
| create_repo(repo, repo_type="dataset", exist_ok=True, token="$HF_TOKEN") | |
| except Exception as e: | |
| print("create_repo:", e) | |
| # Upload the whole dir (parquet shards + frames/ subdir + manifest + logs) | |
| print(f"Uploading $OUT_DIR -> $REPO (this will take a while...)") | |
| api.upload_large_folder( | |
| folder_path="$OUT_DIR", | |
| repo_id="$REPO", | |
| repo_type="dataset", | |
| ) | |
| print("DONE.") | |
| PY | |