mirror of
https://github.com/wassname/ray.git
synced 2026-07-15 11:25:40 +08:00
[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:
@@ -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.
|
||||
|
||||
@@ -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 "
|
||||
|
||||
Reference in New Issue
Block a user