m
mengsihan/optmrl
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

multimolecule/optmrl on Ascend NPU

模型与任务

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

环境依赖

{
  "python": "3.11.14",
  "torch": "2.9.0+cpu",
  "torch_npu": "2.9.0.post1+gitee7ba04",
  "transformers": "5.9.0",
  "npu_device": "Ascend910_9362",
  "npu_count": 2,
  "dtype": "float32"
}

安装:pip install -r requirements.txt

NPU 推理

默认执行:python inference.py

真实输入

{
  "task": "mean-ribosome-load prediction from 5'UTR window",
  "alphabet": "ACGU",
  "fixed_window": 50,
  "batch_size": 5,
  "sequences": [
    {
      "name": "NRAS",
      "length": 131,
      "sha256": "085ce6d59b446cef3eca50f927aa7e992a2c8cbf7b5b9b0818eaa1fa00021fd9"
    },
    {
      "name": "RUNX1",
      "length": 194,
      "sha256": "8261953ea54caf07315d8ecfb84675fac471021133d950b6c863d8f38ed9b24a"
    },
    {
      "name": "FMR1",
      "length": 261,
      "sha256": "837e02bbff8334cdb5c17da16d6033a1199a69bc2fcee478349e6b3d325c1310"
    },
    {
      "name": "MYC",
      "length": 363,
      "sha256": "94627a13baef9ae201b956d3c9692e0511fafdf1b6143d4d552de2a7ee9c8756"
    },
    {
      "name": "ATF4",
      "length": 282,
      "sha256": "e0c591f82985544eb8f89a70572cd27d8c9d308bac6a2bfd6588cbfd93fa42ff"
    }
  ],
  "tokenizer_padding": "model pads/truncates to 50 nt internally",
  "variant": {
    "gene": "NRAS",
    "position": 10,
    "ref": "G",
    "alt": "C",
    "ref_sha256": "085ce6d59b446cef",
    "alt_sha256": "f78c82e92e7d058f"
  }
}

真实推理结果

{
  "logits_shape": [
    5,
    1
  ],
  "dtype": "torch.float32",
  "mean_ribosome_load": {
    "NRAS": -1.978781,
    "RUNX1": 0.831058,
    "FMR1": 0.277508,
    "MYC": 0.955623,
    "ATF4": -0.932425
  },
  "variant_effect_alt_ref": {
    "cpu": -0.021223783493041992,
    "npu": -0.021184921264648438
  }
}

CPU-NPU 一致性

{
  "method": "CPU baseline vs real npu:0 with identical weights/inputs/seed",
  "max_abs_diff": 0.0001512765884399414,
  "mean_abs_diff": 5.564093589782715e-05,
  "pearson": 1.0,
  "spearman": 0.9999999999999999,
  "atol": 0.001,
  "rtol": 0.01,
  "passed": true,
  "variant_direction_match": true
}

性能

{
  "device": "npu:0",
  "warmup_iters": 3,
  "stable_iters": 10,
  "mean_ms_per_iter": 0.9248420596122742,
  "sequences_per_s": 5406.328516348157,
  "bases_per_s": 270316.42581740784,
  "input_length": 50,
  "batch_size": 5,
  "dtype": "float32",
  "peak_memory_mib": 2.79150390625,
  "cpu_baseline_ms": 11.256461963057518
}

自验证截图

Agent workflow

NPU device call

Model result

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

已知限制

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

标签

#NPU #Ascend #Ascend910