#!/usr/bin/env bash # Build a HF-upload-friendly tree: pack paths containing '=' into .tar.gz archives. # # Hugging Face upload often fails on paths like videos/.../obj=img_13=human=img_2.mp4 # (RuntimeError on path_in_repo). Tarballs avoid per-file URL issues. # # Usage: # bash scripts/package_hf_upload.sh # cd hf_upload_staging && hf upload USER/agenthoi-eval . . --repo-type dataset # # After download: # bash scripts/unpack_hf_download.sh set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # shellcheck source=eval_common.sh source "${SCRIPT_DIR}/eval_common.sh" STAGING="${EVAL_ROOT}/hf_upload_staging" rm -rf "${STAGING}" mkdir -p "${STAGING}" echo "[package_hf] staging -> ${STAGING}" rsync -a \ --exclude 'hf_upload_staging' \ --exclude 'deps' \ --exclude 'env.local.sh' \ --exclude '*.local' \ --exclude 'videos' \ --exclude 'benchmarks/assets' \ --exclude 'results' \ "${EVAL_ROOT}/" "${STAGING}/" # Paths with '=' in filenames (obj=img_*=human=img_*) break hf upload per-file. # Pack those trees into single .tar.gz blobs — Hub only sees safe repo paths. for spec in \ "videos:${EVAL_ROOT}:videos" \ "benchmarks_assets:${EVAL_ROOT}/benchmarks:assets" \ "results:${EVAL_ROOT}:results"; do key="${spec%%:*}" rest="${spec#*:}" src_dir="${rest%%:*}" tar_path="${rest#*:}" out="${STAGING}/${key}.tar.gz" if [ -d "${src_dir}/${tar_path}" ]; then echo "[package_hf] packing ${tar_path}/ -> ${key}.tar.gz" tar -czf "${out}" -C "${src_dir}" "${tar_path}" fi done # Readable by upload tool / other users find "${STAGING}" -type f ! -perm -004 -exec chmod o+r {} + 2>/dev/null || true du -sh "${STAGING}" "${STAGING}"/*.tar.gz 2>/dev/null || du -sh "${STAGING}" echo "" echo "Upload from staging (not evaluation/ root):" echo " cd ${STAGING}" echo " hf upload YOUR_USER/agenthoi-eval . . --repo-type dataset" echo "" echo "After download: cd agenthoi-eval && bash scripts/unpack_hf_download.sh"