liucu/bpnet
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

multimolecule/bpnet on Ascend NPU

模型与任务

  • 模型:multimolecule/bpnet
  • Revision:44aafb32fc6d71fcf12d0a73054d28e095fe3099
  • 适配路线:regulatory-sequence
  • 设备:npu:0

环境依赖

{
  "torch": "2.9.0+cpu",
  "torch_npu_available": true,
  "npu_device_name": "Ascend910_9362",
  "device_count": 2,
  "hf_endpoint": "https://hf-mirror.com",
  "multimolecule": "0.2.1",
  "python": "3.11"
}

安装:pip install -r requirements.txt

NPU 推理

默认执行:python inference.py

真实输入

{
  "sequence_length": 1000,
  "vocab_size": 5,
  "alphabet": "DNA A/C/G/T/N pad_id 4, replace_U_with_T true",
  "strand": "5'->3' forward",
  "species": "mus musculus mESC",
  "primary_sequence_name": "hemoglobin_1000",
  "primary_sha256": "44c8829c12119478edd90053b110e349542380f9ce4b35e8c227f3a2529aa373",
  "primary_seq_preview": "CATTTGCTTCTGACACAACTGTGTTCACTAGCAACCTCAAACAGACACCATGGTGCATCTGACTCCTGAGGAGAAGTCTGCCGTTACTGCCCTGTGGGGCAAGGTGAACGTGGATGAAGTTGGTGGTGAGGCCCTGGGCAGG...[repeated to 1000]",
  "batch": 1,
  "dtype": "float32",
  "profile_length": 1000,
  "tracks": "Oct4 Sox2 Nanog Klf4 x forward/reverse =8"
}

真实推理结果

{
  "profile_shape": [
    1,
    1000,
    8
  ],
  "count_shape": [
    1,
    8
  ],
  "track_shape": [
    1,
    1000,
    8
  ],
  "track_stats": {
    "min": 0.002436618786305189,
    "max": 0.15740689635276794,
    "mean": 0.024275140836834908,
    "std": 0.016905054450035095
  },
  "count_logits": [
    [
      3.2222282886505127,
      3.124391555786133,
      2.4655532836914062,
      2.4324605464935303,
      3.504462480545044,
      3.42106294631958,
      3.4247398376464844,
      3.3545989990234375
    ]
  ],
  "profile_logits_sample_0_0_4": [
    12.860054016113281,
    12.770832061767578,
    13.622952461242676,
    14.600031852722168
  ],
  "per_tf_forward_mean": {
    "0": 0.025083953514695168,
    "1": 0.011769991368055344,
    "2": 0.03326356038451195,
    "3": 0.030714653432369232
  },
  "per_tf_reverse_mean": {
    "0": 0.02274605631828308,
    "1": 0.011386865749955177,
    "2": 0.030601928010582924,
    "3": 0.028634117916226387
  },
  "id2label": {
    "0": "Oct4",
    "1": "Sox2",
    "2": "Nanog",
    "3": "Klf4"
  },
  "device": "npu:0",
  "dtype": "torch.float32"
}

CPU-NPU 一致性

{
  "track": {
    "passed": true,
    "shape": [
      1,
      1000,
      8
    ],
    "elements": 8000,
    "max_abs_diff": 4.903972148895264e-05,
    "mean_abs_diff": 4.253495921147988e-06,
    "atol": 0.0001,
    "rtol": 0.001
  },
  "profile_logits": {
    "passed": true,
    "shape": [
      1,
      1000,
      8
    ],
    "elements": 8000,
    "max_abs_diff": 0.0005636215209960938,
    "mean_abs_diff": 0.00012585508823394776,
    "atol": 0.001,
    "rtol": 0.001
  },
  "count_logits": {
    "passed": true,
    "shape": [
      1,
      8
    ],
    "elements": 8,
    "max_abs_diff": 0.00022172927856445312,
    "mean_abs_diff": 0.00016379356384277344,
    "atol": 0.0001,
    "rtol": 0.001
  },
  "tolerance": {
    "track_atol": 0.0001,
    "track_rtol": 0.001,
    "profile_atol": 0.001,
    "profile_rtol": 0.001
  },
  "note": "CPU and NPU use identical weights, tokenizer, 1000 bp window, postprocess track; float32"
}

性能

{
  "avg_ms_per_iter": 2.85,
  "throughput_seq_per_s": 350.83,
  "throughput_bases_per_s": 350830.0,
  "batch": 1,
  "sequence_length": 1000,
  "profile_length": 1000,
  "tracks": 8,
  "dtype": "float32",
  "warmup": 3,
  "stable_iters": 10,
  "synchronize": "torch.npu.synchronize before/after timing",
  "peak_hbm_mb": 3205
}

自验证截图

Agent workflow

NPU device call

Model result

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

已知限制

  • 仅对本次记录的模型 revision、输入契约、dtype 与 Ascend 环境完成验证。
  • BPNet 输出为 profile+count 分解后重构的 track (batch,1000,8);profile shape 与输入等长,非 crop/bin。

标签

#NPU #Ascend #Ascend910