Skip to content

Commit 6da170a

Browse files
samet-robdohun2665
authored andcommitted
Move cfg.validate() earlier to fix NoneType error with --policy.path (huggingface#2782)
1 parent faecd1d commit 6da170a

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/lerobot/scripts/lerobot_train.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,8 @@ def train(cfg: TrainPipelineConfig, accelerator: Accelerator | None = None):
251251
cfg: A `TrainPipelineConfig` object containing all training configurations.
252252
accelerator: Optional Accelerator instance. If None, one will be created automatically.
253253
"""
254+
cfg.validate()
255+
254256
# Create Accelerator if not provided
255257
# It will automatically detect if running in distributed mode or single-process mode
256258
# We set step_scheduler_with_optimizer=False to prevent accelerate from adjusting the lr_scheduler steps based on the num_processes
@@ -274,8 +276,6 @@ def train(cfg: TrainPipelineConfig, accelerator: Accelerator | None = None):
274276
# When using accelerate, only the main process should log to avoid duplicate outputs
275277
is_main_process = accelerator.is_main_process
276278

277-
cfg.validate()
278-
279279
# Only log on main process
280280
if is_main_process:
281281
logging.info(pformat(cfg.to_dict()))

0 commit comments

Comments
 (0)