x5-bpu-python-api
Skill1 starsChanged 3 months agoApache-2.0View on GitHub
在 X5 板端使用 hbm_runtime.HB_HBMRuntime 加载 .bin、读取模型 I/O 并执行本地 Python 推理;当系统 /etc/version 不低于 3.5.0 且已有匹配 X5 libdnn 的本地 wheel/DEB 时使用。禁止安装 PyPI 同名 S 系列包,也不处理 C++ Runtime、.hbm 或 hbm_infer gRPC。
- Installs packages
In this repository59 other files it gives its agents.
- bsp-bootloader-buildSkill
- bsp-deb-buildSkill
- bsp-env-setupSkill
- bsp-image-buildSkill
- bsp-kernel-buildSkill
- bsp-rootfs-customSkill
- bsp-source-syncSkill
- bsp-s-seriesSkill
- hmct-workflowSkill
- horizon-routerSkill
- ucpSkill
- x5-accuracy-diagnosticsSkill
- x5-board-monitorSkill
- x5-calibration-data-prepareSkill
- x5-consistency-diagnosticsSkill
- x5-environment-installSkill
- x5-environment-probeSkill
- x5-environment-setupSkill
- x5-model-diagnosticsSkill
- x5-model-preflightSkill
- x5-performance-diagnosticsSkill
- x5-ptq-compileSkill
- x5-ptq-config-authoringSkill
- x5-ptq-deploySkill
- x5-qat-adaptationSkill
- x5-qat-compileSkill
- x5-qat-deploySkill
- x5-qat-trainingSkill
- x5-routerSkill
- x5-runtime-cpp-inferSkill
- x5-runtime-deploySkill
- x5-runtime-perf-evalSkill
- rdk-accessoriesSkill
- rdk-board-delegateSkill
- rdk-board-knowledgeSkill
- rdk-camera-setupSkill
- rdk-command-manualSkill
- rdk-diagnosticSkill
- rdk-docs-referenceSkill
- rdk-ecosystemSkill
- rdk-embodied-lerobotSkill
- rdk-gpio-40pinSkill
- rdk-hardwareSkill
- rdk-headless-modeSkill
- rdk-llm-deploymentSkill
- rdk-log-forensicsSkill
- rdk-memory-auditSkill
- rdk-model-benchmarkSkill
- rdk-model-deploySkill
- rdk-model-zooSkill
- rdk-multimediaSkill
- rdk-network-remoteSkill
- rdk-peripheral-cookbookSkill
- rdk-source-mapSkill
- rdk-system-configSkill
- rdk-system-maintainSkill
- rdk-tros-setupSkill
- rdk-vision-pipelineSkill
- d-robotics-pack-installerSkill
The file
Files
X5 BPU Python API
目标与边界
完成板端 Python 包门禁、模型元信息、输入构造、推理与输出验证。HB_HBMRuntime 是同名接口,不是跨 X5/S 的 ABI 合同。X5 C/C++ Runtime 请求转 x5-runtime-deploy;S 系列本地 Python 请求返回公共 Router 并选择 s-bpu-python-api。
输入合同
- X5
.bin、模型来源/哈希、I/O 与可复现输入。 - 板端
cat /etc/version、架构、Python ABI、现有包和libdnn信息。 - 用户提供的 X5 本地 wheel/DEB 或已登记离线制品;安装授权。
前置检查
- 在板端执行:
cat /etc/version
python3 .drobotics/scripts/check_bpu_python_api_version.py --platform x5- 系统版本必须
>= 3.5.0,模型必须为 X5.bin。 - 禁止裸用
pip install hbm_runtime;PyPI 同名包是 S 系列实现。 - wheel 的 cp tag、aarch64 架构和 X5
libdnn必须匹配;安装前记录回滚。
执行步骤
- 未安装时先生成计划,获确认后从本地路径使用
pip --no-index或匹配 DEB。 - 导入后记录
HB_HBMRuntime.version和包来源。 - 先读取
model_names、input_names、input_shapes、input_dtypes,与编译合同逐项核对。 - 按参考手册构造 ndarray;多输入顺序、BPU core、priority 等不得凭经验补写。
- 执行
runtime.run(...),保存输出 shape/dtype/摘要和板端日志。 - 与同一输入的参考结果比较,不以“能加载”作为正确性完成。
产物与完成标准
- 版本门禁、安装来源、Python ABI、
HB_HBMRuntime.version和模型 I/O 证据。 - 可运行脚本、输入哈希、输出文件与正确性比较。
- 收据明确该模型/包仅适用于当前 X5 环境。
风险与确认
读取和推理为低/中风险;安装 wheel/DEB、升级系统包或覆盖 Python 环境前必须明确确认。不得混装 S 系列包排障。
失败与交接
版本/ABI/导入问题 → x5-environment-probe;模型/输出问题 → x5-model-diagnostics。同一安装或运行策略最多两次。
按需参考
.drobotics/skills/x5-bpu-python-api/references/x5_bpu_pyapi.md
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

