waylong/deltasplice
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

multimolecule/deltasplice on Ascend NPU

模型与任务

  • 模型:multimolecule/deltasplice
  • Revision:c3196093da03379a21515bf1a25602fa86b40f9c
  • 适配路线:splicing
  • 设备:npu:0

环境依赖

{
  "torch": "2.9.0+cpu",
  "torch_npu": "2.9.0.post1",
  "transformers": "4.44.2",
  "tokenizers": "0.19.1",
  "multimolecule": "0.2.1",
  "device_name": "Ascend910_9362",
  "device_count": 2,
  "npu_available": true,
  "python": "3.11.14"
}

安装:pip install -r requirements.txt

NPU 推理

默认执行:python inference.py

真实输入

{
  "sequence_type": "DNA",
  "alphabet": "A/C/G/T/N",
  "strand": "5'->3'",
  "ref_length": 1180,
  "alt_length": 1180,
  "ref_sha256": "b5e0169d9be9d362",
  "alt_sha256": "75ce4978584cb571",
  "variant_position": 500,
  "ref_allele": "GT",
  "alt_allele": "AT",
  "tokenizer": "RnaTokenizer (replace_T_with_U=true)",
  "input_shape": [
    1,
    1180
  ],
  "context": 30000,
  "num_ensemble": 5
}

真实推理结果

{
  "probabilities_shape": [
    1,
    1180,
    3
  ],
  "site_probabilities_shape": [
    1,
    1180,
    3
  ],
  "delta_shape": [
    1,
    1180,
    3
  ],
  "channels": [
    "no_splice",
    "acceptor",
    "donor"
  ],
  "top_donor_position": 718,
  "top_donor_prob": 0.0138,
  "top_donor_site_prob": 0.1446,
  "top_acceptor_position": 605,
  "top_acceptor_prob": 0.0076,
  "top_acceptor_site_prob": 0.1204,
  "delta_max_abs": 0.0002,
  "delta_mean_abs": 0.0,
  "output_device": "npu:0",
  "output_dtype": "float32"
}

CPU-NPU 一致性

{
  "method": "same weights, same sequences, CPU vs NPU with compare_outputs.py",
  "probabilities": {
    "max_abs_diff": 1.8551945686340332e-06,
    "mean_abs_diff": 1.2254487934101374e-08,
    "atol": 0.0001,
    "rtol": 0.001,
    "passed": true
  },
  "site_probabilities": {
    "max_abs_diff": 2.577155828475952e-05,
    "mean_abs_diff": 1.240763493710146e-07,
    "atol": 0.0001,
    "rtol": 0.001,
    "passed": true
  },
  "delta": {
    "max_abs_diff": 5.048241291660815e-07,
    "mean_abs_diff": 4.114697455762485e-09,
    "atol": 0.0001,
    "rtol": 0.001,
    "passed": true
  }
}

性能

{
  "warmup_iterations": 3,
  "stable_iterations": 10,
  "avg_time_ms": 47.05,
  "sequence_per_s": 21.25,
  "bases_per_s": 25079.1,
  "input_length": 1180,
  "batch_size": 1,
  "dtype": "float32",
  "sync": "torch.npu.synchronize() before and after timing",
  "first_compile_ms": 46.43,
  "device": "npu:0"
}

自验证截图

Agent workflow

NPU device call

Model result

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

已知限制

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

标签

#NPU #Ascend #Ascend910