z
zhangyuge147/procapnet-npu
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+gitee7ba04",
  "transformers": "4.57.6",
  "safetensors": "0.8.0",
  "cann": "8.5.1",
  "npu_name": "Ascend910_9362",
  "npu_count": 2
}

安装:pip install -r requirements.txt

NPU 推理

默认执行:python inference.py

真实输入

{
  "sequence_length": 2114,
  "profile_length": 1000,
  "num_strands": 2,
  "vocab_size": 5,
  "sequence_preview": "ACTCCCCTGCCCTCAACAAGATGTTTTGCCAACTGGCCAAGACCTGCCCTGTGCAGCTGTGGGTTGATTCCACACCCCCGCCCGGCACCCGCGTCCGCGCCATGGCCATCTACAAGCAGTCACAGCACATGACGGAGGTTGTGAGGCGCTGCCCCCACCATGAGCGCTGCTCAGATAGCGATGG + N*1914",
  "sequence_sha256": "c69c15be87d671e1e19e49be4db2bd97f5ef357d0b074f7294f2b773ba8ac02a",
  "source": "tumor protein p53 widget example from model card, padded to 2114 with N",
  "tokenizer": "DnaTokenizer streamline ACGTN, replace_U_with_T=true"
}

真实推理结果

{
  "profile_logits": {
    "shape": [
      1,
      1000,
      2
    ],
    "dtype": "float32",
    "device": "npu:0",
    "stats": {
      "mean": -0.683007,
      "std": 0.095774,
      "max": -0.526707,
      "min": -0.88861
    }
  },
  "count_logits": {
    "shape": [
      1,
      1
    ],
    "dtype": "float32",
    "device": "npu:0",
    "value": 1.249985
  },
  "track": {
    "shape": [
      1,
      1000,
      2
    ],
    "dtype": "float32",
    "device": "npu:0",
    "stats": {
      "mean": 0.00124515,
      "max": 0.00144915,
      "sum": 2.4903,
      "plus_mean": 0.00112837,
      "minus_mean": 0.00136192
    }
  }
}

CPU-NPU 一致性

{
  "method": "CPU vs NPU same weights, sequence, dtype float32",
  "profile": {
    "max_abs_diff": 7.677078247070312e-05,
    "mean_abs_diff": 1.9667535525513813e-05,
    "correlation": 0.999999995355855,
    "passed": true,
    "atol": 0.001,
    "rtol": 0.001
  },
  "count": {
    "max_abs_diff": 3.647804260253906e-05,
    "mean_abs_diff": 3.647804260253906e-05,
    "passed": true,
    "atol": 0.001,
    "rtol": 0.001
  },
  "track": {
    "max_abs_diff": 1.3655517250299454e-07,
    "mean_abs_diff": 6.422185094834276e-08,
    "correlation": 0.9999999958468934,
    "passed": true
  }
}

性能

{
  "device": "npu:0",
  "first_inference_ms": 207.69,
  "avg_ms": 13.16,
  "seq_per_s": 76.0,
  "bases_per_s": 160669.61,
  "warmup": 3,
  "stable_iters": 10,
  "dtype": "float32",
  "sequence_length": 2114,
  "profile_length": 1000
}

自验证截图

Agent workflow

NPU device call

Model result

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

已知限制

  • 仅对本次记录的模型 revision、输入契约、dtype 与 Ascend 环境完成验证。
  • 输入为固定 2114bp DNA 窗口,输出 1000bp×2strand PRO-cap 信号;长序列需滑动窗口。
  • N 填充位被模型视为未知碱基,短序列需按官方中心裁剪规则对齐。

标签

#NPU #Ascend #Ascend910