waylong/deepcpgdna-smallwood2014-serum
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

multimolecule/deepcpgdna-smallwood2014-serum on Ascend NPU

模型与任务

  • 模型:multimolecule/deepcpgdna-smallwood2014-serum
  • Revision:b4f028333f9cf613e8b502bf68f7f0246c0a2438
  • 适配路线: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": "ACGTACGTACGTACGTACGTACGTACGTACGT...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": 18,
  "labels": [
    "BS27_1_SER",
    "BS27_3_SER",
    "BS27_5_SER",
    "BS27_6_SER",
    "BS27_8_SER",
    "BS28_10_SER",
    "BS28_1_SER",
    "BS28_2_SER",
    "BS28_3_SER",
    "BS28_4_SER",
    "BS28_6_SER",
    "BS29_1_SER",
    "BS29_4_SER",
    "BS29_5_SER",
    "BS29_6_SER",
    "BS29_7_SER",
    "BS29_8_SER",
    "BS29_9_SER"
  ]
}

真实推理结果

{
  "type": "per-cell methylation logits [batch, 18] -> sigmoid prob",
  "cpu_logits": [
    -5.09471321105957,
    -5.068265914916992,
    -4.832335472106934,
    -4.181824207305908,
    -5.203995227813721,
    -4.277439117431641,
    -4.4221954345703125,
    -3.1665947437286377,
    -5.236511707305908,
    -4.370970249176025,
    -4.480632305145264,
    -5.350144863128662,
    -4.019096851348877,
    -5.216712474822998,
    -3.613701105117798,
    -3.6382803916931152,
    -4.396020889282227,
    -4.131345748901367
  ],
  "npu_logits": [
    -5.095419406890869,
    -5.068943977355957,
    -4.832984924316406,
    -4.182448387145996,
    -5.204664707183838,
    -4.27806282043457,
    -4.422914981842041,
    -3.1672475337982178,
    -5.237218379974365,
    -4.371523380279541,
    -4.4812397956848145,
    -5.350751876831055,
    -4.019700527191162,
    -5.2173261642456055,
    -3.614368438720703,
    -3.6388936042785645,
    -4.396660804748535,
    -4.131964206695557
  ],
  "cpu_probs": [
    0.006091727875173092,
    0.00625396566465497,
    0.007904904894530773,
    0.015040939673781395,
    0.005464543122798204,
    0.013688189908862114,
    0.011865363456308842,
    0.04044235497713089,
    0.005290638189762831,
    0.012481221929192543,
    0.011199401691555977,
    0.004725031089037657,
    0.0176519937813282,
    0.005395861808210611,
    0.026244567707180977,
    0.025623686611652374,
    0.012176202610135078,
    0.015807364135980606
  ],
  "npu_probs": [
    0.006087453104555607,
    0.006249753292649984,
    0.00789981335401535,
    0.015031696297228336,
    0.005460905842483044,
    0.01367977261543274,
    0.011856930330395699,
    0.040417030453681946,
    0.005286920350044966,
    0.012474405579268932,
    0.011192676611244678,
    0.004722177516669035,
    0.017641529440879822,
    0.005392569582909346,
    0.026227518916130066,
    0.025608379393815994,
    0.012168508023023605,
    0.015797745436429977
  ],
  "output_shape": [
    1,
    18
  ],
  "dtype": "float32",
  "task": "regulatory-sequence methylation"
}

CPU-NPU 一致性

{
  "max_abs_diff": 0.0007195472717285156,
  "mean_abs_diff": 0.0006418890552595258,
  "atol": 0.001,
  "rtol": 0.001,
  "passed": true,
  "method": "torch.allclose CPU vs NPU logits",
  "note": "prob diff < 2.6e-05, cosine 1.0"
}

性能

{
  "device": "npu:0",
  "first_latency_ms": 0.99,
  "avg_latency_ms": 0.999,
  "min_ms": 0.969,
  "max_ms": 1.034,
  "throughput_seq_per_s": 1001.32,
  "throughput_bases_per_s": 1002317.72,
  "sequence_length": 1001,
  "batch_size": 1,
  "dtype": "float32",
  "warmup": 3,
  "stable_runs": 10,
  "npu_memory_allocated_mb": 16.43
}

自验证截图

Agent workflow

NPU device call

Model result

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

已知限制

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

标签

#NPU #Ascend #Ascend910