From 69afc87149a7cac89816e94c51a9834f00a2d3c4 Mon Sep 17 00:00:00 2001 From: Remi Cadene Date: Thu, 30 Jan 2025 09:23:22 +0100 Subject: [PATCH] Fix eval on real robots --- lerobot/scripts/train.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lerobot/scripts/train.py b/lerobot/scripts/train.py index d8136681e4..954c796991 100644 --- a/lerobot/scripts/train.py +++ b/lerobot/scripts/train.py @@ -242,10 +242,9 @@ def evaluate_and_checkpoint_if_needed(step: int, is_online: bool): _num_digits = max(6, len(str(cfg.offline.steps + cfg.online.steps))) step_identifier = f"{step:0{_num_digits}d}" - if cfg.eval_freq > 0 and step % cfg.eval_freq == 0: + if cfg.env is not None and cfg.eval_freq > 0 and step % cfg.eval_freq == 0: logging.info(f"Eval policy at step {step}") with torch.no_grad(), torch.autocast(device_type=device.type) if cfg.use_amp else nullcontext(): - assert eval_env is not None eval_info = eval_policy( eval_env, policy,