This commit is contained in:
Alexander Soare 2024-03-22 15:43:45 +00:00
parent d43fa600a0
commit bd40ffc53c
2 changed files with 4 additions and 4 deletions
lerobot/scripts

View File

@ -146,7 +146,7 @@ def eval_policy(
thread.join()
info = {
"micro": [
"per_episode": [
{
"episode_ix": i,
"sum_reward": sum_reward,
@ -164,7 +164,7 @@ def eval_policy(
)
)
],
"macro": {
"aggregated": {
"avg_sum_reward": np.nanmean(sum_rewards[:num_episodes]),
"avg_max_reward": np.nanmean(max_rewards[:num_episodes]),
"pc_success": np.nanmean(successes[:num_episodes]) * 100,
@ -218,7 +218,7 @@ def eval(cfg: dict, out_dir=None, stats_path=None):
max_steps=cfg.env.episode_length,
num_episodes=cfg.eval_episodes,
)
print(info["macro"])
print(info["aggregated"])
# Save info
with open(Path(out_dir) / "eval_info.json", "w") as f:

View File

@ -183,7 +183,7 @@ def train(cfg: dict, out_dir=None, job_name=None):
video_dir=Path(out_dir) / "eval",
save_video=True,
)
log_eval_info(logger, eval_info["macro"], step, cfg, offline_buffer, is_offline)
log_eval_info(logger, eval_info["aggregated"], step, cfg, offline_buffer, is_offline)
if cfg.wandb.enable:
logger.log_video(first_video, step, mode="eval")
logging.info("Resume training")