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.

from ray.rllib.algorithms.ppo import PPO, PPOConfig
config = PPOConfig().environment("CartPole-v1")
algo = PPO(config=config)
algo.train()
algo.export_policy_checkpoint("/tmp/export_dir")