ray.rllib.policy.Policy.export_checkpoint#

Policy.export_checkpoint(export_dir: str, filename_prefix=- 1, *, policy_state: Optional[Dict[str, Union[numpy.array, jnp.ndarray, tf.Tensor, torch.Tensor, dict, tuple]]] = None, checkpoint_format: str = 'cloudpickle') None[source]#

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

Parameters
  • export_dir – Local writable directory to store the AIR Checkpoint information into.

  • policy_state – An optional PolicyState to write to disk. Used by Algorithm.save_checkpoint() to save on the additional self.get_state() calls of its different Policies.

  • checkpoint_format – Either one of ‘cloudpickle’ or ‘msgpack’.

Example

>>> from ray.rllib.algorithms.ppo import PPOTorchPolicy
>>> policy = PPOTorchPolicy(...) 
>>> policy.export_checkpoint("/tmp/export_dir")