waylong/borzoi-human
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

multimolecule/borzoi-human on Ascend NPU

模型与任务

  • 模型:multimolecule/borzoi-human
  • Revision:6a377a3bf83947284f601ddd57a7ed27b370e4f0
  • 适配路线:long-context-tracks
  • 设备:npu:0

环境依赖

{
  "torch": "2.9.0+cpu",
  "torch_npu": "2.9.0.post1+gitee7ba04",
  "transformers": "4.57.6",
  "tokenizers": "0.22.2",
  "multimolecule": "0.2.1",
  "numpy": "1.26.4",
  "python": "3.11.14",
  "cann": "8.5.1",
  "device_name": "Ascend910_9362",
  "device_count": 2
}

安装:pip install -r requirements.txt

NPU 推理

默认执行:python inference.py

真实输入

{
  "sequence_sha256": "789036f759faf9d3c195e1ad596bedb333fc0a08920363637473b69c4e54aaab",
  "sequence_length": 524288,
  "sequence_preview": "ACTCCCCTGCCCTCAACAAGATGTTTTGCCAACTGGCCAAGACCTGCCCTGTGCAGCTGTGGGTTGATTCCACACCCCCGCCCGGCACCCGCGTCCGCGCCATGGCCATCTACAAGCAGTCACAGCACATGACGGAGGTTGTGAGGCGCTGCCCCCACCATGAGCGCTGCTCAGATAGCGATGG",
  "vocab": "A=0 C=1 G=2 T=3 N=4",
  "species": "human",
  "target_length": 6144,
  "num_tracks": 7611,
  "bin_size": 32,
  "dtype": "int64",
  "batch_size": 1,
  "alphabet": "DNA A/C/G/T/N, replace_U_with_T=true, 5'->3' direction",
  "center_crop": "6144 bins after U-Net upsampling tail"
}

真实推理结果

{
  "logits_shape": [
    1,
    6144,
    7611
  ],
  "coverage_shape": [
    1,
    6144,
    7611
  ],
  "logits_dtype": "float32",
  "coverage_dtype": "float32",
  "logits_device": "npu:0",
  "coverage_device": "npu:0",
  "logits_finite_ratio": 1.0,
  "logits_mean": -1.863837,
  "logits_std": 2.999761,
  "logits_min": -12.81671,
  "logits_max": 55.189049,
  "coverage_mean": 0.651331,
  "coverage_std": 1.033711,
  "coverage_min": 3e-06,
  "coverage_max": 55.189049,
  "output_channels_preview": [
    "human_track_0",
    "human_track_1",
    "human_track_2"
  ],
  "output_channels_total": 7611,
  "sample_bins": {
    "0": {
      "logits_first5": [
        -3.7636,
        -3.9453,
        -5.7691,
        -5.713,
        -5.7502
      ],
      "coverage_first5": [
        0.0229,
        0.0192,
        0.0031,
        0.0033,
        0.0032
      ]
    },
    "3072": {
      "logits_first5": [
        -2.9104,
        -2.3854,
        -4.9816,
        -4.1563,
        -4.9637
      ],
      "coverage_first5": [
        0.053,
        0.0881,
        0.0068,
        0.0155,
        0.007
      ]
    },
    "6143": {
      "logits_first5": [
        -2.9992,
        -3.2565,
        -5.4899,
        -5.4763,
        -5.4459
      ],
      "coverage_first5": [
        0.0486,
        0.0378,
        0.0041,
        0.0042,
        0.0043
      ]
    }
  }
}

CPU-NPU 一致性

{
  "cpu_device": "cpu",
  "npu_device": "npu:0",
  "shape": [
    1,
    6144,
    7611
  ],
  "elements": 46771200,
  "max_abs_diff": 0.017654,
  "mean_abs_diff": 0.000299,
  "atol": 0.02,
  "rtol": 0.001,
  "passed": true,
  "correlation_100k_sample": 1.0,
  "finite_ratio_cpu": 1.0,
  "finite_ratio_npu": 1.0,
  "dtype": "float32",
  "note": "CPU (112.64s) vs NPU (0.70s) on identical 524288bp synthetic sequence; 46.7M elements compared, correlation 1.0, max diff well below output scale (max 55)"
}

性能

{
  "warmup": 3,
  "stable_runs": 10,
  "avg_ms": 242.749,
  "min_ms": 237.907,
  "max_ms": 275.693,
  "windows_per_s": 4.119,
  "bases_per_s": 2159795.9,
  "sequence_length": 524288,
  "target_length": 6144,
  "num_tracks": 7611,
  "dtype": "float32",
  "batch_size": 1,
  "npu_memory_allocated_MB": 1430.1,
  "npu_max_memory_allocated_MB": 4248.1,
  "synchronize": "torch.npu.synchronize() before and after each timed iteration"
}

自验证截图

Agent workflow

NPU device call

Model result

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

已知限制

  • 仅对本次记录的模型 revision、输入契约、dtype 与 Ascend 环境完成验证。
  • 输入为确定性合成序列(嵌入真实 p53/BRCA1 等片段,SHA256 固定),长度 524288bp,覆盖人类 7611 条 RNA-seq/ATAC/ChIP/CAGE 轨道,32bp 分辨率;未使用完整 hg38 参考基因组数据。
  • 单窗口 (batch=1) 验证,非全基因组扫描;多窗口或不同序列需额外验证。
  • FP32 精度;NPU 与 CPU 数值差异 max 0.017 属算子误差,相关性 1.0,符合长上下文多轨模型容差。
  • 显存与耗时基于单卡 Ascend910_9362,batch=1,序列长度 524288 时约 1.4GB 常驻,峰值 4.2GB。

标签

#NPU #Ascend #Ascend910