File size: 1,984 Bytes
271f3e5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/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"