[tune] Recover experiments from last checkpoint (#1532)

This commit is contained in:
Eric Liang
2018-02-12 14:01:19 -08:00
committed by Richard Liaw
parent 7e998db656
commit ca0f08d100
8 changed files with 138 additions and 7 deletions
+9 -1
View File
@@ -139,12 +139,19 @@ class _MockAgent(Agent):
"""Mock agent for use in tests"""
_agent_name = "MockAgent"
_default_config = {}
_default_config = {
"mock_error": False,
"persistent_error": False,
}
def _init(self):
self.info = None
self.restored = False
def _train(self):
if self.config["mock_error"] and self.iteration == 1 \
and (self.config["persistent_error"] or not self.restored):
raise Exception("mock error")
return TrainingResult(
episode_reward_mean=10, episode_len_mean=10,
timesteps_this_iter=10, info={})
@@ -159,6 +166,7 @@ class _MockAgent(Agent):
with open(checkpoint_path, 'rb') as f:
info = pickle.load(f)
self.info = info
self.restored = True
def set_info(self, info):
self.info = info
+5 -1
View File
@@ -174,7 +174,9 @@ class DQNEvaluator(TFMultiGPUSupport):
self.episode_rewards,
self.episode_lengths,
self.saved_mean_reward,
self.obs]
self.obs,
self.global_timestep,
self.local_timestep]
def restore(self, data):
self.exploration = data[0]
@@ -182,3 +184,5 @@ class DQNEvaluator(TFMultiGPUSupport):
self.episode_lengths = data[2]
self.saved_mean_reward = data[3]
self.obs = data[4]
self.global_timestep = data[5]
self.local_timestep = data[6]