Instructions to use StrongRoboticsLab/pi05-so100-diverse with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- LeRobot
How to use StrongRoboticsLab/pi05-so100-diverse with LeRobot:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
bot commited on
Commit ·
8287ef9
1
Parent(s): 599e2f2
Async checkpoint upload to avoid blocking training
Browse files
lerobot/src/lerobot/scripts/lerobot_train.py
CHANGED
|
@@ -472,25 +472,31 @@ def train(cfg: TrainPipelineConfig, accelerator: Accelerator | None = None):
|
|
| 472 |
postprocessor=postprocessor,
|
| 473 |
)
|
| 474 |
update_last_checkpoint(checkpoint_dir)
|
| 475 |
-
# Upload checkpoint to HF
|
| 476 |
-
uploaded = False
|
| 477 |
if cfg.policy.push_to_hub:
|
| 478 |
-
|
| 479 |
-
|
| 480 |
-
|
| 481 |
-
|
| 482 |
-
|
| 483 |
-
|
| 484 |
-
|
| 485 |
-
|
| 486 |
-
|
| 487 |
-
|
| 488 |
-
|
| 489 |
-
|
| 490 |
-
|
| 491 |
-
|
| 492 |
-
|
| 493 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 494 |
prev_checkpoint_dir = checkpoint_dir
|
| 495 |
if wandb_logger:
|
| 496 |
wandb_logger.log_policy(checkpoint_dir)
|
|
|
|
| 472 |
postprocessor=postprocessor,
|
| 473 |
)
|
| 474 |
update_last_checkpoint(checkpoint_dir)
|
| 475 |
+
# Upload checkpoint to HF async, delete previous after upload
|
|
|
|
| 476 |
if cfg.policy.push_to_hub:
|
| 477 |
+
import threading
|
| 478 |
+
def _upload_and_cleanup(ckpt_dir, prev_dir, step_num):
|
| 479 |
+
try:
|
| 480 |
+
from huggingface_hub import HfApi
|
| 481 |
+
api = HfApi()
|
| 482 |
+
checkpoint_repo = cfg.policy.repo_id + "-checkpoints"
|
| 483 |
+
api.create_repo(checkpoint_repo, exist_ok=True)
|
| 484 |
+
api.upload_folder(
|
| 485 |
+
folder_path=ckpt_dir,
|
| 486 |
+
repo_id=checkpoint_repo,
|
| 487 |
+
path_in_repo=f"step_{step_num:06d}",
|
| 488 |
+
)
|
| 489 |
+
logging.info(f"Uploaded checkpoint step {step_num} to {checkpoint_repo}")
|
| 490 |
+
if prev_dir is not None and Path(prev_dir).exists():
|
| 491 |
+
shutil.rmtree(prev_dir)
|
| 492 |
+
except Exception as e:
|
| 493 |
+
logging.warning(f"Failed to upload checkpoint step {step_num}: {e}")
|
| 494 |
+
upload_thread = threading.Thread(
|
| 495 |
+
target=_upload_and_cleanup,
|
| 496 |
+
args=(checkpoint_dir, prev_checkpoint_dir, step),
|
| 497 |
+
daemon=True,
|
| 498 |
+
)
|
| 499 |
+
upload_thread.start()
|
| 500 |
prev_checkpoint_dir = checkpoint_dir
|
| 501 |
if wandb_logger:
|
| 502 |
wandb_logger.log_policy(checkpoint_dir)
|