mirror of
https://github.com/wassname/ray.git
synced 2026-07-27 11:26:41 +08:00
[rllib] [minor] Rename agent_id to experiment_tag (#1143)
* tagstr * doc * rename * fix test
This commit is contained in:
@@ -42,7 +42,7 @@ class Agent(object):
|
||||
|
||||
def __init__(
|
||||
self, env_creator, config, local_dir='/tmp/ray',
|
||||
upload_dir=None, agent_id=None):
|
||||
upload_dir=None, experiment_tag=None):
|
||||
"""Initialize an RLLib agent.
|
||||
|
||||
Args:
|
||||
@@ -53,8 +53,10 @@ class Agent(object):
|
||||
be placed.
|
||||
upload_dir (str): Optional remote URI like s3://bucketname/ where
|
||||
results will be uploaded.
|
||||
agent_id (str): Optional unique identifier for this agent, used
|
||||
to determine where to store results in the local dir.
|
||||
experiment_tag (str): Optional string containing extra metadata
|
||||
about the experiment, e.g. a summary of parameters. This string
|
||||
will be included in the logdir path and when displaying agent
|
||||
progress.
|
||||
"""
|
||||
self._initialize_ok = False
|
||||
self._experiment_id = uuid.uuid4().hex
|
||||
@@ -63,7 +65,10 @@ class Agent(object):
|
||||
env_name = env_creator
|
||||
self.env_creator = lambda: gym.make(env_name)
|
||||
else:
|
||||
env_name = "custom"
|
||||
if hasattr(env_creator, "env_name"):
|
||||
env_name = env_creator.env_name
|
||||
else:
|
||||
env_name = "custom"
|
||||
self.env_creator = env_creator
|
||||
|
||||
self.config = self._default_config.copy()
|
||||
@@ -75,7 +80,7 @@ class Agent(object):
|
||||
"all agent configs: {}".format(k, self.config.keys()))
|
||||
self.config.update(config)
|
||||
self.config.update({
|
||||
"agent_id": agent_id,
|
||||
"experiment_tag": experiment_tag,
|
||||
"alg": self._agent_name,
|
||||
"env_name": env_name,
|
||||
"experiment_id": self._experiment_id,
|
||||
@@ -84,7 +89,7 @@ class Agent(object):
|
||||
logdir_suffix = "{}_{}_{}".format(
|
||||
env_name,
|
||||
self._agent_name,
|
||||
agent_id or datetime.today().strftime("%Y-%m-%d_%H-%M-%S"))
|
||||
experiment_tag or datetime.today().strftime("%Y-%m-%d_%H-%M-%S"))
|
||||
|
||||
if not os.path.exists(local_dir):
|
||||
os.makedirs(local_dir)
|
||||
|
||||
Reference in New Issue
Block a user