gcw_6a3w2yXz/pangolin
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

multimolecule/pangolin on Ascend NPU

模型与任务

  • 模型:multimolecule/pangolin
  • Revision:39f9ff44ed65f773099c363712934d13c277c8d0
  • 适配路线:splicing
  • 设备:npu:0

环境依赖

{
  "torch_version": "2.9.0+cpu",
  "torch_npu_version": "2.9.0.post1+gitee7ba04",
  "device_name": "Ascend910_9362",
  "device_count": 2,
  "npu_available": true,
  "python_version": "3.11.14"
}

安装:pip install -r requirements.txt

NPU 推理

默认执行:python inference.py

真实输入

{
  "sequence": "AUGGCCCUGUGGAUGCGCCUCCUGCCCCUGCUGGCGCUGCUGGCCCUCUGGGGACCUGACCCAGCCGCAGCCUUUGUGAACCAACACCUGUGCGGCUCACACCUGGUGGAAGCUCUCUACCUAGUGUGCGGGGAACGAGGCUUCUUCUACACACCCAAGACCCGCCGGGAGGCAGAGGACCUGCAGGUGGGGCAGGUGGAGCUGGGCGGGGGCCCUGGUGCAGGCAGCCUGCAGCCCUUGGCCCUGGAGGGGUCCCUGCAGAAGCGUGGCAUUGUGGAACAAUGCUGUACCAGCAUCUGCUCCCUCUACCAGCUGGAGAACUACUGCAACUAG",
  "sequence_sha256": "f94af5b8cf66600fae963521f441dcb6c933e2d93165ba93bcafa3941ca946fc",
  "length": 333,
  "alphabet": "ACGU",
  "tokenizer": "RnaTokenizer",
  "vocab_size": 5,
  "source": "insulin mRNA from model card (real 5' mRNA, 333 nt, validated RNA alphabet)",
  "attention_mask": "not required per official Pangolin example; input_ids shape [1,333]",
  "tissue_names": [
    "heart",
    "liver",
    "brain",
    "testis"
  ],
  "num_tissues": 4,
  "output_channels": 12,
  "context": 10000
}

真实推理结果

{
  "probabilities_shape": [
    1,
    333,
    12
  ],
  "last_hidden_shape": [
    1,
    333,
    32
  ],
  "output_type": "per-nucleotide tissue-specific splice logits [B,L,12] = 4 tissues * (2 splice softmax + 1 usage sigmoid)",
  "prob_mean_cpu": 0.33752,
  "prob_max_cpu": 0.954181,
  "prob_min_cpu": 0.004377,
  "prob_mean_npu": 0.337521,
  "prob_max_npu": 0.95415,
  "sample_prob_cpu_pos0": [
    0.9362649321556091,
    0.06373503804206848,
    0.012069460935890675,
    0.9463034272193909,
    0.053696561604738235,
    0.009713019244372845,
    0.9461875557899475,
    0.053812433034181595,
    0.011637496761977673,
    0.9336164593696594,
    0.0663834735751152,
    0.017195798456668854
  ],
  "dtype": "float32",
  "num_labels": 4,
  "model_type": "pangolin"
}

CPU-NPU 一致性

{
  "prob_max_abs_diff": 0.000240325927734375,
  "prob_mean_abs_diff": 1.9e-05,
  "hidden_max_abs_diff": 0.002773,
  "hidden_mean_abs_diff": 0.000258,
  "atol": 0.001,
  "rtol": 0.001,
  "passed": true,
  "note": "All convolutional layers executed on npu:0 with torch.npu.synchronize; one_hot and dilated residual blocks verified on NPU; no CPU fallback."
}

性能

{
  "sequence_length": 333,
  "prob_shape": "1x333x12",
  "first_latency_s": 1.229,
  "stable_avg_latency_s": 1.0637,
  "sequence_per_s": 0.94,
  "bases_per_s": 313.06,
  "warmup_iters": 3,
  "stable_iters": 10,
  "dtype": "float32",
  "device": "npu:0",
  "note": "Timing with torch.npu.synchronize before/after; distinguishes first compile+inference vs stable."
}

自验证截图

Agent workflow

NPU device call

Model result

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

已知限制

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

标签

#NPU #Ascend #Ascend910