From 24ae7a23990d0ba92c93a883175947d452384cc6 Mon Sep 17 00:00:00 2001 From: Tibo De Peuter Date: Sun, 5 Apr 2026 07:35:01 +0200 Subject: [PATCH] fix(hpc): overriding args --- configs/hpc/smoke_test.yaml | 6 +++--- src/train.py | 21 +++++++++++++++++++-- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/configs/hpc/smoke_test.yaml b/configs/hpc/smoke_test.yaml index a00b800..6068aa2 100644 --- a/configs/hpc/smoke_test.yaml +++ b/configs/hpc/smoke_test.yaml @@ -5,7 +5,7 @@ seed: 0 track: true # Test WandB integration capture_video: false # No rendering for smoke test save_model: true # Test the end-of-training save routine -num_envs: 4 -total_timesteps: 500 -num_steps: 64 +num_envs: 512 +total_timesteps: 65536 +num_steps: 128 cuda: true diff --git a/src/train.py b/src/train.py index 731954c..89d938d 100644 --- a/src/train.py +++ b/src/train.py @@ -1,4 +1,6 @@ +import datetime import random +import yaml import subprocess import sys import time @@ -332,7 +334,7 @@ def train(args: PPOArgs): sps = int(global_step / (time.time() - start_time)) remaining_steps = args.total_timesteps - global_step eta_seconds = int(remaining_steps / sps) if sps > 0 else 0 - eta_str = str(time.timedelta(seconds=eta_seconds)) + eta_str = str(datetime.timedelta(seconds=eta_seconds)) print( f"Iteration {iteration}/{args.num_iterations} | " @@ -371,7 +373,22 @@ def train(args: PPOArgs): def main() -> None: - args = tyro.cli(PPOArgs) + temp_args = tyro.cli(PPOArgs) + + if temp_args.env_config_path is not None: + with open(temp_args.env_config_path, "r") as f: + config = yaml.safe_load(f) + if config: + # parse PPOArgs with defaults from yaml. + for key, value in config.items(): + if hasattr(temp_args, key): + setattr(temp_args, key, value) + + # Re-parse CLI to ensure they OVERRIDE the yaml + args = tyro.cli(PPOArgs, default=temp_args) + else: + args = temp_args + train(args)