jsjs1258/gtca-alphagenome_pytorch-NPU
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

gtca/alphagenome_pytorch on Ascend NPU

模型与任务

  • 模型:gtca/alphagenome_pytorch
  • Revision:b01c0ffa73e07c053491f3b5ea8bcf67d93b9920
  • 适配路线:long-context-tracks
  • 设备:npu:0

环境依赖

{
  "python": "3.11.14",
  "torch": "2.9.0+cpu",
  "torch_npu": "2.9.0.post1+gitee7ba04",
  "numpy": "2.4.6",
  "ascend_cann": "cann-8.5.1",
  "npu": "Ascend910",
  "npu_device_count": 2,
  "dtype": "float32",
  "weights": "model_all_folds.safetensors (920635044 bytes)"
}

安装:pip install -r requirements.txt

NPU 推理

默认执行:python inference.py

真实输入

{
  "sequence_source": "UCSC REST API hg38 chr7:5,522,409-5,538,793 (ACTB promoter)",
  "length_bp": 16384,
  "sequence_sha256": "ad1e262d96cd23f4284e56597e32f471ba21b4d1ecff6218d69f6b8eb31da9bf",
  "organism": "human",
  "alphabet": "ACGTN",
  "onehot_shape": [
    1,
    16384,
    4
  ],
  "stream": "5'->3' forward strand"
}

真实推理结果

{
  "atac": {
    "shape": [
      128,
      256
    ],
    "mean": 28.391647,
    "std": 68.972885,
    "min": 0.0,
    "max": 1429.331543
  },
  "dnase": {
    "shape": [
      128,
      384
    ],
    "mean": 38.19421,
    "std": 99.092133,
    "min": 0.0,
    "max": 2306.802246
  },
  "procap": {
    "shape": [
      128,
      128
    ],
    "mean": 7.189313,
    "std": 191.878555,
    "min": 0.0,
    "max": 12757.426758
  },
  "cage": {
    "shape": [
      128,
      640
    ],
    "mean": 192.406082,
    "std": 2407.557129,
    "min": 0.0,
    "max": 87438.039062
  },
  "rna_seq": {
    "shape": [
      128,
      768
    ],
    "mean": 739.84906,
    "std": 3466.878662,
    "min": 0.0,
    "max": 89997.8125
  },
  "chip_tf": {
    "shape": [
      128,
      1664
    ],
    "mean": 240.338409,
    "std": 633.579834,
    "min": 0.0,
    "max": 40542.933594
  },
  "chip_histone": {
    "shape": [
      128,
      1152
    ],
    "mean": 489.510895,
    "std": 1215.550293,
    "min": 0.0,
    "max": 28637.753906
  }
}

CPU-NPU 一致性

{
  "comparison": "CPU baseline vs npu:0, same weights/revision/sequence/preprocessing",
  "thresholds": {
    "corr_min": 0.999,
    "max_norm": 0.02,
    "mean_norm": 0.001
  },
  "heads": {
    "atac": {
      "pass": true,
      "shape": [
        128,
        256
      ],
      "mean_abs_diff": 0.001562,
      "max_abs_diff": 0.230469,
      "max_norm": 0.0033413,
      "mean_norm": 2.265e-05,
      "correlation": 1.0,
      "finite_frac": 1.0
    },
    "dnase": {
      "pass": true,
      "shape": [
        128,
        384
      ],
      "mean_abs_diff": 0.002027,
      "max_abs_diff": 0.12915,
      "max_norm": 0.0013033,
      "mean_norm": 2.046e-05,
      "correlation": 1.0,
      "finite_frac": 1.0
    },
    "procap": {
      "pass": true,
      "shape": [
        128,
        128
      ],
      "mean_abs_diff": 0.000944,
      "max_abs_diff": 1.079102,
      "max_norm": 0.0056243,
      "mean_norm": 4.919e-06,
      "correlation": 1.0,
      "finite_frac": 1.0
    },
    "cage": {
      "pass": true,
      "shape": [
        128,
        640
      ],
      "mean_abs_diff": 0.012962,
      "max_abs_diff": 5.545898,
      "max_norm": 0.0023035,
      "mean_norm": 5.384e-06,
      "correlation": 1.0,
      "finite_frac": 1.0
    },
    "rna_seq": {
      "pass": true,
      "shape": [
        128,
        768
      ],
      "mean_abs_diff": 0.029993,
      "max_abs_diff": 5.703125,
      "max_norm": 0.0016451,
      "mean_norm": 8.652e-06,
      "correlation": 1.0,
      "finite_frac": 1.0
    },
    "chip_tf": {
      "pass": true,
      "shape": [
        128,
        1664
      ],
      "mean_abs_diff": 0.008969,
      "max_abs_diff": 3.386719,
      "max_norm": 0.0053453,
      "mean_norm": 1.4155e-05,
      "correlation": 1.0,
      "finite_frac": 1.0
    },
    "chip_histone": {
      "pass": true,
      "shape": [
        128,
        1152
      ],
      "mean_abs_diff": 0.023026,
      "max_abs_diff": 1.960938,
      "max_norm": 0.0016132,
      "mean_norm": 1.8943e-05,
      "correlation": 1.0,
      "finite_frac": 1.0
    }
  },
  "all_pass": true
}

性能

{
  "device": "npu:0",
  "resolution_bp": 128,
  "input_bp": 16384,
  "batch": 1,
  "warmup": 3,
  "runs": 10,
  "mean_s": 0.09,
  "std_s": 0.0012,
  "bases_per_s": 182114.1
}

自验证截图

Agent workflow

NPU device call

Model result

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

已知限制

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

标签

#NPU #Ascend #Ascend910