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

multimolecule/optmrl on Ascend NPU

模型与任务

  • 模型:multimolecule/optmrl
  • Revision:e003fc2feced71d6cf11e7336164985e331817e7
  • 适配路线:utr-translation
  • 设备:npu:0

环境依赖

{
  "torch": "2.9.0+cpu",
  "torch_npu": "2.9.0.post1+gitee7ba04",
  "npu_available": true,
  "device_count": 2,
  "device_name": "Ascend910_9362",
  "cann": "8.5.1",
  "python": "3.11.14",
  "transformers": "4.56.2",
  "safetensors": "0.4.3",
  "multimolecule": "0.2.1"
}

安装:pip install -r requirements.txt

NPU 推理

默认执行:python inference.py

真实输入

{
  "alphabet": "A/C/G/U/N",
  "replace_T_with_U": true,
  "sequence_length": 50,
  "sequences": {
    "NRAS_proto_oncogene_5UTR_50": {
      "seq": "GGGGCCGGAAGUGCCGCUCCUUGGUGGGGGCUGUUCAUGGCGGUUCCGGG",
      "len": 50,
      "sha256": "992eeba3372e7a30"
    },
    "MYC_proto_oncogene_5UTR_50": {
      "seq": "AACUCGCUGUAGUAAUUCCAGCGAGAGGCAGAGGGAGCGAGCGGGCGGCC",
      "len": 50,
      "sha256": "1a9487628879a90d"
    },
    "ACGU_repeat_50": {
      "seq": "ACGUACGUACGUACGUACGUACGUACGUACGUACGUACGUACGUACGUAC",
      "len": 50,
      "sha256": "b3144536aa1ddf56"
    },
    "ATF4_5UTR_50": {
      "seq": "CAUUUCUACUUUGCCCGCCCACAGAUGUAGUUUUCUCUGCGCGUGUGCGU",
      "len": 50,
      "sha256": "a710a1a0d58e6310"
    },
    "Random_high_GC_50": {
      "seq": "GCGCGCGCGCGCAUAUAUAUAGCGCGCGCGCGCAUAUAUAUAGCGCGCGC",
      "len": 50,
      "sha256": "4877d829f387cf7e"
    }
  },
  "batch": 5,
  "padding": "right_pad_with_mask",
  "vocab_mapping": "A=0 C=1 G=2 U=3 N=4",
  "attention_mask": true
}

真实推理结果

{
  "shape": [
    5,
    1
  ],
  "dtype": "float32",
  "logits": {
    "NRAS_proto_oncogene_5UTR_50": -1.9786300659179688,
    "MYC_proto_oncogene_5UTR_50": 0.9555763006210327,
    "ACGU_repeat_50": 0.854703426361084,
    "ATF4_5UTR_50": -0.9324413537979126,
    "Random_high_GC_50": 0.7281733751296997
  },
  "npu_logits": {
    "NRAS_proto_oncogene_5UTR_50": -1.9787813425064087,
    "MYC_proto_oncogene_5UTR_50": 0.9556233882904053,
    "ACGU_repeat_50": 0.8547353744506836,
    "ATF4_5UTR_50": -0.9324248433113098,
    "Random_high_GC_50": 0.7281280755996704
  },
  "output_name": "mean_ribosome_load",
  "task": "5'UTR MRL regression"
}

CPU-NPU 一致性

{
  "max_abs_diff": 0.0001512765884399414,
  "mean_abs_diff": 5.842447280883789e-05,
  "atol": 0.0001,
  "rtol": 0.0001,
  "passed": true,
  "shape": [
    5,
    1
  ],
  "dtype": "float32"
}

性能

{
  "first_compile_ms": 95.79,
  "warmup": 3,
  "stable_runs": 10,
  "avg_ms": 1.11,
  "min_ms": 1.09,
  "max_ms": 1.13,
  "batch": 5,
  "sequence_length": 50,
  "seq_per_sec": 4512.7,
  "bases_per_sec": 225636.1,
  "dtype": "float32",
  "device": "npu:0",
  "peak_memory_MB": 1.8,
  "synchronize": true
}

自验证截图

Agent workflow

NPU device call

Model result

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

已知限制

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

标签

#NPU #Ascend #Ascend910