bot commited on
Commit ·
40bbdfd
1
Parent(s): 69ef308
Upload checkpoints to separate repo, add Path import
Browse files
lerobot/src/lerobot/scripts/lerobot_train.py
CHANGED
|
@@ -478,12 +478,14 @@ def train(cfg: TrainPipelineConfig, accelerator: Accelerator | None = None):
|
|
| 478 |
try:
|
| 479 |
from huggingface_hub import HfApi
|
| 480 |
api = HfApi()
|
|
|
|
|
|
|
| 481 |
api.upload_folder(
|
| 482 |
folder_path=checkpoint_dir,
|
| 483 |
-
repo_id=
|
| 484 |
-
path_in_repo=f"
|
| 485 |
)
|
| 486 |
-
logging.info(f"Uploaded checkpoint step {step} to
|
| 487 |
uploaded = True
|
| 488 |
except Exception as e:
|
| 489 |
logging.warning(f"Failed to upload checkpoint step {step}: {e}")
|
|
|
|
| 478 |
try:
|
| 479 |
from huggingface_hub import HfApi
|
| 480 |
api = HfApi()
|
| 481 |
+
checkpoint_repo = cfg.policy.repo_id + "-checkpoints"
|
| 482 |
+
api.create_repo(checkpoint_repo, exist_ok=True)
|
| 483 |
api.upload_folder(
|
| 484 |
folder_path=checkpoint_dir,
|
| 485 |
+
repo_id=checkpoint_repo,
|
| 486 |
+
path_in_repo=f"step_{step:06d}",
|
| 487 |
)
|
| 488 |
+
logging.info(f"Uploaded checkpoint step {step} to {checkpoint_repo}")
|
| 489 |
uploaded = True
|
| 490 |
except Exception as e:
|
| 491 |
logging.warning(f"Failed to upload checkpoint step {step}: {e}")
|