- static Policy.from_checkpoint(checkpoint: Union[str, ray.air.checkpoint.Checkpoint], policy_ids: Optional[Container[str]] = None) Union[ray.rllib.policy.policy.Policy, Dict[str, ray.rllib.policy.policy.Policy]] [source]#
Creates new Policy instance(s) from a given Policy or Algorithm checkpoint.
Note: This method must remain backward compatible from 2.1.0 on, wrt. checkpoints created with Ray 2.0.0 or later.
checkpoint – The path (str) to a Policy or Algorithm checkpoint directory or an AIR Checkpoint (Policy or Algorithm) instance to restore from. If checkpoint is a Policy checkpoint,
policy_idsmust be None and only the Policy in that checkpoint is restored and returned. If checkpoint is an Algorithm checkpoint and
policy_idsis None, will return a list of all Policy objects found in the checkpoint, otherwise a list of those policies in
policy_ids – List of policy IDs to extract from a given Algorithm checkpoint. If None and an Algorithm checkpoint is provided, will restore all policies found in that checkpoint. If a Policy checkpoint is given, this arg must be None.
An instantiated Policy, if
checkpointis a Policy checkpoint. A dict mapping PolicyID to Policies, if
checkpointis an Algorithm checkpoint. In the latter case, returns all policies within the Algorithm if
policy_idsis None, else a dict of only those Policies that are in