m
mengsihan/procapnet
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

multimolecule/procapnet on Ascend NPU

模型与任务

  • 模型:multimolecule/procapnet
  • Revision:8703b8aa772c754dbd87f90e074c55f25d723442
  • 适配路线:regulatory-sequence
  • 设备:npu:0

环境依赖

{
  "python": "3.11.14",
  "torch": "2.9.0+cpu",
  "torch_npu": "2.9.0.post1",
  "cann": "8.5.1",
  "soc": "ascend910_9391",
  "device_name": "Ascend910_9362",
  "device_count": 2,
  "multimolecule": "0.2.1",
  "transformers": "4.57.1",
  "hf_endpoint": "https://hf-mirror.com"
}

安装:pip install -r requirements.txt

NPU 推理

默认执行:python inference.py

真实输入

{
  "sequence": "ACTCCCCTGCCCTCAACAAGATGTTTTGCCAACTGGCCAAGACCTGCCCTGTGCAGCTGTGGGTTGATTCCACACCCCCGCCCGGCACCCGCGTCCGCGCCATGGCCATCTACAAGCAGTCACAGCACATGACGGAGGTTGTGAGGCGCTGCCCCCACCATGAGCGCTGCTCAGATAGCGATGG*12 -> 2114 bp",
  "sequence_length": 2114,
  "sequence_sha256": "233616d27f86001aabc4b0f2e537ed3d0e40e96c1e50669e72cd1cb9ebf23d8a",
  "alphabet": "A/C/G/T/N",
  "tokenizer": "DnaTokenizer 1-mer, vocab_size=5, replace_U_with_T=true",
  "batch_size": 1,
  "dtype": "float32",
  "species": "human K562 (PRO-cap)",
  "profile_length": 1000,
  "num_strands": 2
}

真实推理结果

{
  "profile_logits": {
    "shape": [
      1,
      1000,
      2
    ],
    "dtype": "float32",
    "device": "npu:0",
    "sample": [
      [
        -9.006,
        -6.288
      ],
      [
        -7.544,
        -6.335
      ],
      [
        -9.25,
        -3.67
      ]
    ]
  },
  "count_logits": {
    "shape": [
      1,
      1
    ],
    "dtype": "float32",
    "device": "npu:0",
    "value": 3.909226
  },
  "track": {
    "shape": [
      1,
      1000,
      2
    ],
    "dtype": "float32",
    "device": "npu:0",
    "note": "postprocess(profile_logits, count_logits) base-resolution PRO-cap signal, two-stranded plus/minus"
  }
}

CPU-NPU 一致性

{
  "profile_max_abs_diff": 0.001038,
  "profile_mean_abs_diff": 0.000245,
  "profile_atol": 0.005,
  "profile_rtol": 0.005,
  "profile_pass": true,
  "count_max_abs_diff": 6e-05,
  "count_mean_abs_diff": 6e-05,
  "count_atol": 0.0001,
  "count_rtol": 0.0001,
  "count_pass": true,
  "track_max_abs_diff": 0.000122,
  "track_mean_abs_diff": 4e-06,
  "track_atol": 0.001,
  "track_rtol": 0.001,
  "track_pass": true,
  "overall_pass": true,
  "note": "CPU vs NPU same weights, same sequence, float32, comparison on full 1000x2 profile and scalar count; track is recombined usable prediction"
}

性能

{
  "first_inference_ms": 215.43,
  "stable_avg_ms": 12.48,
  "stable_min_ms": 12.3,
  "stable_max_ms": 12.96,
  "warmup": 3,
  "iterations": 10,
  "sequences_per_second": 80.1,
  "bases_per_second": 169362.0,
  "input_length": 2114,
  "batch": 1,
  "dtype": "float32",
  "peak_memory_MB": 44.9,
  "device": "npu:0",
  "synchronize": "torch.npu.synchronize() before and after timing"
}

自验证截图

Agent workflow

NPU device call

Model result

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

已知限制

  • 仅对本次记录的模型 revision、输入契约、dtype 与 Ascend 910环境完成验证。
  • profile logits 容差 5e-3 已考虑 NPU float32 与 CPU 数值差异,track 容差 1e-3。

标签

#NPU #Ascend #Ascend910