physicalai-runtime-loading-exported-policies
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseLoading Exported Policies
加载导出的策略
Runtime loads Studio export directories (or Hub snapshots that mirror them) through in . Manifest parsing lives in ; backends register in ( → , → ). Hub downloads use .
InferenceModelsrc/physicalai/inference/model.pysrc/physicalai/inference/manifest.pysrc/physicalai/inference/adapters/registry.pyonnx.onnxopenvino.xmlsrc/physicalai/inference/utils/_hub.pyRuntime通过中的加载Studio导出目录(或镜像这些目录的Hub快照)。清单解析逻辑位于;后端在中注册(对应,对应)。Hub下载功能使用。
src/physicalai/inference/model.pyInferenceModelsrc/physicalai/inference/manifest.pysrc/physicalai/inference/adapters/registry.pyonnx.onnxopenvino.xmlsrc/physicalai/inference/utils/_hub.pyWorkflow
工作流程
-
Identify the artifact: local export directory or Hub, expected backend, and whether the user needs
repo_idvsselect_action.predict_action_chunk- Done when: load path and API entry point are chosen before editing code.
-
Load with auto-detection first (local):python
from physicalai.inference import InferenceModel model = InferenceModel("./exports/act_policy")- Done when: constructs without explicit
modelwhen artifacts match a registered extension.backend=
- Done when:
-
Hub load when the package is published:python
model = InferenceModel.from_pretrained("OpenVINO/act-fp16-ov", revision="<commit-sha>")- Done when: revision is pinned for reproducibility when security or CI matters.
-
Explicit backend only when auto-detection is ambiguous:python
model = InferenceModel("./exports/act_policy", backend="openvino", device="CPU") -
Validate structure againstand backend notes (
references/export-load-contract.md,references/onnx.md).references/openvino.md- Done when: manifest, model file, and processor artifacts resolve under the export directory.
-
Smoke inference without owning robot timing:python
model.reset() action = model.select_action(observation)- Done when: one forward pass succeeds on representative observation keys/shapes. For hardware loops, hand off to .
physicalai-runtime-running-policy-on-robot
- Done when: one forward pass succeeds on representative observation keys/shapes. For hardware loops, hand off to
-
识别工件:本地导出目录或Hub、预期后端,以及用户是否需要
repo_id或select_action。predict_action_chunk- 完成标志:在编辑代码前确定加载路径和API入口点。
-
先使用自动检测加载(本地):python
from physicalai.inference import InferenceModel model = InferenceModel("./exports/act_policy")- 完成标志:当工件匹配已注册的扩展名时,无需显式指定即可成功构建
backend=。model
- 完成标志:当工件匹配已注册的扩展名时,无需显式指定
-
当包已发布时从Hub加载:python
model = InferenceModel.from_pretrained("OpenVINO/act-fp16-ov", revision="<commit-sha>")- 完成标志:在安全性或CI相关场景中,固定版本号以确保可复现性。
-
仅在自动检测存在歧义时指定显式后端:python
model = InferenceModel("./exports/act_policy", backend="openvino", device="CPU") -
对照和后端说明(
references/export-load-contract.md、references/onnx.md)验证结构。references/openvino.md- 完成标志:清单、模型文件和处理器工件可在导出目录下正常解析。
-
脱离机器人时序限制进行快速推理测试:python
model.reset() action = model.select_action(observation)- 完成标志:针对代表性观测键/形状的一次前向传递成功。对于硬件循环场景,移交至处理。
physicalai-runtime-running-policy-on-robot
- 完成标志:针对代表性观测键/形状的一次前向传递成功。对于硬件循环场景,移交至
Validation loop
验证循环
bash
uv run pytest tests/unit/inference/test_model.py tests/unit/inference/test_manifest.py -qFor adapter changes, add or run targeted tests under .
tests/unit/inference/bash
uv run pytest tests/unit/inference/test_model.py tests/unit/inference/test_manifest.py -q对于适配器变更,请在下添加或运行针对性测试。
tests/unit/inference/Required checks
必要检查
- Export directory contains backend model file(s) and consistent with
manifest.json.docs/reference/manifest-schema.md - Metadata input/output/feature names align with preprocessors in the manifest.
- Optional backends fail with clear install guidance (, OpenVINO).
onnxruntime - Do not document a backend unless an adapter is registered in .
src/physicalai/inference/adapters/ - Hub loads must not log tokens; prefer pinned for production docs.
revision=
- 导出目录包含后端模型文件和符合规范的
docs/reference/manifest-schema.md。manifest.json - 元数据中的输入/输出/特征名称与清单中的预处理器对齐。
- 可选后端加载失败时需提供清晰的安装指引(、OpenVINO)。
onnxruntime - 除非适配器已在中注册,否则不得记录该后端。
src/physicalai/inference/adapters/ - Hub加载不得记录令牌;生产文档中优先使用固定的参数。
revision=
References
参考资料
- — consumer-side contract (coordinate with Studio export skill).
references/export-load-contract.md - ,
references/onnx.md— adapter constraints.references/openvino.md
- —— 消费端契约(与Studio导出功能协同)。
references/export-load-contract.md - 、
references/onnx.md—— 适配器约束条件。references/openvino.md