class ray.train.rl.RLPredictor(policy: ray.rllib.policy.policy.Policy, preprocessor: Optional[Preprocessor] = None)[source]#

Bases: ray.train.predictor.Predictor

A predictor for RLlib policies.

  • policy – The RLlib policy on which to perform inference on.

  • preprocessor – A preprocessor used to transform data batches prior to prediction.

PublicAPI (alpha): This API is in alpha and may change before becoming stable.

classmethod from_checkpoint(checkpoint: ray.air.checkpoint.Checkpoint, env: Optional[Any] = None, **kwargs) ray.train.predictor.Predictor[source]#

Create RLPredictor from checkpoint.

This method requires that the checkpoint was created with the Ray AIR RLTrainer.

  • checkpoint – The checkpoint to load the model and preprocessor from.

  • env – Optional environment to instantiate the trainer with. If not given, it is parsed from the saved trainer configuration instead.