Merge pull request #35 from Cadene/switch_between_train_and_eval

Switch between train and eval modes
This commit is contained in:
Remi 2024-03-18 13:21:16 +01:00 committed by GitHub
commit 099a465367
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 0 deletions

View File

@ -32,6 +32,7 @@ def eval_policy(
fps: int = 15,
return_first_video: bool = False,
):
policy.eval()
start = time.time()
sum_rewards = []
max_rewards = []

View File

@ -181,6 +181,7 @@ def train(cfg: dict, out_dir=None, job_name=None):
if offline_step == 0:
logging.info("Start offline training on a fixed dataset")
# TODO(rcadene): is it ok if step_t=0 = 0 and not 1 as previously done?
policy.train()
train_info = policy.update(offline_buffer, step)
if step % cfg.log_freq == 0:
log_train_info(logger, train_info, step, cfg, offline_buffer, is_offline)