w
gcw_uQ09W7jl/enformer-npu
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

multimolecule/enformer on Ascend NPU

模型与任务

  • 模型:multimolecule/enformer
  • Revision:20daa9146973633a4a0d8afbd9aa93e9efa41de6
  • 适配路线:long-context-tracks
  • 设备:npu:0

环境依赖

{
  "torch": "2.9.0+cpu",
  "torch_npu": "2.9.0.post1+gitee7ba04",
  "transformers": "4.57.6",
  "python": "3.11.14",
  "device_name": "Ascend910_9362",
  "npu_count": 2,
  "model_dir": "persist_models/multimolecule_enformer"
}

安装:pip install -r requirements.txt

NPU 推理

默认执行:python inference.py

真实输入

{
  "sequence": "ACTCCCCTGCCCTCAACAAGATGTTTTGCCAACTGGCCAAGACCTGCCCTGTGCAGCTGTGGGTTGATTCCACACCCCCGCCCGGCACCCGCGTCCGCGCCATGGCCATCTACAAGCAGT...",
  "sequence_length": 196608,
  "sha256": "570ca7c4d769e5dddd25c35221261071354bc6df072f90a18f33bfe1d1968c2a",
  "alphabet": "A/C/G/T/N",
  "direction": "5'->3'",
  "species": "human",
  "target_length": 896,
  "num_tracks": 5313,
  "bin_size_bp": 128,
  "tokenizer": "DnaTokenizer",
  "vocab": [
    "A",
    "C",
    "G",
    "T",
    "N"
  ]
}

真实推理结果

{
  "logits_shape": [
    1,
    896,
    5313
  ],
  "coverage_shape": [
    1,
    896,
    5313
  ],
  "logits_dtype": "torch.float32",
  "coverage_dtype": "torch.float32",
  "logits_min": -6.4550347328186035,
  "logits_max": 33.12366485595703,
  "logits_mean": 0.021093308925628662,
  "logits_sample_0_0": [
    -1.606483817100525,
    -1.1174805164337158,
    -0.14852160215377808,
    -1.6704849004745483,
    -1.2556835412979126
  ],
  "coverage_mean": 1.0722450017929077,
  "finite_ratio": 100.0
}

CPU-NPU 一致性

{
  "max_abs_diff": 0.0186920166015625,
  "mean_abs_diff": 0.00037783511804636996,
  "atol": 0.02,
  "rtol": 0.001,
  "pearson_corr_subset": 0.9999999577490875,
  "passed": true,
  "finite_ok": true
}

性能

{
  "warmup_runs": 3,
  "stable_runs": 10,
  "avg_ms": 139.32,
  "min_ms": 138.7,
  "max_ms": 140.34,
  "p50_ms": 139.26,
  "windows_per_s": 7.18,
  "bases_per_s": 1411232,
  "input_length": 196608,
  "output_shape": [
    1,
    896,
    5313
  ],
  "dtype": "float32",
  "device": "npu:0"
}

自验证截图

Agent workflow

NPU device call

Model result

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

已知限制

  • Only verified for fixed revision, input contract, dtype float32 and current Ascend environment. Single traceable DNA sequence used for smoke consistency, not full accuracy benchmark.

标签

#NPU #Ascend #Ascend910