Auto-select latest iteration of model

This commit is contained in:
Ruben van de Ven 2023-10-20 13:25:59 +02:00
parent 0a02422733
commit f3ac903555

View file

@ -192,8 +192,12 @@ class PredictionServer:
eval_scene = eval_env.scenes[scene_idx] eval_scene = eval_env.scenes[scene_idx]
online_env = create_online_env(eval_env, hyperparams, scene_idx, init_timestep) online_env = create_online_env(eval_env, hyperparams, scene_idx, init_timestep)
# auto-find highest iteration
model_registrar = ModelRegistrar(self.config.model_dir, self.config.eval_device) model_registrar = ModelRegistrar(self.config.model_dir, self.config.eval_device)
model_registrar.load_models(iter_num=100) model_iterations = pathlib.Path(self.config.model_dir).glob('model_registrar-*.pt')
highest_iter = max([int(p.stem.split('-')[-1]) for p in model_iterations])
model_registrar.load_models(iter_num=highest_iter)
trajectron = OnlineTrajectron(model_registrar, trajectron = OnlineTrajectron(model_registrar,
hyperparams, hyperparams,