m
mengsihan/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",
  "transformers": "4.57.1",
  "multimolecule": "0.2.1",
  "python": "3.11.14",
  "npu_name": "Ascend910",
  "npu_count": 2
}

安装:pip install -r requirements.txt

NPU 推理

默认执行:python inference.py

真实输入

{
  "sequence_length": 196608,
  "sequence_sha256": "437204d0b503ffa925beb9799c5606e20451b462d64beadff5431ac60b8fe620",
  "sequence_head": "ATGCCTAGAAGTGTGTGATCGCATTGCTGCCAAGTATTCGATGCATCTGTTACCCAGAGGTGCTCCTCACTACAGCCAGGTCATGGACTTCTTCTCAGGA",
  "sequence_source": "deterministic synthetic random DNA seed 42, A/C/G/T only, length 196608, 5' to 3', no N padding",
  "vocab": [
    "A",
    "C",
    "G",
    "T",
    "N"
  ],
  "vocab_size": 5,
  "input_ids_shape": [
    1,
    196608
  ],
  "input_ids_dtype": "int64",
  "species": "human",
  "target_length": 896,
  "pool_factor": 128
}

真实推理结果

{
  "logits_shape": [
    1,
    896,
    5313
  ],
  "logits_dtype": "float32",
  "logits_device": "npu:0",
  "logits_min": -12.646145,
  "logits_max": 57.480713,
  "logits_mean": -1.507167,
  "coverage_shape": [
    1,
    896,
    5313
  ],
  "coverage_dtype": "float32",
  "coverage_device": "npu:0",
  "coverage_min": 3e-06,
  "coverage_max": 57.480713,
  "coverage_mean": 0.552409,
  "num_tracks": 5313,
  "output_act": "softplus",
  "finite": true
}

CPU-NPU 一致性

{
  "logits_max_abs_diff": 0.049854278564453125,
  "logits_mean_abs_diff": 0.0011573218443506241,
  "coverage_max_abs_diff": 0.049854278564453125,
  "coverage_mean_abs_diff": 0.0003235569756431521,
  "atol": 0.05,
  "rtol": 0.001,
  "passed": true,
  "pearson_logits": 1.0,
  "pearson_coverage": 0.999999,
  "comparison_key": "logits",
  "note": "CPU vs NPU same weights, same sequence, single window smoke consistency"
}

性能

{
  "first_compile_s": 0.4668,
  "avg_stable_s": 0.1387,
  "min_stable_s": 0.1379,
  "max_stable_s": 0.1394,
  "windows_per_s": 7.208,
  "bases_per_s": 1417143.3,
  "sequence_length": 196608,
  "target_length": 896,
  "batch": 1,
  "dtype": "float32",
  "warmup": 3,
  "stable_runs": 10,
  "synchronize": "torch.npu.synchronize() before and after timing"
}

自验证截图

Agent workflow

NPU device call

Model result

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

已知限制

  • 仅对本次记录的模型 revision、输入契约、dtype 与 Ascend 环境完成验证。
  • 单窗口 smoke consistency, 非全数据集精度评测

标签

#NPU #Ascend #Ascend910