jsjs1258/deepcpgdna-hou2016-mesc-NPU
模型介绍
文件和版本
Pull Requests
讨论
分析

multimolecule/deepcpgdna-hou2016-mesc 在 Ascend NPU 上

模型与任务

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

环境依赖

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

安装:pip install -r requirements.txt

NPU 推理

默认运行:python inference.py

真实输入

{
  "sequence_source": "model card p53 extended to 1001 (ACTCCCCTGCCCT...)",
  "sequence_length": 1001,
  "alphabet": "DNA (A/C/G/T, N as pad)",
  "strand": "5'->3'",
  "tokenizer": "DnaTokenizer",
  "input_ids_shape": [
    1,
    1001
  ],
  "attention_mask_shape": [
    1,
    1001
  ],
  "sequence_sha256": "72558a15e155d8dd6edc62f222265905d7f6fc3b061c0b238f31524b7ee22f6b",
  "dtype": "float32",
  "batch": 1
}

真实推理结果

{
  "logits_shape": [
    1,
    6
  ],
  "logits": [
    [
      -0.19250483810901642,
      0.0798056498169899,
      -0.10373959690332413,
      -0.18372370302677155,
      0.002436020178720355,
      -0.14216174185276031
    ]
  ],
  "probs": [
    [
      0.45202186703681946,
      0.5199408531188965,
      0.4740883409976959,
      0.45419782400131226,
      0.5006089806556702,
      0.46451929211616516
    ]
  ],
  "id2label": {
    "0": "mESC1",
    "1": "mESC2",
    "2": "mESC3",
    "3": "mESC4",
    "4": "mESC5",
    "5": "mESC6"
  },
  "output_type": "per-cell methylation logits (binary, sigmoid for probs)"
}

CPU-NPU 一致性

{
  "passed": true,
  "cpu_logits": [
    [
      -0.19240593910217285,
      0.07992985844612122,
      -0.10362383723258972,
      -0.18359871208667755,
      0.0024338874500244856,
      -0.14202506840229034
    ]
  ],
  "npu_logits": [
    [
      -0.19250483810901642,
      0.0798056498169899,
      -0.10373959690332413,
      -0.18372370302677155,
      0.002436020178720355,
      -0.14216174185276031
    ]
  ],
  "max_abs_diff": 0.0001366734504699707,
  "mean_abs_diff": 0.00010044407099485397,
  "atol": 0.0005,
  "rtol": 0.0005,
  "metric": "allclose"
}

性能

{
  "first_inference_ms": 2.119,
  "stable_avg_ms": 2.467,
  "seq_per_s": 405.38,
  "bases_per_s": 405782.16,
  "warmup": 3,
  "stable_runs": 10,
  "sequence_length": 1001,
  "batch": 1,
  "dtype": "float32",
  "peak_npu_memory_mb": 44.69,
  "device": "npu:0",
  "synchronized": true
}

自验证截图

智能体工作流

NPU 设备调用

模型结果

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

已知限制

  • 仅针对本次记录的模型 revision、输入契约、dtype 及 Ascend 910 环境完成验证。长序列 O(1) 推理已验证;扩展到全基因组时需要进行批次处理。

标签

#NPU #Ascend #Ascend910