[rllib] Export policy model checkpoint (#3637)

* Export policy model checkpoint

* update comment
This commit is contained in:
Tianming Xu
2018-12-27 07:43:06 +08:00
committed by Eric Liang
parent 6e2d7a9ba1
commit b4f61dfd50
6 changed files with 80 additions and 9 deletions
+20
View File
@@ -443,6 +443,26 @@ class Agent(Trainable):
"""
self.local_evaluator.export_policy_model(export_dir, policy_id)
def export_policy_checkpoint(self,
export_dir,
filename_prefix="model",
policy_id=DEFAULT_POLICY_ID):
"""Export tensorflow policy model checkpoint to local directory.
Arguments:
export_dir (string): Writable local directory.
filename_prefix (string): file name prefix of checkpoint files.
policy_id (string): Optional policy id to export.
Example:
>>> agent = MyAgent()
>>> for _ in range(10):
>>> agent.train()
>>> agent.export_policy_checkpoint("/tmp/export_dir")
"""
self.local_evaluator.export_policy_checkpoint(
export_dir, filename_prefix, policy_id)
@classmethod
def resource_help(cls, config):
return ("\n\nYou can adjust the resource requests of RLlib agents by "