mirror of
https://github.com/huggingface/lerobot.git
synced 2026-07-24 18:26:11 +00:00
fix video paths and train.py
This commit is contained in:
@@ -257,7 +257,6 @@ def eval_policy(
|
|||||||
# Determine how many batched rollouts we need to get n_episodes. Note that if n_episodes is not evenly
|
# Determine how many batched rollouts we need to get n_episodes. Note that if n_episodes is not evenly
|
||||||
# divisible by env.num_envs we end up discarding some data in the last batch.
|
# divisible by env.num_envs we end up discarding some data in the last batch.
|
||||||
n_batches = n_episodes // env.num_envs + int((n_episodes % env.num_envs) != 0)
|
n_batches = n_episodes // env.num_envs + int((n_episodes % env.num_envs) != 0)
|
||||||
print("n_batches", n_batches)
|
|
||||||
|
|
||||||
# Keep track of some metrics.
|
# Keep track of some metrics.
|
||||||
sum_rewards = []
|
sum_rewards = []
|
||||||
@@ -565,12 +564,16 @@ def eval_policy_multitask(
|
|||||||
def eval_task(task_group, task_id, env):
|
def eval_task(task_group, task_id, env):
|
||||||
"""Evaluates a single task in parallel."""
|
"""Evaluates a single task in parallel."""
|
||||||
print(f"Evaluating: task_group: {task_group}, task_id: {task_id} ...")
|
print(f"Evaluating: task_group: {task_group}, task_id: {task_id} ...")
|
||||||
|
# jadechoghari : added multi video eval support
|
||||||
|
if videos_dir is not None:
|
||||||
|
task_videos_dir = videos_dir / f"{task_group}_{task_id}"
|
||||||
|
task_videos_dir.mkdir(parents=True, exist_ok=True)
|
||||||
task_result = eval_policy(
|
task_result = eval_policy(
|
||||||
env,
|
env,
|
||||||
policy,
|
policy,
|
||||||
n_episodes,
|
n_episodes,
|
||||||
max_episodes_rendered,
|
max_episodes_rendered,
|
||||||
videos_dir,
|
task_videos_dir,
|
||||||
return_episode_data,
|
return_episode_data,
|
||||||
start_seed,
|
start_seed,
|
||||||
# verbose=verbose,
|
# verbose=verbose,
|
||||||
|
|||||||
@@ -262,17 +262,15 @@ def train(cfg: TrainPipelineConfig):
|
|||||||
start_seed=cfg.seed,
|
start_seed=cfg.seed,
|
||||||
max_parallel_tasks=cfg.env.max_parallel_tasks,
|
max_parallel_tasks=cfg.env.max_parallel_tasks,
|
||||||
)
|
)
|
||||||
aggregated_results = eval_info["overall"]["aggregated"]
|
aggregated = eval_info["overall"]["aggregated"]
|
||||||
# Print per-suite stats
|
# Print per-suite stats
|
||||||
for task_group, task_group_info in eval_info.items():
|
for task_group, task_group_info in eval_info.items():
|
||||||
if task_group == "overall":
|
if task_group == "overall":
|
||||||
continue # Skip the overall stats since we already printed it
|
continue # Skip the overall stats since we already printed it
|
||||||
print(f"\nAggregated Metrics for {task_group}:")
|
print(f"\nAggregated Metrics for {task_group}:")
|
||||||
print(task_group_info["aggregated"])
|
print(task_group_info["aggregated"])
|
||||||
breakpoint()
|
|
||||||
else:
|
else:
|
||||||
print("START EVAL")
|
print("START EVAL")
|
||||||
breakpoint()
|
|
||||||
eval_info = eval_policy(
|
eval_info = eval_policy(
|
||||||
eval_env,
|
eval_env,
|
||||||
policy,
|
policy,
|
||||||
@@ -302,6 +300,12 @@ def train(cfg: TrainPipelineConfig):
|
|||||||
wandb_logger.log_video(eval_info["video_paths"][0], step, mode="eval")
|
wandb_logger.log_video(eval_info["video_paths"][0], step, mode="eval")
|
||||||
|
|
||||||
if eval_env:
|
if eval_env:
|
||||||
|
# added by jade, close all env in multi eval setup
|
||||||
|
if cfg.env.multitask_eval:
|
||||||
|
for task_group, envs_dict in eval_env.items():
|
||||||
|
for idx, env in envs_dict.items():
|
||||||
|
env.close()
|
||||||
|
else:
|
||||||
eval_env.close()
|
eval_env.close()
|
||||||
logging.info("End of training")
|
logging.info("End of training")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user