liucu/spotrna-npu
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

multimolecule/spotrna on Ascend NPU

模型与任务

  • 模型:multimolecule/spotrna
  • Revision:ea6e067d459da10f3e9154c90dd822ece47cf522
  • 适配路线:rna-secondary-structure
  • 设备:npu:0

环境依赖

{
  "torch": "2.9.0+cpu",
  "torch_npu": "2.9.0.post1+gitee7ba04",
  "device_name": "Ascend910_9362",
  "device_count": 2,
  "python": "3.11.14",
  "cann": "8.5.1",
  "model_dir": "/opt/atomgit/adapt-npu-agent/working/spotrna_weights",
  "dtype": "float32"
}

安装:pip install -r requirements.txt

NPU 推理

默认执行:python inference.py

真实输入

{
  "route": "rna-secondary-structure",
  "alphabet": "RNA A/C/G/U/N (vocab 5, replace_T_with_U true)",
  "strand": "5'->3'",
  "sequence_length": 74,
  "batch": 1,
  "primary_sequence": "GGGCUAUUAGCUCAGUUGGUUAGAGCGCACCCCUGAUAAGGGUGAGGUCGCUGAUUCGAAUUCAGCAUAGCUCA",
  "primary_sha256": "f5014cfb7b1ff718df070139c8fe937414f7a8de7396b7e2a0faed0f405b3d6f",
  "secondary_sequence": "UAGCUUAUCAGACUGAUGUUGA",
  "secondary_sha256": "9c1b1cd23c45d39dd0b1fb28d72c49c0edcc57a16cb61c96119f84676c4b5b1c",
  "secondary_len": 22,
  "valid_tokens_mask": "all bases valid; N padding not used for primary",
  "threshold": 0.335,
  "species": "synthetic tRNA-Phe + microRNA-21 widget example",
  "tokenizer": "RnaTokenizer 1-mer, pad=N id0, replace_T_with_U true",
  "dtype": "float32",
  "source": "model card widget tRNA-Phe 74 nt"
}

真实推理结果

{
  "contact_map_shape": [
    1,
    74,
    74
  ],
  "contact_map_dtype": "float32",
  "contact_map_device": "npu:0",
  "contact_map_stats": {
    "min": 0.0,
    "max": 0.9991629,
    "mean": 0.005143,
    "std": 0.066064
  },
  "candidates_above_threshold": 30,
  "total_pairs": 2701,
  "top_pairs": [
    {
      "pair": [
        28,
        42
      ],
      "score": 0.9992
    },
    {
      "pair": [
        2,
        70
      ],
      "score": 0.999
    }
  ],
  "postprocess": "binary multiplet-free map via threshold 0.335",
  "num_labels": 1,
  "threshold": 0.335
}

CPU-NPU 一致性

{
  "passed": true,
  "shape": [
    1,
    74,
    74
  ],
  "elements": 5476,
  "max_abs_diff": 6.619095802307129e-05,
  "mean_abs_diff": 1.1856276344076782e-07,
  "atol": 0.0002,
  "rtol": 0.0002
}

性能

{
  "avg_ms": 82.7,
  "p50_ms": 82.7,
  "min_ms": 81.2,
  "max_ms": 84.9,
  "seq_per_s": 12.09,
  "bases_per_s": 894.32,
  "input_length": 74,
  "batch_size": 1,
  "dtype": "float32",
  "device": "npu:0",
  "warmup": 3,
  "stable_runs": 10,
  "peak_memory_mb": 3200,
  "first_compile_ms": 83.9
}

自验证截图

Agent workflow

NPU device call

Model result

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

已知限制

  • 仅对本次记录的模型 revision、输入契约、dtype 与 Ascend 环境完成验证。
  • 单序列 74 nt smoke consistency;完整精度评测需 bprna-spot 数据集。
  • BLSTM NPU 适配包含 pad 形状修复补丁,纯 NPU 执行。

标签

#NPU #Ascend #Ascend910