wrapping all environments in timelimit to stop runs longer than 100s, since some others were erroring
This commit is contained in:
@@ -6,8 +6,9 @@ from typing import Callable, Dict, Optional
|
||||
import os
|
||||
import pickle
|
||||
from tqdm import tqdm
|
||||
from src.util.wrappers import IntersimpleTimeLimit
|
||||
from src.options.envs import OptionsEnv
|
||||
from src.util.wrappers import OptionsTimeLimit
|
||||
from src.safe_options.options import SafeOptionsEnv
|
||||
|
||||
class IntersimpleEvaluation:
|
||||
"""
|
||||
@@ -36,7 +37,10 @@ class IntersimpleEvaluation:
|
||||
self.env = eval_env
|
||||
self.n_episodes = eval_env.nv
|
||||
self.use_pbar = use_pbar
|
||||
self.is_options_env = isinstance(self.env, (OptionsEnv, OptionsTimeLimit))
|
||||
if isinstance(self.env, IntersimpleTimeLimit):
|
||||
self.is_options_env = isinstance(self.env.env, (OptionsEnv, SafeOptionsEnv))
|
||||
else:
|
||||
self.is_options_env = isinstance(self.env, (OptionsEnv, SafeOptionsEnv))
|
||||
|
||||
# metrics present on every step of every episode
|
||||
self.metric_keys_all = ['x_all', 'y_all', 'v_all', 'a_all', 'col_all']
|
||||
|
||||
@@ -24,7 +24,7 @@ def rwse(expert:List[np.ndarray], policy:List[np.ndarray], dt:float=0.1) -> Dict
|
||||
assert len(expert) == len(policy)
|
||||
|
||||
# calculate rwse
|
||||
times = [1,2,5,10,15,20]
|
||||
times = [1,2,5,10,15,20,25,30]
|
||||
time_indices = [int(t/dt) for t in times]
|
||||
rwse_dict_keys = [f'rwse_{t}s' for t in times]+['rwse_end']
|
||||
se_dict = {key:[] for key in rwse_dict_keys}
|
||||
|
||||
@@ -2,6 +2,7 @@ import pickle
|
||||
import os
|
||||
import numpy as np
|
||||
from typing import List,Dict
|
||||
|
||||
def save_metrics(metrics:dict, filestr:str):
|
||||
"""
|
||||
Save metric dict to filestr
|
||||
|
||||
Reference in New Issue
Block a user