gcw_6a3w2yXz/multimolecule-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_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": "GGGGCCGGAAGUGCCGCUCCUUGGUGGGGGCUGUUCAUGGCGGUUCCGGGGUCUCCAACAUUUUUCCCGGCUGUGGUCCUAAAUCUGUCCAAAGCAGAGGCAGUGGAGCUUGAGGUUCUUGCUGGUGUGAA",
  "sequence_sha256": "085ce6d59b446cef3eca50f927aa7e992a2c8cbf7b5b9b0818eaa1fa00021fd9",
  "length": 131,
  "alphabet": "ACGU",
  "tokenizer": "RnaTokenizer",
  "vocab_size": 5,
  "source": "NRAS 5'UTR from SPOT-RNA model card (real mRNA UTR)",
  "attention_mask": "all ones, shape [1,131]"
}

真实推理结果

{
  "logits_shape": [
    1,
    131,
    131
  ],
  "contact_map_shape": [
    1,
    131,
    131
  ],
  "output_type": "LxL contact probability + logit, upper triangular with -inf lower, threshold 0.335",
  "contact_mean_cpu": 0.0014167673652991652,
  "contact_max_cpu": 0.9020805358886719,
  "contact_mean_npu": 0.0014168012421578169,
  "contact_max_npu": 0.9020759463310242,
  "predicted_pairs_cpu": 15,
  "predicted_pairs_npu": 15,
  "dtype": "float32"
}

CPU-NPU 一致性

{
  "logits_finite_max_abs_diff": 0.0050830841064453125,
  "logits_finite_mean_abs_diff": 0.0007763952016830444,
  "contact_max_abs_diff": 0.0003203153610229492,
  "contact_mean_abs_diff": 3.312213436856837e-07,
  "atol": 0.001,
  "rtol": 0.001,
  "passed": true,
  "note": "BiLSTM member 3 executed via explicit CPU fallback due to missing TBE on NPU; all other 4 members on NPU; final output device npu:0 with torch.npu.synchronize"
}

性能

{
  "sequence_length": 131,
  "output_LxL": 17161,
  "first_latency_s": 0.8473,
  "stable_avg_latency_s": 0.5631,
  "sequence_per_s": 1.78,
  "bases_per_s": 232.66,
  "warmup_iters": 3,
  "stable_iters": 10,
  "dtype": "float32",
  "device": "npu:0"
}

自验证截图

Agent workflow

NPU device call

Model result

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

已知限制

  • BiLSTM member (index 3) fallback to CPU due to Ascend TBE missing; 4/5 members fully on NPU, final tensors on npu:0. Pure NPU LSTM requires CANN TBE support.

标签

#NPU #Ascend #Ascend910