关于 physicalai-runtime-configuring-inference-pipeline
配置 physicalai-runtime 推理流水线的开发技能,介绍基于清单的处理器设置、组件注册、构件路径和测试。
主要功能
- 01流水线顺序指南
- 02清单组件配置
- 03内置处理器注册
- 04嵌套组件深度限制
- 05构件路径与测试检查
适用场景
- 01配置预处理器和后处理器
- 02添加内置处理器
- 03验证基于清单的模型
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ openvinotoolkit/ physicalai --skill physicalai-runtime-configuring-inference-pipeline安装后在 Claude Code 中输入/physicalai-runtime-configuring-inference-pipeline确认已加载。
详细介绍
配置推理流水线
流水线顺序:观测 → 预处理器 → runner → 后处理器 → 动作输出。请参阅 docs/how-to/inference/configure-pre-post-processing.md。
核心代码:
src/physicalai/inference/component_factory.py—ComponentRegistry、instantiate_component、_MAX_COMPONENT_DEPTH。src/physicalai/inference/model.py— 根据清单规范构建处理器链。- 内置组件位于
preprocessors/和postprocessors/下;runner 位于runners/下。
工作流
-
阅读清单中的相关部分,了解
preprocessors、postprocessors和model.runner。- 完成标准:你知道规范使用的是
type(注册表中的短名称)还是class_path。
- 完成标准:你知道规范使用的是
-
内置组件优先使用
type,这些组件已在component_factory中注册(例如文档中的 normalize/denormalize 模式)。 -
对于显式类,使用
class_path+init_args:preprocessors: - class_path: physicalai.inference.preprocessors.StatsNormalizer init_args: artifact: stats.safetensors- 完成标准:
init_args中的路径通过resolve_artifact相对于导出目录解析。
- 完成标准:
-
添加新的内置处理器:
- 在相应的包中实现
Preprocessor/Postprocessor子类。 - 如果需要适用于清单的别名,请在
component_factory中注册一个简短的type名称。 - 在
tests/unit/inference/preprocessors/或postprocessors/下添加单元测试。 - 完成标准:使用
type或class_path的清单能在精简的InferenceModel测试中实例化。
- 在相应的包中实现
-
嵌套组件的
init_args必须保持在_MAX_COMPONENT_DEPTH限制内;避免循环规范。
验证流程
uv run pytest tests/unit/inference/preprocessors tests/unit/inference/postprocessors tests/unit/inference/test_manifest.py -q
必要检查
- 处理器顺序与训练/导出语义一致(在 runner 之前执行归一化,在之后执行反归一化)。
- 清单中的资源文件名不得遍历路径(
..、绝对路径)。 - 当新公开的处理器对用户可见时,需将其补充到
docs/reference/inference-api.md或操作指南文档中。 - runner 选择(
SinglePass、分块 runner)应与predict_action_chunk和select_action文档保持一致。
参考资料
docs/reference/manifest-schema.mddocs/how-to/inference/use-manifest.md
评论
支持 Markdown