chen-gao commited on
Commit
cb10448
·
verified ·
1 Parent(s): b16c934

Sync root metadata

Browse files
Files changed (1) hide show
  1. sync_dualsim.sh +42 -21
sync_dualsim.sh CHANGED
@@ -1,37 +1,56 @@
1
  #!/usr/bin/env bash
2
  #
3
- # Sync this local `dualsim` folder to the Hugging Face dataset repo.
4
  #
5
  # Repo: https://huggingface.co/datasets/chen-gao/dualsim
6
  #
7
- # `hf upload` hashes every file and ONLY uploads files that are new or changed —
8
- # unchanged files are skipped, so re-running this after edits pushes just the deltas.
9
- # Each run is a versioned commit on the Hub.
 
 
 
 
 
10
  #
11
  # Usage:
12
- # ./sync_dualsim.sh # sync eval + metadata AND train (110 GB)
13
- # ./sync_dualsim.sh eval # sync only eval + repo metadata (fast)
14
- # ./sync_dualsim.sh train # sync only train/AgiBotWorld2026
 
 
15
  #
16
- # Prereq: `hf auth login` (token with write access) done once.
17
 
18
  set -euo pipefail
19
 
20
  REPO="chen-gao/dualsim"
21
  HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
22
  WHAT="${1:-all}"
23
-
24
  hf_bin="$(command -v hf || echo "$HOME/.local/bin/hf")"
25
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  sync_eval() {
27
- echo ">> Uploading eval + repo metadata (train/** excluded) ..."
28
- "$hf_bin" upload "$REPO" "$HERE" . \
29
  --repo-type dataset \
30
- --exclude "train/**" \
31
- --exclude ".git/**" \
32
- --exclude "**/__pycache__/**" \
33
- --exclude "*.pyc" \
34
- --commit-message "Sync eval + metadata"
35
  }
36
 
37
  sync_train() {
@@ -41,17 +60,19 @@ sync_train() {
41
  echo "!! train/AgiBotWorld2026 does not resolve to a directory ($src) — skipping train." >&2
42
  return 0
43
  fi
44
- echo ">> Uploading train content from $src -> train/AgiBotWorld2026/ ..."
45
- "$hf_bin" upload "$REPO" "$src" train/AgiBotWorld2026 \
46
  --repo-type dataset \
47
- --commit-message "Sync train/AgiBotWorld2026"
 
48
  }
49
 
50
  case "$WHAT" in
 
51
  eval) sync_eval ;;
52
  train) sync_train ;;
53
- all) sync_eval; sync_train ;;
54
- *) echo "Usage: $0 [all|eval|train]" >&2; exit 2 ;;
55
  esac
56
 
57
  echo ">> Done. https://huggingface.co/datasets/$REPO"
 
1
  #!/usr/bin/env bash
2
  #
3
+ # MIRROR-sync this local `dualsim` folder to the Hugging Face dataset repo.
4
  #
5
  # Repo: https://huggingface.co/datasets/chen-gao/dualsim
6
  #
7
+ # Uses `hf upload --delete "*"` per subtree so the Hub becomes an EXACT MIRROR of
8
+ # local: new/changed files are uploaded, and files deleted locally are ALSO deleted
9
+ # on the Hub. `hf upload` hashes files, so unchanged files are skipped (only deltas
10
+ # transfer). Each run is a versioned commit on the Hub.
11
+ #
12
+ # --delete is scoped to each subtree's path_in_repo (verified against
13
+ # huggingface_hub._prepare_folder_deletions: patterns are matched RELATIVE to
14
+ # path_in_repo), so the `eval` sync can never touch `train/` and vice-versa.
15
  #
16
  # Usage:
17
+ # ./sync_dualsim.sh # mirror meta + eval + train
18
+ # ./sync_dualsim.sh eval # mirror eval subtree only (fast)
19
+ # ./sync_dualsim.sh train # mirror train/AgiBotWorld2026 only
20
+ # ./sync_dualsim.sh meta # push root files (README/.gitattributes/this script)
21
+ # DRY=1 ./sync_dualsim.sh eval # print what would upload/delete, do nothing
22
  #
23
+ # Prereq: `hf auth login` (write token) done once.
24
 
25
  set -euo pipefail
26
 
27
  REPO="chen-gao/dualsim"
28
  HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
29
  WHAT="${1:-all}"
30
+ DRY="${DRY:-0}"
31
  hf_bin="$(command -v hf || echo "$HOME/.local/bin/hf")"
32
 
33
+ run() {
34
+ if [[ "$DRY" == "1" ]]; then echo "[DRY-RUN] $*"; else "$@"; fi
35
+ }
36
+
37
+ # Root-level files only (README, .gitattributes, sync script). No --delete here to
38
+ # avoid ever matching the eval/ or train/ subtrees at repo root.
39
+ sync_meta() {
40
+ echo ">> Uploading root metadata files ..."
41
+ run "$hf_bin" upload "$REPO" "$HERE" . \
42
+ --repo-type dataset \
43
+ --exclude "eval/**" --exclude "train/**" \
44
+ --exclude ".git/**" --exclude "**/__pycache__/**" --exclude "*.pyc" \
45
+ --commit-message "Sync root metadata"
46
+ }
47
+
48
  sync_eval() {
49
+ echo ">> Mirroring eval/ subtree (uploads changes, deletes stale) ..."
50
+ run "$hf_bin" upload "$REPO" "$HERE/eval" eval \
51
  --repo-type dataset \
52
+ --delete "*" \
53
+ --commit-message "Mirror eval"
 
 
 
54
  }
55
 
56
  sync_train() {
 
60
  echo "!! train/AgiBotWorld2026 does not resolve to a directory ($src) — skipping train." >&2
61
  return 0
62
  fi
63
+ echo ">> Mirroring train/AgiBotWorld2026 subtree from $src ..."
64
+ run "$hf_bin" upload "$REPO" "$src" train/AgiBotWorld2026 \
65
  --repo-type dataset \
66
+ --delete "*" \
67
+ --commit-message "Mirror train/AgiBotWorld2026"
68
  }
69
 
70
  case "$WHAT" in
71
+ meta) sync_meta ;;
72
  eval) sync_eval ;;
73
  train) sync_train ;;
74
+ all) sync_meta; sync_eval; sync_train ;;
75
+ *) echo "Usage: $0 [all|meta|eval|train] (DRY=1 for dry-run)" >&2; exit 2 ;;
76
  esac
77
 
78
  echo ">> Done. https://huggingface.co/datasets/$REPO"