w
gcw_uQ09W7jl/sptransformer
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

multimolecule/sptransformer on Ascend NPU

模型与任务

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

环境依赖

{
  "torch": "2.9.0+cpu",
  "torch_npu": "2.9.0.post1+gitee7ba04",
  "transformers": "5.9.0",
  "python": "3.11.14",
  "device_name": "Ascend910_9362",
  "npu_count": 2,
  "model_dir": "/opt/atomgit/adapt-npu-agent/model_cache/sptransformer",
  "dtype": "float32",
  "context": 4000,
  "max_seq_len": 8192
}

安装:pip install -r requirements.txt

NPU 推理

默认执行:python inference.py

真实输入

{
  "primary_sequence": "AUGGCCCUGUGGAUGCGCCUCCUGCCCCUGCUGGCGCUGCUGGCCCUCUGGGGACCUGACCCAGCCGCAGCCUUUGUGAACCAACACCUGUGCGGCUCACACCUGGUGGAAGCUCUCUAC...",
  "primary_length": 333,
  "primary_sha256": "f94af5b8cf66600fae963521f441dcb6c933e2d93165ba93bcafa3941ca946fc",
  "primary_name": "insulin_333",
  "all_sequences": [
    {
      "name": "prion_protein_63",
      "length": 66,
      "sha256": "b13eab6f030bf48898ab86417cf75cf062002770738e5154c82c177678567c98",
      "preview": "AUGGCGAACCUUGGCUGCUGGAUGCUGGUU"
    },
    {
      "name": "insulin_333",
      "length": 333,
      "sha256": "f94af5b8cf66600fae963521f441dcb6c933e2d93165ba93bcafa3941ca946fc",
      "preview": "AUGGCCCUGUGGAUGCGCCUCCUGCCCCUG"
    },
    {
      "name": "interleukin_10_52",
      "length": 54,
      "sha256": "d47b009f29fb5202eeaa908b2b4a78329ecf843244a82b0f32fdcf6858d4b342",
      "preview": "AUGCACAGCUCAGCACUGCUCUGUUGCCUG"
    }
  ],
  "performance_sequence_length": 2000,
  "performance_sha256": "9b703a7e42f27497bb7af3caad3b230448742a35c4e50ef75eb4e9dcb3973eef",
  "alphabet": "A/C/G/U/N (RNA, T->U), direction 5'->3'",
  "species": "human",
  "context": 4000,
  "tokenizer": "RnaTokenizer vocab A(0) C(1) G(2) U(3) N(4) replace_T_with_U True",
  "output_labels": [
    "no-splice",
    "acceptor",
    "donor",
    "tissue_0",
    "tissue_1",
    "tissue_2",
    "tissue_3",
    "tissue_4",
    "tissue_5",
    "tissue_6",
    "tissue_7",
    "tissue_8",
    "tissue_9",
    "tissue_10",
    "tissue_11",
    "tissue_12",
    "tissue_13",
    "tissue_14"
  ],
  "padding": "variable length, N padding for context 4000"
}

真实推理结果

{
  "logits_shape": [
    1,
    333,
    18
  ],
  "logits_dtype": "torch.float32",
  "logits_min": -15.311710357666016,
  "logits_max": 8.119446754455566,
  "logits_mean": -9.184134483337402,
  "logits_sample_0": [
    6.422492504119873,
    -6.44401741027832,
    -5.4474616050720215,
    -11.718724250793457,
    -11.747530937194824,
    -11.838435173034668,
    -11.68300724029541,
    -11.725865364074707,
    -12.016944885253906,
    -11.510342597961426,
    -11.480043411254883,
    -11.56554889678955,
    -12.203722953796387,
    -11.764320373535156,
    -11.591487884521484,
    -11.748373031616211,
    -11.51771068572998,
    -11.731771469116211
  ],
  "splice_sample_0": [
    6.422492504119873,
    -6.44401741027832,
    -5.4474616050720215
  ],
  "tissue_sample_0": [
    -11.718724250793457,
    -11.747530937194824,
    -11.838435173034668,
    -11.68300724029541,
    -11.725865364074707
  ],
  "donor_top3_cpu": [
    185,
    194,
    88
  ],
  "donor_top3_npu": [
    185,
    194,
    88
  ],
  "acceptor_top3_cpu": [
    195,
    223,
    186
  ],
  "acceptor_top3_npu": [
    195,
    223,
    186
  ],
  "finite_ratio": 100.0
}

CPU-NPU 一致性

{
  "max_abs_diff": 0.0066280364990234375,
  "mean_abs_diff": 0.0013362309974075995,
  "tissue_max": 0.0066280364990234375,
  "tissue_mean": 0.0014075231738388538,
  "atol": 0.005,
  "rtol": 0.005,
  "pearson_corr": 0.9999999639146808,
  "passed": true,
  "finite_ok": true,
  "overlap_donor": 3,
  "overlap_acceptor": 3
}

性能

{
  "warmup_runs": 3,
  "stable_runs": 10,
  "avg_ms": 53.13,
  "min_ms": 25.3,
  "max_ms": 93.5,
  "p50_ms": 59.52,
  "long_avg_ms": 44.4,
  "seq_per_s": 18.82,
  "bases_per_s": 6268,
  "long_seq_per_s": 22.52,
  "long_bases_per_s": 45047,
  "input_length": 333,
  "long_input_length": 2000,
  "output_shape": [
    1,
    333,
    18
  ],
  "dtype": "float32",
  "device": "npu:0",
  "context": 4000
}

自验证截图

Agent workflow

NPU device call

Model result

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

已知限制

  • Only verified for fixed revision, input contract (primary insulin 333 nt + synthetic 2000 nt), dtype float32 and current Ascend 910 environment. Single sequence smoke consistency, not full GTEx benchmark.

标签

#NPU #Ascend #Ascend910