gcw_6a3w2yXz/multimolecule-bpfold-NPU
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

multimolecule/bpfold on Ascend NPU

模型与任务

  • 模型:multimolecule/bpfold
  • Revision:main
  • 适配路线:rna-secondary-structure
  • 设备:npu:0

环境依赖

{
  "torch": "2.9.0+cpu",
  "torch_npu": "2.9.0.post1+gitee7ba04",
  "device_name": "Ascend910_9362",
  "device_count": 2,
  "dtype": "float32",
  "model_dir": "/tmp/bpfold"
}

安装:pip install -r requirements.txt

NPU 推理

默认执行:python inference.py

真实输入

{
  "sequence": "UAGCUUAUCAGACUGAUGUUGA",
  "length": 22,
  "sha256": "9c1b1cd23c45d39dd0b1fb28d72c49c0edcc57a16cb61c96119f84676c4b5b1c",
  "input_ids_shape": [
    1,
    24
  ],
  "attention_mask_shape": [
    1,
    24
  ],
  "alphabet": "RNA A/C/G/U/N",
  "vocab_size": 11
}

真实推理结果

{
  "contact_map_shape": [
    1,
    22,
    22
  ],
  "contact_map_dtype": "float32",
  "logits_shape": [
    1,
    22,
    22
  ],
  "mean": 0.5129950046539307,
  "min": 0.2251555621623993,
  "max": 0.996335506439209,
  "threshold": 0.5,
  "pairs_gt_threshold_cpu": 170,
  "pairs_gt_threshold_npu": 170,
  "max_abs_diff": 0.0008955597877502441,
  "mean_abs_diff": 0.00015353356138803065
}

CPU-NPU 一致性

{
  "atol": 0.001,
  "rtol": 0.001,
  "max_abs_diff": 0.0008955597877502441,
  "mean_abs_diff": 0.00015353356138803065,
  "passed": true,
  "elements": 484,
  "shape": [
    1,
    22,
    22
  ]
}

性能

{
  "first_latency_ms": 400.423526763916,
  "avg_ms": 78.62515449523926,
  "min_ms": 78.1395435333252,
  "max_ms": 79.02288436889648,
  "p50_ms": 78.60422134399414,
  "p90_ms": 79.0109634399414,
  "p95_ms": 79.0109634399414,
  "warmup": 3,
  "iterations": 10,
  "seq_length": 22,
  "batch_size": 1,
  "dtype": "float32",
  "device": "npu:0"
}

自验证截图

Agent workflow

NPU device call

Model result

三张图片均由 xterm.js 根据本次真实日志生成。

已知限制

  • 仅对本次记录的模型 revision、输入契约、dtype 与 Ascend 环境完成验证。
  • 长序列(277nt) max diff 0.0022 超过1e-3阈值,需更大容差或FP32细节差异,短序列22nt通过一致性验证。

标签

#NPU #Ascend #Ascend910