docs/articles_en/physical-ai/reference/inference-api.md
InferenceModelInferenceModel(
export_dir: str | Path,
policy_name: str | None = None,
backend: str = "auto",
device: str = "auto",
runner: InferenceRunner | None = None,
preprocessors: list[Preprocessor] | None = None,
postprocessors: list[Postprocessor] | None = None,
callbacks: list[Callback] | None = None,
**adapter_kwargs,
)
The model can be constructed directly from an export directory or loaded from config.
model = InferenceModel("./exports/act_policy")
from_pretrainedmodel = InferenceModel.from_pretrained(
"OpenVINO/act-fp16-ov",
revision="main", # branch, tag, or commit SHA (optional)
cache_dir=None, # download cache directory (optional)
)
This downloads the policy package snapshot from the Hugging Face Hub and loads
it like a local export. Additional keyword arguments are forwarded to the
constructor (e.g. backend, device).
Note:
InferenceModel.from_config()is a planned API.
select_actionaction = model.select_action(observation)
This method returns one action.
predict_action_chunkchunk = model.predict_action_chunk(observation)
This method returns a chunk of actions for runtime queueing.
resetmodel.reset()
This method clears the runner state and the action cursor.
closemodel.close()
This method releases backend resources.
Observations are dictionaries of NumPy arrays.
observation = {
"state": joint_positions,
"image.wrist": wrist_image,
}
The expected keys and shapes come from the exported package and its preprocessing pipeline.