[rllib] Add n-step Q learning for DQN (#1439)

* n-step

* add sample adjustm

* Oops

* fix nstep

* metric adjustment

* Sat Jan 20 23:30:34 PST 2018

* Sun Jan 21 16:40:46 PST 2018

* Mon Jan 22 22:24:57 PST 2018
This commit is contained in:
Eric Liang
2018-01-23 10:31:19 -08:00
committed by GitHub
parent f32c0c8ec1
commit ee36effd8e
9 changed files with 77 additions and 9 deletions
+3
View File
@@ -42,6 +42,9 @@ class Resources(
return super(Resources, cls).__new__(
cls, cpu, gpu, driver_cpu_limit, driver_gpu_limit)
def summary_string(self):
return "{} CPUs, {} GPUs".format(self.cpu, self.gpu)
class Trial(object):
"""A trial object holds the state for one model training run.
+6 -3
View File
@@ -79,9 +79,12 @@ class TrialRunner(object):
for trial in self._trials:
if trial.status == Trial.PENDING:
if not self.has_resources(trial.resources):
raise TuneError(
"Insufficient cluster resources to launch trial",
(trial.resources, self._avail_resources))
raise TuneError((
"Insufficient cluster resources to launch trial: "
"trial requested {} but the cluster only has {} "
"available.").format(
trial.resources.summary_string(),
self._avail_resources.summary_string()))
elif trial.status == Trial.PAUSED:
raise TuneError(
"There are paused trials, but no more pending "