m
mengsihan/mtsplice
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

multimolecule/mtsplice on Ascend NPU

模型与任务

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

环境依赖

{
  "python": "3.11.14",
  "torch": "2.9.0+cpu",
  "torch_npu": "2.9.0.post1+gitee7ba04",
  "cann": "8.5.1",
  "device_name": "Ascend910_9362",
  "device_count": 2,
  "dtype": "float32",
  "model_dir": "/tmp/mtsplice_weights"
}

安装:pip install -r requirements.txt

NPU 推理

默认执行:python inference.py

真实输入

{
  "reference_sequence_length": 800,
  "alternative_sequence_length": 800,
  "reference_sha256": "214fb4ef2cbb04ec6b3508a3fab2c592e9b84c8def3e385e99504671f29aa9c4",
  "alternative_sha256": "89998787abbb72d190e1fd7a4185dabed5267e1c9f5f7c45effba07416ba8137",
  "reference_snippet_5prime": "AUGCAUGCAUGCAUGCAUGCAUGCAUGCAUGCAUGCAUGCAUGCAUGCAU",
  "alternative_snippet_5prime": "AUGCAUGCAUGCAUGCAUGCAUGCAUGCAUGCAUGCAUGCAUGCAUGCAU",
  "variant_position": 400,
  "reference_base": "A",
  "alternative_base": "U",
  "acceptor_length": 400,
  "donor_length": 400,
  "total_length": 800,
  "short_reference": "AGCAGUCAUUAUGGCGAAUCUGGCAAGUA",
  "short_alternative": "AGCAGUCAUUAUGGCUAAUCUGGCAAGUA",
  "short_length": 29,
  "short_reference_sha256": "b7f89be8dec01e5543f9ded687a50d7feaa2b3fde1ec2ec958bd023a7e6b8bf1",
  "tokenizer": "RnaTokenizer",
  "alphabet": "A/C/G/U/N",
  "species": "human (GTEx 56 tissues)",
  "strand": "5'->3'",
  "batch_size": 1
}

真实推理结果

{
  "logits_shape": [
    1,
    56
  ],
  "logits_dtype": "float32",
  "logits_device": "npu:0",
  "alternative_logits_shape": [
    1,
    56
  ],
  "delta_logits_shape": [
    1,
    56
  ],
  "sample_logits_first5": [
    2.6594133377075195,
    -0.8562149405479431,
    -0.8891149163246155,
    -0.8306057453155518,
    -0.8282083868980408
  ],
  "sample_delta_first5": [
    0.00399470329284668,
    -0.000749051570892334,
    -0.0011499524116516113,
    -0.0012347698211669922,
    -0.0011220574378967285
  ],
  "short_delta_sample_first5": [
    0.3010508120059967,
    -0.06507621705532074,
    -0.03319607675075531,
    -0.0466562956571579,
    -0.1175372302532196
  ],
  "logits_min": -1.2143903970718384,
  "logits_max": 3.400331497192383,
  "logits_mean": 0.0456245020031929,
  "delta_min": -0.002463117241859436,
  "delta_max": 0.004766225814819336,
  "delta_mean_abs": 0.0017456308705732226
}

CPU-NPU 一致性

{
  "description": "CPU (float32) vs NPU (float32, npu:0) same weights, same sequences, same preprocessing, synchronized",
  "logits": {
    "max_abs_diff": 0.00021576881408691406,
    "mean_abs_diff": 7.358732234154428e-05,
    "atol": 0.0005,
    "rtol": 0.0001,
    "passed": true
  },
  "delta_logits": {
    "max_abs_diff": 2.16066837310791e-06,
    "mean_abs_diff": 5.939177104404994e-07,
    "atol": 0.0001,
    "rtol": 0.0001,
    "passed": true
  },
  "short_delta_logits": {
    "max_abs_diff": 3.814697265625e-05,
    "mean_abs_diff": 1.824442214066429e-05,
    "atol": 0.0005,
    "rtol": 0.0001,
    "passed": true
  },
  "overall_pass": true,
  "cpu_device": "cpu",
  "npu_device": "npu:0",
  "dtype": "float32"
}

性能

{
  "device": "npu:0",
  "dtype": "float32",
  "batch_size": 1,
  "sequence_length": 800,
  "warmup_iterations": 3,
  "stable_iterations": 10,
  "avg_latency_ms": 2.37,
  "throughput_seq_per_s": 421.2,
  "throughput_bases_per_s": 336961.5,
  "variant_forward_ms": 7.54,
  "all_latencies_ms": [
    2.38,
    2.39,
    2.33,
    2.39,
    2.41,
    2.36,
    2.4,
    2.33,
    2.36,
    2.39
  ],
  "first_compile_included": false,
  "peak_memory_mb": 2.5,
  "synchronized": true
}

自验证截图

Agent workflow

NPU device call

Model result

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

已知限制

  • 仅对本次记录的模型 revision、输入契约、dtype 与 Ascend 环境完成验证。
  • MTSplice 的 800bp 窗口为典型 cassette-exon-with-flanks;短序列结果仅作 smoke。

标签

#NPU #Ascend #Ascend910