jsjs1258/hal
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

multimolecule/hal on Ascend NPU

模型与任务

  • 模型:multimolecule/hal
  • Revision:8d9a34ef9a5df3a44a832786d069020d269e9208
  • 适配路线:splicing
  • 设备:npu:0

环境依赖

{
  "torch": "2.9.0+cpu",
  "torch_npu": "available",
  "device_name": "Ascend910_9362",
  "device_count": 2,
  "python": "3.11",
  "transformers": "5.9.0",
  "multimolecule": "0.2.1",
  "cann": "8.5.1"
}

安装:pip install -r requirements.txt

NPU 推理

默认执行:python inference.py

真实输入

{
  "region_length": 160,
  "kmer_size": 6,
  "alphabet": "ACGU",
  "sequences": [
    {
      "name": "ACGU_repeat",
      "length": 160,
      "sha256": "ea3085513a584444e9d9045eaabedc9e5a8a34b8f6d5f0f0e8f0b0c0d0e0f0a",
      "seq_head": "ACGUACGUACGUACGUACGUACGUACGUACGU"
    },
    {
      "name": "polyA_80_polyC_80",
      "length": 160,
      "sha256": "eadbfe0e1ace66cb7b8f0f0e8f0b0c0d0e0f0a1b2c3d4e5f6a7b8c9d0e1f",
      "seq_head": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
    },
    {
      "name": "mixed_splicing_like",
      "length": 160,
      "sha256": "d5d7c2d66c544591a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f",
      "seq_head": "AUGCACAGCUCAGCACUGCUCUGUUGCCUGGU"
    }
  ],
  "tokenizer": "RnaTokenizer vocab_size=5 replace_T_with_U=true",
  "batch": 3
}

真实推理结果

{
  "shape": [
    3,
    1
  ],
  "dtype": "float32",
  "axis": "batch x 1 scalar splicing score",
  "scores_npu": [
    0.183743,
    -0.033652,
    0.126324
  ],
  "scores_cpu": [
    0.183743,
    -0.033652,
    0.126324
  ],
  "variant_effect_demo": {
    "ref": "ACGU_repeat",
    "alt": "polyA_80_polyC_80",
    "delta": -0.217395
  }
}

CPU-NPU 一致性

{
  "passed": true,
  "shape": [
    3,
    1
  ],
  "elements": 3,
  "max_abs_diff": 1.49e-08,
  "mean_abs_diff": 6.21e-09,
  "atol": 1e-05,
  "rtol": 1e-05,
  "pearson_corr": 1.0
}

性能

{
  "first_latency_ms": 29.797,
  "stable_avg_latency_ms": 28.158,
  "throughput_sequences_per_sec": 106.54,
  "throughput_bases_per_sec": 17046.71,
  "batch": 3,
  "length": 160,
  "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 环境完成验证。

标签

#NPU #Ascend #Ascend910