mirror of
https://github.com/wassname/ray.git
synced 2026-07-20 12:40:20 +08:00
[rllib] [minor] Rename agent_id to experiment_tag (#1143)
* tagstr * doc * rename * fix test
This commit is contained in:
@@ -31,7 +31,7 @@ class Trial(object):
|
||||
|
||||
def __init__(
|
||||
self, env_creator, alg, config={}, local_dir='/tmp/ray',
|
||||
agent_id=None, resources=Resources(cpu=1, gpu=0),
|
||||
experiment_tag=None, resources=Resources(cpu=1, gpu=0),
|
||||
stopping_criterion={}, checkpoint_freq=None,
|
||||
restore_path=None, upload_dir=None):
|
||||
"""Initialize a new trial.
|
||||
@@ -45,11 +45,14 @@ class Trial(object):
|
||||
if type(env_creator) is str:
|
||||
self.env_name = env_creator
|
||||
else:
|
||||
self.env_name = "custom"
|
||||
if hasattr(env_creator, "env_name"):
|
||||
self.env_name = env_creator.env_name
|
||||
else:
|
||||
self.env_name = "custom"
|
||||
self.alg = alg
|
||||
self.config = config
|
||||
self.local_dir = local_dir
|
||||
self.agent_id = agent_id
|
||||
self.experiment_tag = experiment_tag
|
||||
self.resources = resources
|
||||
self.stopping_criterion = stopping_criterion
|
||||
self.checkpoint_freq = checkpoint_freq
|
||||
@@ -77,7 +80,7 @@ class Trial(object):
|
||||
agent_cls)
|
||||
self.agent = cls.remote(
|
||||
self.env_creator, self.config, self.local_dir, self.upload_dir,
|
||||
agent_id=self.agent_id)
|
||||
experiment_tag=self.experiment_tag)
|
||||
if self.restore_path:
|
||||
ray.get(self.agent.restore.remote(self.restore_path))
|
||||
|
||||
@@ -178,8 +181,8 @@ class Trial(object):
|
||||
|
||||
def __str__(self):
|
||||
identifier = '{}_{}'.format(self.alg, self.env_name)
|
||||
if self.agent_id:
|
||||
identifier += '_' + self.agent_id
|
||||
if self.experiment_tag:
|
||||
identifier += '_' + self.experiment_tag
|
||||
return identifier
|
||||
|
||||
def __eq__(self, other):
|
||||
|
||||
Reference in New Issue
Block a user