Пример #1
0
 def _log_policy(self):
     save_path = os.path.join(self._log_dir, 'models')
     filesystem.mkdir(save_path)
     weights = self._policy.get_weights()
     data = {'policy_weights': weights}
     full_path = os.path.join(save_path,
                              'policy_{}.pkl'.format(self._total_timestep))
     print('Saving policy to: {}'.format(full_path))
     pickle.dump(data, open(full_path, 'wb'))
Пример #2
0
 def _log_model(self):
     print('[ MODEL ]: {}'.format(self._model_type))
     if self._model_type == 'identity':
         print('[ MOPO ] Identity model, skipping save')
     elif self._model.model_loaded:
         print('[ MOPO ] Loaded model, skipping save')
     else:
         save_path = os.path.join(self._log_dir, 'models')
         filesystem.mkdir(save_path)
         print('[ MOPO ] Saving model to: {}'.format(save_path))
         self._model.save(save_path, self._total_timestep)