maple.backend.policy.openpi.OpenPIPolicy.serve

OpenPIPolicy.serve(version: str, model_path: Path, device: str, host_port: int | None = None, model_load_kwargs: Dict[str, Any] | None = {}) PolicyHandle

Start serving OpenPI model in a Docker container.

Launches a container with the OpenPI inference server and loads the specified model version. Automatically injects the config_name into model_load_kwargs if not already provided, ensuring proper model initialization.

Parameters:
  • version – Model version to serve (e.g., ‘pi05_droid’, ‘pi0_base’).

  • model_path – Path to downloaded model weights on host filesystem.

  • device – Device to load model on (‘cuda’, ‘cuda:0’, ‘cpu’, etc.).

  • host_port – Optional host port to bind container port to. If None, a random available port is assigned.

  • model_load_kwargs – Model loading parameters. config_name will be auto-injected if not provided.

Returns:

PolicyHandle for managing the running container and making inference requests.