in mbrl/diagnostics/eval_model_on_dataset.py [0:0]
def __init__(self, model_dir: str, dataset_dir: str, output_dir: str):
self.model_path = pathlib.Path(model_dir)
self.output_path = pathlib.Path(output_dir)
pathlib.Path.mkdir(self.output_path, parents=True, exist_ok=True)
self.cfg = mbrl.util.common.load_hydra_cfg(self.model_path)
self.handler = mbrl.util.create_handler(self.cfg)
self.env, term_fn, reward_fn = self.handler.make_env(self.cfg)
self.reward_fn = reward_fn
self.dynamics_model = mbrl.util.common.create_one_dim_tr_model(
self.cfg,
self.env.observation_space.shape,
self.env.action_space.shape,
model_dir=self.model_path,
)
self.replay_buffer = mbrl.util.common.create_replay_buffer(
self.cfg,
self.env.observation_space.shape,
self.env.action_space.shape,
load_dir=dataset_dir,
)