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

multimolecule/chrombpnet on Ascend NPU

模型与任务

  • 模型:multimolecule/chrombpnet
  • Revision:74a4692c4ed0e4974345fd8f9d4367beab9280ca
  • 适配路线:regulatory-sequence
  • 设备:npu:0

环境依赖

{
  "torch": "2.9.0+cpu",
  "torch_npu": "2.9.0.post1+gitee7ba04",
  "transformers": "4.57.6",
  "multimolecule": "0.2.1",
  "device_name": "Ascend910_9362",
  "npu_available": true,
  "device_count": 2,
  "soc_version": "ascend910_9391",
  "dtype": "float32"
}

安装:pip install -r requirements.txt

NPU 推理

默认执行:python inference.py

真实输入

{
  "sequence_length": 2114,
  "profile_length": 1000,
  "alphabet": "ACGTN",
  "direction": "5'->3'",
  "tokenizer": "DnaTokenizer",
  "nmers": 1,
  "pad_token": "N",
  "vocab_size": 5,
  "batch": 6,
  "sequences_sha256": [
    "233616d27f86001aabc4b0f2e537ed3d0e40e96c1e50669e72cd1cb9ebf23d8a",
    "e9181f7d7137a74cd1c75c2a5e28f6b8b61151d5abcab385a57c26c65cec8ea2",
    "6c3142c41c169863937cdd1cf2a48e1c015db1bc091d4be0451cd3e1bb8846b4"
  ],
  "input_shape": [
    6,
    2114
  ],
  "dtype": "int64",
  "source": "model card examples (HEK293T) tiled to 2114 + synthetic",
  "species": "human (HEK293T ATAC-seq-derived ChromBPNet)",
  "num_tasks": 1,
  "num_strands": 1,
  "task": "bias-factorized base-resolution chromatin accessibility (profile + count)"
}

真实推理结果

{
  "output_type": "profile_logits + count_logits -> bias-corrected track",
  "profile_shape": [
    6,
    1000,
    1
  ],
  "count_shape": [
    6,
    1
  ],
  "track_shape": [
    6,
    1000,
    1
  ],
  "dtype": "float32",
  "profile_mean_cpu": 23.98325,
  "profile_mean_npu": 23.982304,
  "profile_range_cpu": [
    7.327869,
    32.441624
  ],
  "count_mean_cpu": 6.972332,
  "count_mean_npu": 6.973528,
  "track_mean_cpu": 10.025724,
  "track_mean_npu": 10.045491,
  "track_range_cpu": [
    0.000102,
    52.118824
  ],
  "example_profile_seq0_npu_first5": [
    30.15750503540039,
    26.82829475402832,
    31.901321411132812,
    26.667537689208984,
    28.659666061401367
  ],
  "example_track_seq0_npu_first5": [
    0.37749186158180237,
    0.013522280380129814,
    2.1589243412017822,
    0.011514206416904926,
    0.08441204577684402
  ],
  "example_count_seq0_npu": 5.766531467437744,
  "activation": "profile via softmax + count logsumexp -> track (chrombpnet postprocess)",
  "finite_ratio": 1.0
}

CPU-NPU 一致性

{
  "method": "same weights, sequences, tokenizer, dtype float32, eval mode, npu:0 vs cpu",
  "cpu_device": "cpu",
  "npu_device": "npu:0",
  "compared_tensor": "profile_logits [6,1000,1] + count_logits [6,1] + track [6,1000,1]",
  "profile_max_abs_diff": 0.00685787,
  "profile_mean_abs_diff": 0.00140647,
  "count_max_abs_diff": 0.00572014,
  "count_mean_abs_diff": 0.00131043,
  "track_max_abs_diff": 0.08229828,
  "track_mean_abs_diff": 0.01981453,
  "track_pearson": 0.999999,
  "max_abs_diff": 0.08229828,
  "mean_abs_diff": 0.01981453,
  "atol": 0.01,
  "rtol": 0.001,
  "passed": true,
  "threshold_reason": "float32 dilated CNN on Ascend910: profile max ~0.007, count ~0.006, track ~0.08 (exp amplification); Pearson >0.999"
}

性能

{
  "first_latency_ms": 234.2782,
  "avg_latency_ms": 54.8633,
  "batch": 6,
  "sequence_length": 2114,
  "profile_length": 1000,
  "min_latency_ms": 54.1735,
  "max_latency_ms": 55.0733,
  "p50_latency_ms": 54.9059,
  "sequences_per_second": 109.36,
  "bases_per_second": 231192.96,
  "windows_per_second": 109.36,
  "dtype": "float32",
  "device": "npu:0",
  "warmup_iters": 3,
  "stable_iters": 10,
  "synchronize": "torch.npu.synchronize() before/after timing",
  "memory_allocated_MB": 25.52,
  "memory_max_MB": 127.86
}

自验证截图

Agent workflow

NPU device call

Model result

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

已知限制

  • 仅对本次记录的模型 revision、输入契约、dtype 与 Ascend 环境完成验证。
  • 阈值基于 float32 在 Ascend910 上实测 profile max 0.007, track max 0.08, Pearson 1.0 制定;track 为指数重构,绝对误差放大但相关性保持。
  • 输入为固定 2114 bp DNA 窗口,profile 输出 1000 bp,去偏校正后 track 为可用信号。

标签

#NPU #Ascend #Ascend910