File size: 2,781 Bytes
b815c04
52d3f0f
b815c04
52d3f0f
 
 
 
b815c04
52d3f0f
b815c04
 
 
 
 
 
52d3f0f
b815c04
 
 
52d3f0f
b815c04
 
 
 
 
 
7c0dbd4
10ce3ea
b815c04
 
 
52d3f0f
b815c04
52d3f0f
 
 
 
 
8a9c144
 
 
 
b815c04
 
 
52d3f0f
b815c04
 
 
 
52d3f0f
b815c04
 
 
52d3f0f
 
 
b815c04
52d3f0f
b815c04
 
 
52d3f0f
 
b815c04
 
 
 
 
 
52d3f0f
b815c04
 
 
52d3f0f
 
 
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/env python3
"""Update every repo's README *and* the helper scripts in one run.

Korean  README  <- WORKFLOW.md        -> JSHNSL/humanoid-imitation-learning     (model)
English README  <- WORKFLOW_en.md     -> JSHNSL/humanoid-imitation-learning-en  (model)
HDF5 hub README <- HDF5_HUB_README.md -> JSHNSL/ffw_sg2_hdf5                    (dataset)
Scripts (push_dataset.py, push_hdf5.py, hpo_optuna.py, ...) -> Korean repo root

Whenever you edit a WORKFLOW/README or a script, run:
    lerobot-python sync_docs.py

Note: recent huggingface_hub versions accept keyword arguments only.
"""
import os

from huggingface_hub import create_repo, upload_file

KO = "JSHNSL/humanoid-imitation-learning"
EN = "JSHNSL/humanoid-imitation-learning-en"
HDF5_HUB = "JSHNSL/ffw_sg2_hdf5"

# Scripts published at the repo root (must match the tree in WORKFLOW.md).
SCRIPTS = [
    "push_dataset.py",      # LeRobot dataset -> training dataset repo
    "push_hdf5.py",         # raw HDF5 -> HDF5 hub dataset repo
    "merge_hdf5_demos.py",  # HDF5 merge
    "hpo_optuna.py",        # Optuna HPO + train from tuned params
    "hpo_train_shim.py",    # lerobot_train w/ EpisodeAwareSampler fixed for subsets
    "sync_docs.py",         # this file
]

# (local_file, path_in_repo, repo_id, repo_type)
DOCS = [
    ("WORKFLOW.md", "README.md", KO, "model"),
    ("WORKFLOW.md", "WORKFLOW.md", KO, "model"),
    ("WORKFLOW_en.md", "README.md", EN, "model"),
    ("WORKFLOW_en.md", "WORKFLOW_en.md", EN, "model"),
    ("HDF5_HUB_README.md", "README.md", HDF5_HUB, "dataset"),
    # Guides published alongside the KO workflow.
    ("SETUP_CYCLO_GROOT.md", "SETUP_CYCLO_GROOT.md", KO, "model"),
    ("GROOT_FINETUNE.md", "GROOT_FINETUNE.md", KO, "model"),
    ("WRIST_CAM.md", "WRIST_CAM.md", KO, "model"),
]


def push(local: str, dest: str, repo_id: str, repo_type: str = "model") -> None:
    upload_file(
        path_or_fileobj=local,
        path_in_repo=dest,
        repo_id=repo_id,
        repo_type=repo_type,
    )


# The HDF5 hub may not exist yet (its README can land before any HDF5 does).
create_repo(repo_id=HDF5_HUB, repo_type="dataset", exist_ok=True)

print("Docs:")
for local, dest, repo, rtype in DOCS:
    if not os.path.exists(local):
        print(f"  skip (not found): {local}")
        continue
    push(local, dest, repo, rtype)
    print(f"  {local} -> {repo}:{dest}  [{rtype}]")

print("\nScripts:")
for s in SCRIPTS:
    if not os.path.exists(s):
        print(f"  skip (not found): {s}")
        continue
    push(s, s, KO, "model")
    print(f"  {s} -> {KO}:{s}")

print("\nDone:")
print("  KO       ->", "https://huggingface.co/" + KO)
print("  EN       ->", "https://huggingface.co/" + EN)
print("  HDF5 hub ->", "https://huggingface.co/datasets/" + HDF5_HUB)