liucu/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": "2.9.0.post1+gitee7ba04",
  "device_name": "Ascend910_9362",
  "device_count": 2,
  "python": "3.11.14",
  "cann": "8.5.1",
  "model_dir": "/opt/atomgit/adapt-npu-agent/working/ufold_weights",
  "dtype": "float32"
}

安装:pip install -r requirements.txt

NPU 推理

默认执行:python inference.py

真实输入

{
  "route": "rna-secondary-structure",
  "alphabet": "RNA A/C/G/U/N (vocab 5, replace_T_with_U true)",
  "strand": "5'->3'",
  "sequence_length": 74,
  "batch": 1,
  "primary_sequence": "GGGCUAUUAGCUCAGUUGGUUAGAGCGCACCCCUGAUAAGGGUGAGGUCGCUGAUUCGAAUUCAGCAUAGCUCA",
  "primary_sha256": "f5014cfb7b1ff718df070139c8fe937414f7a8de7396b7e2a0faed0f405b3d6f",
  "secondary_sequence": "UAGCUUAUCAGACUGAUGUUGA",
  "secondary_sha256": "9c1b1cd23c45d39dd0b1fb28d72c49c0edcc57a16cb61c96119f84676c4b5b1c",
  "secondary_len": 22,
  "valid_tokens_mask": "all bases valid; N padding not used for primary",
  "threshold": 0.5,
  "species": "synthetic tRNA-Phe 74 nt + microRNA-21 widget example",
  "tokenizer": "RnaTokenizer 1-mer, pad=N id0, replace_T_with_U true",
  "dtype": "float32",
  "source": "model card widget tRNA-Phe 74 nt (GGGCUAUUAGCUCAGUUGGUUAGAGCGCACCCCUGAUAAGGGUGAGGUCGCUGAUUCGAAUUCAGCAUAGCUCA)"
}

真实推理结果

{
  "contact_map_shape": [
    1,
    74,
    74
  ],
  "contact_map_dtype": "float32",
  "contact_map_device": "npu:0",
  "contact_map_stats": {
    "min": 0.0,
    "max": 1.0,
    "mean": 0.014434957,
    "std": 0.1041269
  },
  "logits_shape": [
    1,
    74,
    74
  ],
  "candidates_above_threshold": 21,
  "total_pairs": 2701,
  "top_pairs": [
    {
      "pair": [
        10,
        24
      ],
      "score": 1.0
    },
    {
      "pair": [
        12,
        22
      ],
      "score": 1.0
    },
    {
      "pair": [
        11,
        23
      ],
      "score": 1.0
    },
    {
      "pair": [
        50,
        64
      ],
      "score": 1.0
    },
    {
      "pair": [
        9,
        25
      ],
      "score": 1.0
    }
  ],
  "postprocess": "sigmoid contact_map; threshold 0.5 (use_postprocessing false)",
  "num_labels": 1,
  "threshold": 0.5,
  "symmetry_max_diff": 0.0,
  "diagonal_mean": 0.5001
}

CPU-NPU 一致性

{
  "passed": true,
  "shape": [
    1,
    74,
    74
  ],
  "elements": 5476,
  "max_abs_diff": 1.7732148990035057e-05,
  "mean_abs_diff": 4.927514527714136e-08,
  "atol": 0.0001,
  "rtol": 0.0001
}

性能

{
  "avg_ms": 10.6,
  "p50_ms": 10.6,
  "min_ms": 10.2,
  "max_ms": 11.1,
  "seq_per_s": 94.49,
  "bases_per_s": 6992.48,
  "input_length": 74,
  "batch_size": 1,
  "dtype": "float32",
  "device": "npu:0",
  "warmup": 3,
  "stable_runs": 10,
  "peak_memory_mb": 70,
  "first_compile_ms": 11.1,
  "hbm_usage_mb": 3105
}

自验证截图

Agent workflow

NPU device call

Model result

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

已知限制

  • 仅对本次记录的模型 revision、输入契约、dtype 与 Ascend 环境完成验证。
  • 单序列 74 nt smoke consistency;完整精度评测需 ArchiveII/TS0/bpRNA 数据集。
  • LxL 二维输出已验证对称性与对角线约束;伪结与最小 loop 由模型阈值决定。

标签

#NPU #Ascend #Ascend910