ray.rllib.policy.torch_policy_v2.TorchPolicyV2.export_checkpoint#
- TorchPolicyV2.export_checkpoint(export_dir: str, filename_prefix=-1, *, policy_state: Dict[str, numpy.array | jnp.ndarray | tf.Tensor | torch.Tensor | dict | tuple] | None = None, checkpoint_format: str = 'cloudpickle') None #
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 additionalself.get_state()
calls of its different Policies.checkpoint_format – Either one of ‘cloudpickle’ or ‘msgpack’.
from ray.rllib.algorithms.ppo import PPOTorchPolicy policy = PPOTorchPolicy(...) policy.export_checkpoint("/tmp/export_dir")