waylong/bpnet-NPU
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

multimolecule/bpnet on Ascend NPU

模型与任务

  • 模型:multimolecule/bpnet
  • Revision:44aafb32fc6d71fcf12d0a73054d28e095fe3099
  • 适配路线:regulatory-sequence
  • 设备:npu:0

环境依赖

{
  "python": "3.11.14",
  "torch": "2.9.0+cpu",
  "torch_npu": "2.9.0.post1",
  "transformers": "4.57.6",
  "multimolecule": "0.2.1",
  "cann": "8.5.1",
  "npu": "Ascend910_9362",
  "npu_count": 2,
  "os": "Linux-5.10.0-182.0.0.95.r2220_156.hce2.aarch64-aarch64-with-glibc2.35"
}

安装:pip install -r requirements.txt

NPU 推理

默认执行:python inference.py

真实输入

{
  "primary_sequence": "synthetic_1000: ACGT*250",
  "primary_length": 1000,
  "primary_sha256": "7150ba7413897abbea34de327a8ee2e10c594e5a3d05f09d9d5dc6b8efd26676",
  "alphabet": "A/C/G/T/N (DNA)",
  "direction": "5'->3'",
  "batch": 1,
  "dtype": "float32",
  "additional_sequences": [
    {
      "name": "p53_184",
      "length": 184
    },
    {
      "name": "kras_122",
      "length": 122
    }
  ],
  "species": "mouse (ChIP-nexus mESC, mm10)",
  "preprocessing": "DnaTokenizer one-hot"
}

真实推理结果

{
  "profile_logits_shape": [
    1,
    1000,
    8
  ],
  "count_logits_shape": [
    1,
    8
  ],
  "postprocess_track_shape": [
    1,
    1000,
    8
  ],
  "tasks": [
    "Oct4",
    "Sox2",
    "Nanog",
    "Klf4"
  ],
  "strands": [
    "forward",
    "reverse"
  ],
  "track_mean": 0.014639,
  "track_std": 0.008522
}

CPU-NPU 一致性

{
  "cpu_npu_track_max_abs_diff": 1.15782e-05,
  "cpu_npu_track_mean_abs_diff": 1.6638e-06,
  "atol": 0.0001,
  "rtol": 0.0001,
  "passed": true
}

性能

{
  "device": "npu:0",
  "device_name": "Ascend910_9362",
  "dtype": "float32",
  "batch": 1,
  "seq_length": 1000,
  "warmup": 3,
  "stable_iterations": 10,
  "avg_time_ms": 6.32,
  "seq_per_sec": 158.3,
  "bases_per_sec": 158287,
  "synchronize": "torch.npu.synchronize()"
}

自验证截图

Agent workflow

NPU device call

Model result

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

已知限制

  • 仅对本次记录的模型 revision、输入契约、dtype 与 Ascend 环境完成验证。

标签

#NPU #Ascend #Ascend910