waylong/openspliceai-mane.400
模型介绍
文件和版本
Pull Requests
讨论
分析

multimolecule/openspliceai-mane.400 适配 Ascend NPU

模型与任务

  • 模型:multimolecule/openspliceai-mane.400
  • 版本:eb24f956d1e6182eaa6e1110820cb30542f1ad66
  • 适配路线:splicing
  • 设备:npu:0

环境依赖

{
  "torch": "2.9.0+cpu",
  "torch_npu": "2.9.0.post1+gitee7ba04",
  "transformers": "5.9.0",
  "huggingface_hub": "1.28.0",
  "tokenizers": "0.22.0",
  "multimolecule": "0.2.1",
  "npu_device": "Ascend910_9362",
  "npu_count": 2,
  "cann": "8.5.1",
  "python": "3.11.14"
}

安装:pip install -r requirements.txt

NPU 推理

默认运行:python inference.py

真实输入

{
  "sequence_type": "DNA",
  "alphabet": "A/C/G/T/N",
  "length": 400,
  "context": 400,
  "species": "Homo sapiens",
  "genome": "GRCh38",
  "source": "INS gene synthetic 400bp window (insulin coding + GTAAGTAA intronic repeat)",
  "seq_head_50": "ATGGCCCTGTGGATGCGCCTCCTGCCCCTGCTGGCGCTGCTGGCCCTCTG",
  "gc_content": 0.58,
  "sha256": "412397e37d466286d83d58fcaf1dc1b6",
  "sha256_full": "412397e37d466286d83d58fcaf1dc1b67f19960fed4d38dfde5c7a83b62ce0e4",
  "tokenizer": "RnaTokenizer",
  "replace_T_with_U": true,
  "attention_mask": "all 1 (no padding)"
}

真实推理结果

{
  "logits_shape": [
    1,
    400,
    3
  ],
  "num_labels": 3,
  "label_semantics": "0=neither, 1=acceptor (AG), 2=donor (GT)",
  "dtype": "float32",
  "prob_sum_check": "1.0000 per position after softmax",
  "donor_max_prob": 0.9778282642364502,
  "donor_max_pos": 332,
  "donor_mean_prob": 0.002446,
  "acceptor_max_prob": 0.0001275749527849257,
  "acceptor_max_pos": 312,
  "top5_donor": [
    [
      332,
      0.9778282642364502
    ],
    [
      185,
      0.00045532616786658764
    ],
    [
      336,
      0.00010623771959217265
    ],
    [
      331,
      3.2049425499280915e-05
    ],
    [
      324,
      2.5813626052695327e-05
    ]
  ],
  "top5_acceptor": [
    [
      312,
      0.0001275749527849257
    ],
    [
      223,
      1.1482019544928335e-05
    ],
    [
      332,
      3.6670985537057277e-06
    ],
    [
      261,
      3.6458222893998027e-06
    ],
    [
      185,
      3.643988520707353e-06
    ]
  ],
  "sample_logits_pos0": [
    0.7617248296737671,
    -16.916522979736328,
    -17.922508239746094
  ],
  "sample_logits_pos200": [
    3.357851505279541,
    -18.738487243652344,
    -20.563556671142578
  ]
}

CPU-NPU 一致性

{
  "method": "compare_outputs.py cpu vs npu identical sequence and weights",
  "shape": [
    1,
    400,
    3
  ],
  "elements": 1200,
  "max_abs_diff": 0.005191802978515625,
  "mean_abs_diff": 0.0007416549445285151,
  "atol": 0.01,
  "rtol": 0.001,
  "passed": true,
  "note": "float32 donor/acceptor logits; NPU one_hot internal format warning but numerical diff within 0.01"
}

性能

{
  "warmup": 3,
  "stable_iters": 10,
  "npu_avg_ms": 2.07,
  "npu_min_ms": 2.05,
  "npu_max_ms": 2.11,
  "npu_throughput_seq_per_s": 482.54,
  "npu_throughput_bases_per_s": 193016.8,
  "cpu_avg_ms": 11.37,
  "cpu_throughput_seq_per_s": 87.97,
  "speedup_npu_vs_cpu": 5.49,
  "input_len": 400,
  "output_shape": [
    1,
    400,
    3
  ],
  "dtype": "float32",
  "synchronize": "torch.npu.synchronize() before and after timing",
  "peak_memory_hbm_mb": 3111
}

自验证截图

智能体工作流

NPU 设备调用

模型结果

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

已知限制

  • 仅针对本次记录中的模型 revision、输入契约、dtype 与 Ascend 环境完成验证。
  • 单序列冒烟一致性并不代表完整精度评测;长序列与多 batch 场景还需要额外的显存评估。
  • 剪接任务以 per-nucleotide 3-class logits 作为比较对象,位点排名仅用于演示,不作为临床判定。

标签

#NPU #Ascend #Ascend910