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

multimolecule/bpfold on Ascend NPU

模型与任务

  • 模型:multimolecule/bpfold
  • Revision:b78209659805196964fc82a201e4d01a7d15e503
  • 适配路线:rna-secondary-structure
  • 设备:npu:0

环境依赖

{
  "torch": "2.9.0+cpu",
  "torch_npu": "2.9.0.post1+gitee7ba04",
  "python": "3.11.14",
  "device_name": "Ascend910_9362",
  "device_count": 2,
  "cann": "8.5.1",
  "multimolecule": "0.2.1",
  "transformers": "4.57.6",
  "platform": "Linux-5.10.0-182.0.0.95.r2220_156.hce2.aarch64-aarch64-with-glibc2.35",
  "huggingface_hub": "0.36.2"
}

安装:pip install -r requirements.txt

NPU 推理

默认执行:python inference.py

真实输入

{
  "sequences": {
    "microRNA_21": {
      "length": 22,
      "sha256": "9c1b1cd23c45d39d",
      "preview": "UAGCUUAUCAGACUGAUGUUGA"
    },
    "short_test": {
      "length": 15,
      "sha256": "14c406513509d410",
      "preview": "GGUAAAACAGCCUGU"
    },
    "mRNA_prion": {
      "length": 66,
      "sha256": "b13eab6f030bf488",
      "preview": "AUGGCGAACCUUGGCUGCUGGAUGCUGGUUCUCUUUGUGG"
    }
  },
  "primary": "short_test",
  "primary_length": 15,
  "tokenizer": "RnaTokenizer",
  "max_length": 600,
  "alphabet": "A/C/G/U/N"
}

真实推理结果

{
  "contact_map_shape": [
    1,
    15,
    15
  ],
  "contact_map_dtype": "torch.float32",
  "contact_map_device": "npu:0",
  "mean": 0.5241,
  "max": 0.9645,
  "example_slice": [
    [
      0.9645,
      0.5456,
      0.4479
    ],
    [
      0.5456,
      0.8857,
      0.4622
    ],
    [
      0.4479,
      0.4622,
      0.8351
    ]
  ],
  "longer_L66_shape": [
    1,
    66,
    66
  ],
  "longer_mean": 0.4911
}

CPU-NPU 一致性

{
  "cpu_npu_max_abs_error": 0.001475,
  "cpu_npu_mean_abs_error": 0.00018,
  "threshold_max": 0.005,
  "threshold_mean": 0.001,
  "passed": true,
  "dtype": "float32",
  "comparison": "contact_map LxL after removing BOS/EOS"
}

性能

{
  "device": "npu:0",
  "dtype": "float32",
  "batch_size": 1,
  "warmup": 3,
  "iters": 10,
  "sequence_length": 66,
  "avg_ms": 104.06,
  "min_ms": 103.64,
  "max_ms": 105.14,
  "p50_ms": 103.94,
  "p90_ms": 104.67,
  "p95_ms": 104.67,
  "seq_per_s": 9.61,
  "bases_per_s": 634.24,
  "peak_memory_MiB": 186.4,
  "first_inference_ms": 398.25,
  "note": "first inference includes compilation, stable avg after warmup"
}

自验证截图

Agent workflow

NPU device call

Model result

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

已知限制

  • 仅对本次记录的模型 revision、输入契约、dtype 与 Ascend 环境完成验证。
  • 最大长度 600 nt, 本次验证最长 66 nt。

标签

#NPU #Ascend #Ascend910