ray.rllib.algorithms.algorithm.Algorithm.export_policy_checkpoint#

Algorithm.export_policy_checkpoint(export_dir: str, policy_id: str = 'default_policy') None[source]#

Exports Policy checkpoint to a local directory and returns an AIR Checkpoint.

Parameters
  • export_dir – Writable local directory to store the AIR Checkpoint information into.

  • policy_id – Optional policy ID to export. If not provided, will export “default_policy”. If policy_id does not exist in this Algorithm, will raise a KeyError.

Raises

KeyError if policy_id cannot be found in this Algorithm.

Example

>>> from ray.rllib.algorithms.ppo import PPO
>>> # Use an Algorithm from RLlib or define your own.
>>> algo = PPO(...) 
>>> for _ in range(10): 
>>>     algo.train() 
>>> algo.export_policy_checkpoint("/tmp/export_dir")