gcw_6a3w2yXz/a2zchromatin-methylation
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

multimolecule/a2zchromatin-methylation on Ascend NPU

模型与任务

  • 模型:multimolecule/a2zchromatin-methylation
  • Revision:47ae930b83f8e5264bd4a3cb58c11bc7caa19857
  • 适配路线:regulatory-sequence
  • 设备:npu:0

环境依赖

{
  "torch": "2.9.0+cpu",
  "torch_npu": "2.9.0.post1+gitee7ba04",
  "npu_available": true,
  "device_count": 2,
  "device_name": "Ascend910_9362",
  "model_dir": "/tmp/a2zchromatin-methylation",
  "python": "3.11.14"
}

安装:pip install -r requirements.txt

NPU 推理

默认执行:python inference.py

真实输入

{
  "sequences": [
    "p53_TP53_184pad600",
    "BRCA1_101pad600",
    "HBB_147pad600",
    "random_seed42_600"
  ],
  "sequence_length": 600,
  "batch": 4,
  "alphabet": "A/C/G/T/N/IUPAC+.",
  "sha256_prefix": {
    "p53_TP53_184pad600": "9e12ec27708df048",
    "BRCA1_101pad600": "14b246b4084f03c9",
    "HBB_147pad600": "40a86f24159e5e7f",
    "random_seed42_600": "c089da2d72cf4f7f"
  },
  "note": "padded to 600bp with N, fixed-length DanQ topology, manual BiLSTM NPU patch"
}

真实推理结果

{
  "logits_shape": [
    4,
    1
  ],
  "probs_shape": [
    4,
    1
  ],
  "logits_dtype": "torch.float32",
  "logits_device": "npu:0",
  "probs_device": "npu:0",
  "logits_finite": true,
  "logits_sample_cpu": [
    -4.613759517669678,
    -6.7421064376831055,
    -5.533475399017334,
    -0.464694082736969
  ],
  "logits_sample_npu": [
    -4.613739490509033,
    -6.7420172691345215,
    -5.533683776855469,
    -0.464614599943161
  ],
  "probs_sample_cpu": [
    0.009817142970860004,
    0.0011787674156948924,
    0.00393667072057724,
    0.38587284088134766
  ],
  "probs_sample_npu": [
    0.009817337617278099,
    0.0011788724223151803,
    0.003935853950679302,
    0.38589170575141907
  ]
}

CPU-NPU 一致性

{
  "max_abs_logits": 0.00020837783813476562,
  "mean_abs_logits": 9.926408529281616e-05,
  "pearson_logits": 0.9999999988133532,
  "max_abs_probs": 1.8864870071411133e-05,
  "mean_abs_probs": 4.995323251932859e-06,
  "pearson_probs": 0.9999999999973135,
  "passed": true
}

性能

{
  "first_latency_ms": 244.39413426443934,
  "avg_latency_ms": 16.76596226170659,
  "min_ms": 16.314030159264803,
  "max_ms": 17.173477914184332,
  "p50_ms": 16.91251201555133,
  "p95_ms": 17.173477914184332,
  "sequences_per_s": 238.5786116873225,
  "bases_per_s": 143147.1670123935,
  "batch": 4,
  "seq_len": 600,
  "dtype": "float32"
}

自验证截图

Agent workflow

NPU device call

Model result

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

已知限制

  • 仅对本次记录的模型 revision、输入契约、dtype 与 Ascend 环境完成验证。manual BiLSTM patch used to work around NPU LSTM kernel missing TBE.

标签

#NPU #Ascend #Ascend910