Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

1.7 KB
Raw Blame

Inference API Reference

InferenceModel

InferenceModel(
    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.

Constructors

model = InferenceModel("./exports/act_policy")

from_pretrained

model = 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.

Methods

select_action

action = model.select_action(observation)

This method returns one action.

predict_action_chunk

chunk = model.predict_action_chunk(observation)

This method returns a chunk of actions for runtime queueing.

reset

model.reset()

This method clears the runner state and the action cursor.

close

model.close()

This method releases backend resources.

Observation

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.