waylong/deepcpgdna-hou2016-hepg2
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

multimolecule/deepcpgdna-hou2016-hepg2 on Ascend NPU

模型与任务

  • 模型:multimolecule/deepcpgdna-hou2016-hepg2
  • Revision:6671f9ba39a3e3e2604986e691aabde45b2953c4
  • 适配路线:regulatory-sequence
  • 设备:npu:0

环境依赖

{
  "torch": "2.9.0+cpu",
  "torch_npu": "2.9.0.post1+gitee7ba04",
  "transformers": "5.9.0",
  "multimolecule": "0.2.1",
  "npu_name": "Ascend910_9362",
  "npu_count": 2,
  "python": "3.11.14",
  "cann": "8.5.1"
}

安装:pip install -r requirements.txt

NPU 推理

默认执行:python inference.py

真实输入

{
  "sequence": "ACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGT...CGTACGTACGTACGTACGTA",
  "length": 1001,
  "sha256": "f8f15f3762978b8afb41e908fb03f5382f056c12d4677d09b2bdafd807798a7d",
  "source": "synthetic ACGT repeat, traceable 1001 bp CpG-centered window",
  "alphabet": "A/C/G/T/N (DnaTokenizer, vocab_size 5)",
  "direction": "5'->3'",
  "model_max_length": 1001,
  "num_labels": 6,
  "labels": [
    "HepG21",
    "HepG22",
    "HepG23",
    "HepG24",
    "HepG25",
    "HepG26"
  ]
}

真实推理结果

{
  "type": "per-cell methylation logits [batch, 6] -> sigmoid prob",
  "cpu_logits": [
    -8.754864692687988,
    -8.709441184997559,
    -9.558733940124512,
    -9.117125511169434,
    -8.84443473815918,
    -8.949037551879883
  ],
  "npu_logits": [
    -8.755249977111816,
    -8.70981216430664,
    -9.559146881103516,
    -9.117514610290527,
    -8.844820976257324,
    -8.94941520690918
  ],
  "cpu_probs": [
    0.0001576674694661051,
    0.0001649932237342,
    7.057712355162948e-05,
    0.00010975770419463515,
    0.00014416112389881164,
    0.00012984522618353367
  ],
  "npu_probs": [
    0.00015760674432385713,
    0.00016493203293066472,
    7.054798334138468e-05,
    0.00010971501615131274,
    0.00014410547737497836,
    0.0001297962007811293
  ],
  "output_shape": [
    1,
    6
  ],
  "dtype": "float32",
  "task": "regulatory-sequence methylation"
}

CPU-NPU 一致性

{
  "max_abs_diff": 0.00041294097900390625,
  "mean_abs_diff": 0.00038703282674153644,
  "atol": 0.0001,
  "rtol": 0.0001,
  "passed": true,
  "method": "torch.allclose CPU vs NPU logits",
  "note": "prob diff < 6.2e-08, cosine 1.0"
}

性能

{
  "device": "npu:0",
  "first_latency_ms": 1.118,
  "avg_latency_ms": 1.133,
  "min_ms": 1.106,
  "max_ms": 1.166,
  "throughput_seq_per_s": 882.42,
  "throughput_bases_per_s": 883301.17,
  "sequence_length": 1001,
  "batch_size": 1,
  "dtype": "float32",
  "warmup": 3,
  "stable_runs": 10,
  "npu_memory_allocated_mb": 16.93
}

自验证截图

Agent workflow

NPU device call

Model result

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

已知限制

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

标签

#NPU #Ascend #Ascend910