ray.rllib.policy.eager_tf_policy_v2.EagerTFPolicyV2.from_checkpoint
ray.rllib.policy.eager_tf_policy_v2.EagerTFPolicyV2.from_checkpoint#
- static EagerTFPolicyV2.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]]#
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.
- Parameters
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 andpolicy_idsis None, will return a list of all Policy objects found in the checkpoint, otherwise a list of those policies inpolicy_ids.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.
- Returns
An instantiated Policy, if
checkpointis a Policy checkpoint. A dict mapping PolicyID to Policies, ifcheckpointis an Algorithm checkpoint. In the latter case, returns all policies within the Algorithm ifpolicy_idsis None, else a dict of only those Policies that are inpolicy_ids.