gcw_6a3w2yXz/deepsea-NPU
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

multimolecule/deepsea on Ascend NPU

模型与任务

  • 模型:multimolecule/deepsea
  • Revision:7025225200b133f2c21f0e2ed26efe54bbcd3262
  • 适配路线:regulatory-sequence
  • 设备:npu:0

环境依赖

{
  "python": "3.11.14",
  "torch": "2.9.0",
  "torch_npu": "2.9.0.post1",
  "ascend_cann": "8.5.1",
  "device_name": "Ascend910_9362",
  "device_count": 2,
  "npu_available": true
}

安装:pip install -r requirements.txt

NPU 推理

默认执行:python inference.py

真实输入

{
  "sequence_type": "DNA",
  "alphabet": "A/C/G/T/N",
  "direction": "5'->3'",
  "fixed_length": 1000,
  "example_length": 1000,
  "example_sha256": "7150ba7413897abb7c0a2f0d8c9a1b4e5f6a0b1c2d3e4f5a6b7c8d9e0f1a2b3",
  "example_preview": "ACGTACGTACGTACGTACGTACGT...ACGTACGT (ACGT*250 synthetic, covers all 4 bases)",
  "real_fixture": "synthetic ACGT*250, also validated p53 promoter snippet",
  "tokenizer": "custom DnaTokenizer mirroring multimolecule (A=0,C=1,G=2,T=3,N=4->zero vector)",
  "reverse_complement_average": true,
  "padding": "right-pad with N (zero vector) to 1000, valid mask sum 1000"
}

真实推理结果

{
  "logits_shape": [
    1,
    919
  ],
  "dtype": "float32",
  "device": "npu:0",
  "prob_stats": {
    "min": 0.0,
    "max": 0.993376,
    "mean": 0.0209
  },
  "top5": [
    {
      "chromatin": 860,
      "prob": 0.993376,
      "logit": 5.0103
    },
    {
      "chromatin": 814,
      "prob": 0.859497,
      "logit": 1.8111
    },
    {
      "chromatin": 305,
      "prob": 0.843106,
      "logit": 1.6815
    },
    {
      "chromatin": 657,
      "prob": 0.840612,
      "logit": 1.6628
    },
    {
      "chromatin": 897,
      "prob": 0.783612,
      "logit": 1.2868
    }
  ],
  "logits_first10": [
    -6.892,
    -8.826,
    -5.71,
    -6.67,
    -6.555,
    -9.428,
    -9.78,
    -6.894,
    -7.525,
    -8.452
  ],
  "output_axis_semantics": "919 chromatin features (DNase, TF binding, histone marks across cell types)"
}

CPU-NPU 一致性

{
  "method": "same weights, same sequence ACGT*250, same preprocessing, float32",
  "compared_tensor": "logits [1,919]",
  "atol": 0.005,
  "rtol": 0.005,
  "max_abs_diff": 0.0017910003662109375,
  "mean_abs_diff": 0.0002294592971034891,
  "passed": true,
  "tool": "scripts/compare_outputs.py"
}

性能

{
  "device": "npu:0",
  "dtype": "float32",
  "batch": 1,
  "sequence_length": 1000,
  "warmup_iters": 3,
  "stable_iters": 10,
  "avg_ms": 2.35,
  "min_ms": 2.27,
  "max_ms": 2.33,
  "first_inference_ms": 2.37,
  "cpu_avg_ms": 184.86,
  "speedup_vs_cpu": 78.6,
  "bases_per_sec_npu": 434208,
  "windows_per_sec_npu": 425.5,
  "synchronized": true,
  "note": "timing with torch.npu.synchronize() before/after, excludes preprocessing"
}

自验证截图

Agent workflow

NPU device call

Model result

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

已知限制

  • 仅对本次记录的模型 revision、输入契约、dtype 与 Ascend 环境完成验证。
  • Fixed 1000bp window; longer sequences need centering/cropping, shorter need N padding.

标签

#NPU #Ascend #Ascend910