From a3cd18eda97dbdea58dcc646a728f020101b6459 Mon Sep 17 00:00:00 2001 From: Huan Liu Date: Sat, 15 Mar 2025 16:40:39 +0800 Subject: [PATCH] =?UTF-8?q?added=20wandb.run=5Fid=20to=20allow=20resuming?= =?UTF-8?q?=20without=20wandb=20log;=20updated=20log=20m=E2=80=A6=20(#841)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Simon Alibert <75076266+aliberts@users.noreply.github.com> --- lerobot/common/utils/wandb_utils.py | 8 +++++++- lerobot/configs/default.py | 1 + lerobot/configs/train.py | 4 +++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lerobot/common/utils/wandb_utils.py b/lerobot/common/utils/wandb_utils.py index 9985b894..700ebea5 100644 --- a/lerobot/common/utils/wandb_utils.py +++ b/lerobot/common/utils/wandb_utils.py @@ -69,7 +69,13 @@ class WandBLogger: os.environ["WANDB_SILENT"] = "True" import wandb - wandb_run_id = get_wandb_run_id_from_filesystem(self.log_dir) if cfg.resume else None + wandb_run_id = ( + cfg.wandb.run_id + if cfg.wandb.run_id + else get_wandb_run_id_from_filesystem(self.log_dir) + if cfg.resume + else None + ) wandb.init( id=wandb_run_id, project=self.cfg.project, diff --git a/lerobot/configs/default.py b/lerobot/configs/default.py index 1e7f5819..dee0649a 100644 --- a/lerobot/configs/default.py +++ b/lerobot/configs/default.py @@ -46,6 +46,7 @@ class WandBConfig: project: str = "lerobot" entity: str | None = None notes: str | None = None + run_id: str | None = None @dataclass diff --git a/lerobot/configs/train.py b/lerobot/configs/train.py index 2b147a5b..7a787b83 100644 --- a/lerobot/configs/train.py +++ b/lerobot/configs/train.py @@ -79,7 +79,9 @@ class TrainPipelineConfig(HubMixin): # The entire train config is already loaded, we just need to get the checkpoint dir config_path = parser.parse_arg("config_path") if not config_path: - raise ValueError("A config_path is expected when resuming a run.") + raise ValueError( + f"A config_path is expected when resuming a run. Please specify path to {TRAIN_CONFIG_NAME}" + ) if not Path(config_path).resolve().exists(): raise NotADirectoryError( f"{config_path=} is expected to be a local path. "