z
zhangyuge147/multimolecule-deepcpgdna-smallwood2014-serum-NPU
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

multimolecule/deepcpgdna-smallwood2014-serum on Ascend NPU

模型与任务

  • 模型:multimolecule/deepcpgdna-smallwood2014-serum
  • Revision:main
  • 适配路线:regulatory-sequence
  • 设备:npu:0

环境依赖

{
  "torch_version": "2.9.0+cpu",
  "torch_npu_version": "2.9.0.post1",
  "device_name": "Ascend910_9362",
  "device_count": 2,
  "cann_version": "8.5.1",
  "python_version": "3.11.14",
  "transformers_version": "5.9.0",
  "multimolecule_version": "0.1.dev249"
}

安装:pip install -r requirements.txt

NPU 推理

默认执行:python inference.py

真实输入

{
  "sequences": 4,
  "length": 1001,
  "alphabet": "A/C/G/T",
  "names": [
    "synthetic_acgt",
    "p53_tumor_suppressor",
    "brca1_repeat",
    "hbb_beta_globin"
  ],
  "sha256_prefix": [
    "f8f15f3762978b8a",
    "72558a15e155d8dd",
    "83c71b4c3f0ad74a",
    "3b3517a325b4a251"
  ],
  "tokenization": "DnaTokenizer 1-mer, one-hot via F.one_hot, attention_mask all 1",
  "batch_shape": [
    4,
    1001
  ],
  "dtype": "int64 input_ids, float32 model"
}

真实推理结果

{
  "logits_shape": [
    4,
    18
  ],
  "logits_dtype": "float32",
  "output_device": "npu:0",
  "probabilities_via_sigmoid": true,
  "example_logits_synthetic_acgt": [
    -5.0954,
    -5.0689,
    -4.833,
    -4.1824,
    -5.2047,
    -4.2781,
    -4.4229,
    -3.1672,
    -5.2372,
    -4.3715,
    -4.4812,
    -5.3508,
    -4.0197,
    -5.2173,
    -3.6144,
    -3.6389,
    -4.3967,
    -4.132
  ],
  "example_logits_p53": [
    0.4021,
    -1.0104,
    -0.8425,
    -0.7533,
    0.0887,
    -1.03,
    0.2758,
    -0.4422,
    -0.0161,
    -0.6671,
    -0.7628,
    0.5541,
    -0.6415,
    -1.1004,
    0.2093,
    -0.1404,
    -0.9896,
    -0.4551
  ],
  "id2label": {
    "0": "BS27_1_SER",
    "1": "BS27_3_SER",
    "2": "BS27_5_SER",
    "3": "BS27_6_SER",
    "4": "BS27_8_SER",
    "5": "BS28_10_SER",
    "6": "BS28_1_SER",
    "7": "BS28_2_SER",
    "8": "BS28_3_SER",
    "9": "BS28_4_SER",
    "10": "BS28_6_SER",
    "11": "BS29_1_SER",
    "12": "BS29_4_SER",
    "13": "BS29_5_SER",
    "14": "BS29_6_SER",
    "15": "BS29_7_SER",
    "16": "BS29_8_SER",
    "17": "BS29_9_SER"
  },
  "problem_type": "binary per cell",
  "methylation_interpretation": "logit>0 predicted methylated, sigmoid prob in [0,1]"
}

CPU-NPU 一致性

{
  "passed": true,
  "shape": [
    4,
    18
  ],
  "elements": 72,
  "max_abs_diff": 0.0007195472717285156,
  "mean_abs_diff": 0.0003077767065001859,
  "atol": 0.001,
  "rtol": 0.001,
  "method": "same weights, same 4 sequences, CPU vs npu:0, compare_outputs.py",
  "cpu_device": "cpu",
  "npu_device": "npu:0",
  "dtype": "float32"
}

性能

{
  "device": "npu:0",
  "dtype": "float32",
  "batch": 4,
  "sequence_length": 1001,
  "warmup": 3,
  "timed_runs": 10,
  "avg_ms": 2.88,
  "min_ms": 2.85,
  "max_ms": 2.89,
  "first_ms": 2.85,
  "throughput_sequences_per_s": 1388.45,
  "throughput_bases_per_s": 1389843.28,
  "synchronize": "torch.npu.synchronize() before and after",
  "memory_allocated_MB": 16.48,
  "precision": "FP32, no AMP"
}

自验证截图

Agent workflow

NPU device call

Model result

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

已知限制

  • 仅对本次记录的模型 revision main、输入契约 4x1001 DNA、dtype float32 与 Ascend910 环境完成验证。
  • 单批次 4 序列 smoke consistency,非完整染色体评测。
  • NPU 误差 7e-04 来源于浮点累加差异,在 1e-03 阈值内。

标签

#NPU #Ascend #Ascend910