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

multimolecule/ufold on Ascend NPU

模型与任务

  • 模型:multimolecule/ufold
  • Revision:538de5c2f48e56731c092e40d54c641ff84a2154
  • 适配路线:rna-secondary-structure
  • 设备:npu:0

环境依赖

{
  "torch": "2.9.0+cpu",
  "torch_npu_available": true,
  "npu_device_count": 2,
  "npu_device_name": "Ascend910_9362",
  "transformers": "5.9.0",
  "multimolecule": "0.2.1",
  "input_length": 71,
  "dtype": "float32"
}

安装:pip install -r requirements.txt

NPU 推理

默认执行:python inference.py

真实输入

{
  "sequence": "GGGCUAUAGCUCAGUUGGUUAGAGCGCACCCCUGAUAAGGGUGAGGUCGCUGAUUCGAAUCAGCACCCCCC",
  "length": 71,
  "sha256": "c546ed223325fdd9fdee27aa2fd29e72517243d47861fc71920fc6b4b9358b8a",
  "alphabet": "A/C/G/U/N",
  "replace_T_with_U": true,
  "direction": "5'->3'",
  "padding_token": "N",
  "tokenizer": "RnaTokenizer",
  "vocab": "A,C,G,U,N",
  "L": 71
}

真实推理结果

{
  "logits_shape": [
    1,
    71,
    71
  ],
  "contact_map_shape": [
    1,
    71,
    71
  ],
  "logits_dtype": "float32",
  "contact_dtype": "float32",
  "output_device": "npu:0",
  "dot_bracket_npu": "(((...(.((((.........)))).(((((.......))))).....((((((....)))))))...)))",
  "dot_bracket_cpu": "(((...(.((((.........)))).(((((.......))))).....((((((....)))))))...)))",
  "pairs_count_npu": 19,
  "pairs_count_cpu": 19,
  "contact_mean_npu": 0.017810717225074768,
  "contact_mean_cpu": 0.01780277118086815,
  "model": "multimolecule/ufold",
  "revision": "538de5c2f48e56731c092e40d54c641ff84a2154",
  "route": "rna-secondary-structure"
}

CPU-NPU 一致性

{
  "output": "contact_map (LxL probability)",
  "shape": [
    1,
    71,
    71
  ],
  "dtype": "float32",
  "max_abs_diff": 0.0028688907623291016,
  "mean_abs_diff": 8.055113298066934e-06,
  "atol": 0.01,
  "rtol": 0.001,
  "passed": true,
  "pearson_corr": 0.9999995338266006,
  "binary_diff_count_threshold_0.5": 0,
  "binary_total": 5041,
  "finite_ratio_cpu": 1.0,
  "finite_ratio_npu": 1.0,
  "logits_max_diff": 0.052310943603515625,
  "logits_mean_diff": 0.0057905325666069984
}

性能

{
  "L": 71,
  "batch": 1,
  "dtype": "float32",
  "device": "npu:0",
  "warmup": 3,
  "stable_runs": 10,
  "avg_latency_ms": 10.688638687133789,
  "seq_per_s": 93.55728351111051,
  "bases_per_s": 6642.567129288846,
  "peak_memory_bytes": 108832768,
  "first_inference_ms": 11.997222900390625,
  "cpu_baseline_ms": 89.96891975402832
}

自验证截图

Agent workflow

NPU device call

Model result

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

已知限制

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

标签

#NPU #Ascend #Ascend910