waylong/optimus5prime
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

multimolecule/optimus5prime on Ascend NPU

模型与任务

  • 模型:multimolecule/optimus5prime
  • Revision:main
  • 适配路线:utr-translation
  • 设备: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.2",
  "multimolecule": "0.2.1",
  "python": "3.11.14",
  "cann": "8.5.1",
  "device_name": "Ascend910_9362",
  "device_count": 2,
  "npu_smi": "Ascend910"
}

安装:pip install -r requirements.txt

NPU 推理

默认执行:python inference.py

真实输入

{
  "primary_sequence": "GGGGCCGGAAGUGCCGCUCCUUGGUGGGGGCUGUUCAUGGCGGUUCCGGG",
  "sha256": "992eeba3372e7a30288e2a4be013eb8fd1968c204cdcf9ea780281c63573b0d5",
  "length": 50,
  "alphabet": "RNA ACGU/N, T->U, vocab 5",
  "window": "fixed 50nt, padding zeros, 5'->3'",
  "batch_sequences": 4,
  "batch_desc": "3x50nt (NRAS, MYC, synthetic) + 1x22nt microRNA-21 padded to 50",
  "attention_mask": "1 for real bases, 0 for pad (padded 22nt)",
  "dtype": "int64 ids + int64 mask"
}

真实推理结果

{
  "task": "Mean Ribosome Load (MRL) regression scalar per 5'UTR",
  "output_name": "mean_ribosome_load",
  "shape": [
    1,
    1
  ],
  "dtype": "float32",
  "device": "npu:0",
  "mrl_cpu": -1.3085063695907593,
  "mrl_npu": -1.3085277080535889,
  "batch_mrl_cpu": [
    -1.3085063695907593,
    0.5420016050338745,
    -0.11205363273620605,
    -0.10916679352521896
  ],
  "example_finite": true
}

CPU-NPU 一致性

{
  "passed": true,
  "max_abs_diff": 2.1338462829589844e-05,
  "mean_abs_diff": 2.1338462829589844e-05,
  "atol": 0.0001,
  "rtol": 0.001,
  "batch_max_abs": 4.62532e-05,
  "batch_mean_abs": 2.769567e-05,
  "dtype": "float32",
  "threshold_basis": "FP32 NPU operator tolerance, 1e-4 atol"
}

性能

{
  "first_latency_ms": 111.48,
  "stable_avg_ms": 2.03,
  "min_ms": 2.01,
  "max_ms": 2.05,
  "p50_ms": 2.03,
  "warmup": 3,
  "stable_runs": 10,
  "throughput_sequences_per_sec": 493.0,
  "throughput_bases_per_sec": 24651,
  "dtype": "float32",
  "sequence_length": 50,
  "batch": 1,
  "synchronized": true,
  "peak_hbm_mb": 3219
}

自验证截图

Agent workflow

NPU device call

Model result

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

已知限制

  • 仅对本次记录的模型 revision、输入契约、dtype 与 Ascend 环境完成验证。
  • 固定 50nt 窗口,短序列经零填充;长序列截断至 50。

标签

#NPU #Ascend #Ascend910