w
gcw_uQ09W7jl/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_available": true,
  "device_name": "Ascend910_9362",
  "device_count": 2,
  "torch_npu": "2.9.0.post1+gitee7ba04",
  "transformers": "5.9.0",
  "multimolecule": "unknown"
}

安装:pip install -r requirements.txt

NPU 推理

默认执行:python inference.py

真实输入

{
  "num_sequences": 4,
  "alphabet": "ACGU (T->U, N for unknown/pad)",
  "replace_T_with_U": true,
  "lengths": {
    "tRNA-Phe_74": 74,
    "microRNA21_22": 22,
    "microRNA155_24": 24,
    "vaultRNA_100": 108
  },
  "sequences": [
    {
      "name": "tRNA-Phe_74",
      "length": 74,
      "sha256": "f5014cfb7b1ff718df070139c8fe937414f7a8de7396b7e2a0faed0f405b3d6f",
      "preview": "GGGCUAUUAGCUCAGUUGGUUAGAGCGCAC"
    },
    {
      "name": "microRNA21_22",
      "length": 22,
      "sha256": "9c1b1cd23c45d39dd0b1fb28d72c49c0edcc57a16cb61c96119f84676c4b5b1c",
      "preview": "UAGCUUAUCAGACUGAUGUUGA"
    },
    {
      "name": "microRNA155_24",
      "length": 24,
      "sha256": "88cbf2c2827047a129e8ef520b418999bf2388f313c9711756c2a85d20794d5c",
      "preview": "UUAAUGCUAAUCGUGAUAGGGGUU"
    },
    {
      "name": "vaultRNA_100",
      "length": 108,
      "sha256": "03106f8c8f0afec7e2c639d61c3809b14541dc6f54d4b4973ee4fa8f1bf90393",
      "preview": "CGGGUCGGAGUUAGCUCAAGCGGUUACCUC"
    }
  ],
  "tokenizer": "RnaTokenizer vocab A0 C1 G2 U3 N4, pad N, replace_T_with_U true",
  "add_special_tokens": false,
  "direction": "5'->3' retained",
  "threshold": 0.335
}

真实推理结果

{
  "output_shape": [
    1,
    74,
    74
  ],
  "dtype": "float32",
  "contact_map_stats": {
    "min": 0.0,
    "max": 0.9991629123687744,
    "mean": 0.0051430147141218185
  },
  "dot_bracket": "((((((((.[[[[.{......)]]]](((((((.....)))))))...}((((((...)..)))))))))))).",
  "dot_bracket_length": 74,
  "num_pairs_predicted": 15,
  "device_proof": "first_param:npu:0, contact_map:npu:0, input:npu:0",
  "compare_sequence": "tRNA-Phe_74",
  "sequence_length": 74
}

CPU-NPU 一致性

{
  "atol": 0.001,
  "rtol": 0.001,
  "max_abs_diff": 6.619095802307129e-05,
  "mean_abs_diff": 1.1856276671551313e-07,
  "passed": true,
  "pearson": 0.9999999997461488,
  "shape": [
    1,
    74,
    74
  ],
  "dot_bracket_match": true
}

性能

{
  "first_run_ms": 8763.328552246094,
  "second_run_ms": 93.53995323181152,
  "avg_ms": 81.98091983795166,
  "min_ms": 80.44075965881348,
  "max_ms": 83.29510688781738,
  "p50_ms": 82.12602138519287,
  "p90_ms": 82.93290138244629,
  "throughput_seq_per_s": 12.197960232413337,
  "throughput_bases_per_s": 902.6490571985869,
  "batch_size": 1,
  "sequence_length": 74,
  "sequence_length_long_test": 108,
  "dtype": "float32"
}

自验证截图

Agent workflow

NPU device call

Model result

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

已知限制

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

标签

#NPU #Ascend #Ascend910