赛事: 昇腾 Model Agent 模型适配大赛(第二季) 引擎: torch_npu + 自包含 PyTorch 实现(CSI 编码器) 硬件: Ascend 310P / 910B 标签:
npuascendpytorchwifi-sensingedge-ai
RuView 是一套 WiFi 感知模型,将 WiFi 信号转化为空间智能(人体检测、呼吸/心率 测量、姿态估计等)。本适配交付其对比学习编码器(csi-encoder-8-64-128): 8 维 CSI 特征 → 64 维隐藏 → 128 维嵌入,带 LoRA 低秩适配与 presence 检测头。 库依赖 onnxruntime,本交付为 torch 版等价实现,可在昇腾 NPU 上运行。
| 属性 | 值 |
|---|---|
| 原始模型 | https://huggingface.co/ruv/ruview |
| 架构 | csi-encoder-8-64-128(对比学习编码器 + LoRA + presence head) |
| 任务类型 | WiFi 感知(CSI 嵌入 + presence 检测) |
| 输入格式 | 8 维 CSI 特征 |
| 输出格式 | 128 维嵌入 + presence 概率 |
pip install -r requirements.txt -i https://repo.huaweicloud.com/repository/pypi/simple/⚠️ 本仓库不包含模型权重(交付件仅
inference.py/readme.md/requirements.txt/assets/), 推理前必须先从原始模型仓单独下载权重。
# 1. 下载模型权重(仓库不含权重,必须单独下载)
git clone https://gitcode.com/hf_mirrors/ruv/ruview.git ./ruview
# 2. 运行 NPU 推理
python3 inference.py --model_path ./ruview \
--batch 4 --device npu:0 --output inference_result.jsonpython3 inference.py --model_path ./ruview \
--batch 4 --device npu:0 --output inference_result.json预期输出:
[Model Agent] ✅ NPU 设备就绪: Ascend310P3
[Model Agent] ✅ 模型加载完成 → npu:0
[Model Agent] ✅ 推理完成: 嵌入 (4, 128), presence (4, 1), 耗时 0.0023s
[Model Agent] ✅ 结果已保存 → inference_result.json推理结果摘要:
{
"model": "ruv/ruview",
"engine": "torch_npu",
"device": "npu:0",
"embedding_shape": [4, 128],
"presence": [0.5, 0.5, 0.5, 0.5],
"inference_time_s": 0.0023
}.
├── inference.py # NPU 推理脚本
├── readme.md # 本文件
├── requirements.txt # 依赖清单
└── assets/ # 截图素材本模型由 昇腾 Model Agent 自动完成 NPU 适配:
__metadata__ 字段且 JSON 尾部有 3 字节 padding,标准 safetensors 库
解析失败,inference.py 实现逐步截短定位 JSON 真实结束点的容错解析