mirror of
https://github.com/wassname/ray.git
synced 2026-08-16 11:27:09 +08:00
[rllib] [minor] Rename agent_id to experiment_tag (#1143)
* tagstr * doc * rename * fix test
This commit is contained in:
@@ -93,13 +93,13 @@ def parse_to_trials(config):
|
||||
next_cfg, resolved_vars = grid_search.next()
|
||||
resolved, resolved_vars = resolve(next_cfg, resolved_vars, i)
|
||||
if resolved_vars:
|
||||
agent_id = "{}_{}".format(
|
||||
experiment_tag = "{}_{}".format(
|
||||
i, param_str(resolved, resolved_vars))
|
||||
else:
|
||||
agent_id = str(i)
|
||||
experiment_tag = str(i)
|
||||
trials.append(Trial(
|
||||
args.env, args.alg, resolved,
|
||||
os.path.join(args.local_dir, experiment_name), agent_id,
|
||||
os.path.join(args.local_dir, experiment_name), experiment_tag,
|
||||
args.resources, args.stop, args.checkpoint_freq, None,
|
||||
args.upload_dir))
|
||||
|
||||
|
||||
@@ -214,7 +214,7 @@ if __name__ == '__main__':
|
||||
'script_min_iter_time_s': 1,
|
||||
'activation': act,
|
||||
},
|
||||
agent_id='act={}'.format(act)))
|
||||
experiment_tag='act={}'.format(act)))
|
||||
|
||||
ray.init()
|
||||
|
||||
|
||||
@@ -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