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

multimolecule/optmrl on Ascend NPU

模型与任务

  • 模型:multimolecule/optmrl
  • Revision:e003fc2feced71d6cf11e7336164985e331817e7
  • 适配路线:utr-translation
  • 设备: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",
  "cann_version": "8.5.1",
  "dtype": "float32",
  "model_dir": "/opt/atomgit/.cache/huggingface/hub/models--multimolecule--optmrl/snapshots/e003fc2feced71d6cf11e7336164985e331817e7"
}

安装:pip install -r requirements.txt

NPU 推理

默认执行:python inference.py

真实输入

{
  "num_sequences": 5,
  "sequence_length": 50,
  "alphabet": "A/C/G/U/N",
  "strand": "5'->3'",
  "sequences_sha256": [
    "992eeba3372e7a30288e2a4be013eb8fd1968c204cdcf9ea780281c63573b0d5",
    "e97f33059e432f154c59b027b874642339afdb18b369a8ca645fa1d12f0905dc",
    "57652af7a86087837e4bdcf36cf7dcf8d6103588a70db7fc9c4d4ea6817e81ac",
    "e83a236520b1dc04450f487fc5aff2b69008a25a4137cb75b7b70377c4b62f8a",
    "b3144536aa1ddf56513569861d33beaf68590bf7d0162cd449513283f99e3d22"
  ],
  "example_sequence": "GGGGCCGGAAGUGCCGCUCCUUGGUGGGGGCUGUUCAUGGCGGUUCCGGG",
  "example_source": "NRAS proto-oncogene 5' UTR truncated to 50 nt (real human 5'UTR from model card)",
  "all_sources": [
    "NRAS proto-oncogene 5' UTR truncated to 50 nt (real human 5'UTR from model card)",
    "amyloid beta precursor protein 5' UTR truncated to 50 nt (real human 5'UTR)",
    "RUNX1 5' UTR truncated to 50 nt (real human 5'UTR)",
    "microRNA 21 (22 nt) + A-pad to 50 nt (real ncRNA from model card, padded with A's to fixed window)",
    "synthetic ACGU repeat 50 nt (balanced alphabet smoke)"
  ],
  "input_ids_shape": [
    5,
    50
  ],
  "attention_mask_shape": [
    5,
    50
  ],
  "tokenizer": "RnaTokenizer",
  "vocab_size": 5,
  "replace_T_with_U": true,
  "padding": "max_length 50, truncation True, A-pad for short sequences"
}

真实推理结果

{
  "logits_shape": [
    5,
    1
  ],
  "logits_dtype": "float32",
  "output_type": "scalar mean-ribosome-load (MRL) per 50 nt 5'UTR window (regression)",
  "cpu_logits": [
    -1.9786300659179688,
    0.4048468768596649,
    0.831030011177063,
    -0.5907962322235107,
    0.854703426361084
  ],
  "npu_logits": [
    -1.9787813425064087,
    0.404829204082489,
    0.8310579061508179,
    -0.5907660126686096,
    0.8547353744506836
  ],
  "example_mrl_cpu": -1.9786300659179688,
  "example_mrl_npu": -1.9787813425064087,
  "logits_device": "npu:0",
  "num_labels": 1,
  "problem_type": "regression"
}

CPU-NPU 一致性

{
  "passed": true,
  "shape": [
    5,
    1
  ],
  "elements": 5,
  "max_abs_diff": 0.0001512765884399414,
  "mean_abs_diff": 5.180239999999999e-05,
  "atol": 0.001,
  "rtol": 0.001,
  "per_sequence_diff": [
    0.0001512765884399414,
    1.767278e-05,
    2.789497e-05,
    3.021955e-05,
    3.194809e-05
  ],
  "note": "CPU vs NPU same weights, same RnaTokenizer batch, same padding, float32. Max diff 1.5e-4 well below 1e-3 threshold."
}

性能

{
  "device": "npu:0",
  "dtype": "float32",
  "batch": 5,
  "sequence_length": 50,
  "warmup_iterations": 3,
  "stable_iterations": 10,
  "first_latency_ms": 193.04,
  "avg_latency_ms": 0.83,
  "min_latency_ms": 0.81,
  "max_latency_ms": 0.86,
  "sequences_per_second": 6021.16,
  "bases_per_second": 301057.76,
  "model_params_M": 0.476,
  "flops_M": 24.04
}

自验证截图

Agent workflow

NPU device call

Model result

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

已知限制

  • 仅对本次记录的模型 revision、输入契约、dtype 与 Ascend 环境完成验证。
  • OptMRL 固定输入 50nt 5'UTR 窗口;短于 50 的序列经 A-padding,长于 50 的截断至前 50 nt。

标签

#NPU #Ascend #Ascend910