jsjs1258/malinois-npu
模型介绍
文件和版本
Pull Requests
讨论
分析

multimolecule/malinois 在昇腾 NPU 上

模型与任务

  • 模型:multimolecule/malinois
  • Revision:0c670497e829ec4db586900ff35e89cf3666aa3e
  • 适配路线:regulatory-sequence
  • 设备:npu:0

环境依赖

{
  "torch": "2.9.0+cpu",
  "torch_npu": "2.9.0.post1+gitee7ba04",
  "multimolecule": "0.2.1",
  "npu_name": "Ascend910_9362",
  "npu_available": true,
  "device_count": 2
}

安装:pip install -r requirements.txt

NPU 推理

默认执行:python inference.py

真实输入

{
  "sequence_type": "DNA",
  "alphabet": "A/C/G/T/N",
  "input_length": 600,
  "primary_sequence": "ACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGT...(600)",
  "primary_sha256": "e4a387752a4865282071c8f2f26b4d990db42b00a357a5080766f61ba6f02dbd",
  "batch_sequences": 4,
  "tokenizer": "DnaTokenizer",
  "vocab_size": 5,
  "outputs": "3 CRE activities (K562, HepG2, SK-N-SH)"
}

实际推理结果

{
  "shape": [
    1,
    3
  ],
  "dtype": "float32",
  "cpu_logits": [
    [
      8.419232368469238,
      7.512470722198486,
      15.247061729431152
    ]
  ],
  "npu_logits": [
    [
      8.421932220458984,
      7.5143890380859375,
      15.25162124633789
    ]
  ],
  "batch_shape": [
    4,
    3
  ],
  "track_labels": [
    "K562",
    "HepG2",
    "SK-N-SH"
  ]
}

CPU-NPU 一致性

{
  "max_abs_diff": 0.004559516906738281,
  "mean_abs_diff": 0.003059228261311849,
  "batch_max_abs_diff": 0.004555702209472656,
  "batch_mean_abs_diff": 0.0008153617382049561,
  "atol": 0.01,
  "rtol": 0.01,
  "passed": true
}

性能

{
  "warmup_iters": 3,
  "stable_iters": 10,
  "times_ms": [
    3.0604549683630466,
    2.9454012401401997,
    3.0649849213659763,
    3.0754851177334785,
    3.051323816180229,
    3.057285211980343,
    3.0613839626312256,
    3.0574151314795017,
    3.0594849959015846,
    3.0618938617408276
  ],
  "avg_ms": 3.0495113227516413,
  "p50_ms": 3.0599699821323156,
  "min_ms": 2.9454012401401997,
  "max_ms": 3.0754851177334785,
  "throughput_seq_per_s": 327.9213926963478,
  "throughput_bases_per_s": 196752.83561780868,
  "input_length": 600,
  "batch_size": 1,
  "dtype": "float32",
  "device": "npu:0"
}

自验证截图

智能体工作流

NPU 设备调用

模型结果

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

已知限制

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

标签

#NPU #Ascend #Ascend910