waylong/enformer
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",
  "device_name": "Ascend910_9362",
  "device_count": 2
}

安装:pip install -r requirements.txt

NPU 推理

默认执行:python inference.py

真实输入

{
  "sequence": "TAGGCGTCGATGCCGATCCCACGGATGATAACCGATACTCGACATCCGTC...",
  "sequence_length": 196608,
  "sequence_sha256": "8b3a7f3950bf7c6ef5a7555c0c9372ad382c044326d7480e2f898733d26bdf70",
  "alphabet": "A/C/G/T/N, replace_U_with_T true, nmers 1",
  "direction": "5'->3'",
  "species": "human",
  "target_length": 896,
  "num_tracks": 5313,
  "bin_size_bp": 128,
  "gc_percent": 50.04,
  "vocab": {
    "A": 0,
    "C": 1,
    "G": 2,
    "T": 3,
    "N": 4
  }
}

真实推理结果

{
  "logits_shape": [
    1,
    896,
    5313
  ],
  "logits_dtype": "torch.float32",
  "logits_device": "npu:0",
  "logits_sample_bin0_track0_5": [
    -4.003873348236084,
    -3.788158416748047,
    -2.786496877670288,
    -3.9326982498168945,
    -4.031175136566162
  ],
  "logits_sample_bin448_track0_5": [
    -2.3343567848205566,
    -2.2514617443084717,
    -1.63042151927948,
    -2.308523178100586,
    -2.5782885551452637
  ],
  "logits_mean": -1.599121332168579,
  "logits_std": 2.334134817123413,
  "logits_min": -10.485201835632324,
  "logits_max": 114.77694702148438,
  "finite_ratio": 1.0
}

CPU-NPU 一致性

{
  "max_abs_diff": 0.04914093017578125,
  "mean_abs_diff": 0.0011301251582111972,
  "pearson_corr_sample_10000": 0.99999968980769,
  "atol": 0.06,
  "rtol": 0.001,
  "passed": true,
  "finite_ratio": 1.0,
  "subsampled_tracks": {
    "0": {
      "max": 0.0058498382568359375,
      "mean": 0.0009059682488441467
    },
    "100": {
      "max": 0.0046443939208984375,
      "mean": 0.0007603346769298826
    },
    "1000": {
      "max": 0.010632514953613281,
      "mean": 0.0016109794544588243
    },
    "2000": {
      "max": 0.009570837020874023,
      "mean": 0.001456196007503812
    },
    "3000": {
      "max": 0.008849382400512695,
      "mean": 0.0013515360125373782
    },
    "4000": {
      "max": 0.013170599937438965,
      "mean": 0.0025162129313685
    },
    "5000": {
      "max": 0.004086494445800781,
      "mean": 0.000568398939711707
    },
    "5312": {
      "max": 0.004117250442504883,
      "mean": 0.000526049839598792
    }
  }
}

性能

{
  "first_iter_s": 0.15945005416870117,
  "stable_avg_ms": 162.53671646118164,
  "windows_per_s": 6.152456022075653,
  "bases_per_s": 1209622.07358825,
  "stable_iters": 10,
  "warmup_iters": 3,
  "input_length": 196608,
  "output_shape": [
    1,
    896,
    5313
  ],
  "batch": 1,
  "dtype": "torch.float32"
}

自验证截图

Agent workflow

NPU device call

Model result

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

已知限制

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

标签

#NPU #Ascend #Ascend910