w
gcw_uQ09W7jl/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,
  "device_name": "Ascend910_9362",
  "device_count": 2,
  "torch_npu": "2.9.0.post1+gitee7ba04"
}

安装:pip install -r requirements.txt

NPU 推理

默认执行:python inference.py

真实输入

{
  "num_sequences": 6,
  "alphabet": "ACGT",
  "replace_U_with_T": true,
  "strand_handling": "separate plus/minus channels (no RC average)",
  "species": "human/mouse mixed (OSKN ChIP-nexus)",
  "num_tasks": 4,
  "num_strands": 2,
  "num_labels": 8,
  "output_tracks": [
    "Oct4_plus",
    "Oct4_minus",
    "Sox2_plus",
    "Sox2_minus",
    "Nanog_plus",
    "Nanog_minus",
    "Klf4_plus",
    "Klf4_minus"
  ],
  "sequences": [
    {
      "name": "TP53_tumor_p53",
      "length": 184,
      "sha256": "7a04b9f182884881e3dc7870767e85cf13f1ef93901512f927ca48ef8271903d",
      "preview": "ACTCCCCTGCCCTCAACAAGATGTTTTGCC"
    },
    {
      "name": "BRCA1",
      "length": 99,
      "sha256": "f60583147541647f44153ef3ff53c06dc45585703484619fffdc9a6c4e2bf5fb",
      "preview": "TCATTGGAACAGAAAGAAATGGATTTATCT"
    },
    {
      "name": "HBB_beta",
      "length": 142,
      "sha256": "8677bfc09d6f00304fc9d688164f02d66bee2593a2062940777f23cfe9416126",
      "preview": "CATTTGCTTCTGACACAACTGTGTTCACTA"
    },
    {
      "name": "CFTR",
      "length": 192,
      "sha256": "cb090ed3985228b90a13d5057750cd0e9c2f8edd5ec7db97efe9d1e916c46be0",
      "preview": "ACTTCACTTCTAATGGTGATTATGGGAGAA"
    },
    {
      "name": "ACGT_500",
      "length": 500,
      "sha256": "9774614417dad5d67bfcb00342abb037e719d9de897b62ccfa0194cb22286c34",
      "preview": "ACGTACGTACGTACGTACGTACGTACGTAC"
    },
    {
      "name": "ACGT_1000",
      "length": 1000,
      "sha256": "7150ba7413897abbea34de327a8ee2e10c594e5a3d05f09d9d5dc6b8efd26676",
      "preview": "ACGTACGTACGTACGTACGTACGTACGTAC"
    }
  ],
  "tokenizer": "DnaTokenizer vocab ACGT+N id mapping A0 C1 G2 T3 N4, one-hot",
  "add_special_tokens": false
}

真实推理结果

{
  "output_shape_profile": [
    1,
    184,
    8
  ],
  "output_shape_count": [
    1,
    8
  ],
  "output_shape_track": [
    1,
    184,
    8
  ],
  "dtype": "float32",
  "profile_stats": {
    "min": 8.17807674407959,
    "max": 15.800882339477539,
    "mean": 12.78113079071045
  },
  "count_stats": {
    "min": 3.1498897075653076,
    "max": 4.54105806350708,
    "mean": 3.6912693977355957
  },
  "track_stats": {
    "min": 0.028292018920183182,
    "max": 1.922579288482666,
    "mean": 0.2490461766719818
  },
  "per_track_mean": {
    "Oct4_plus": 0.20247682929039001,
    "Oct4_minus": 0.269348680973053,
    "Sox2_plus": 0.15053440630435944,
    "Sox2_minus": 0.13612854480743408,
    "Nanog_plus": 0.43586137890815735,
    "Nanog_minus": 0.509728193283081,
    "Klf4_plus": 0.16147905588150024,
    "Klf4_minus": 0.12681244313716888
  },
  "device_proof": "first_param:npu:0, profile:npu:0, count:npu:0, input:npu:0",
  "compare_sequence": "TP53_tumor_p53"
}

CPU-NPU 一致性

{
  "atol": 0.001,
  "rtol": 0.001,
  "max_abs_diff_profile": 0.0009469985961914062,
  "mean_abs_diff_profile": 0.000295691512292251,
  "max_abs_diff_count": 0.00020885467529296875,
  "mean_abs_diff_count": 0.00012406706809997559,
  "max_abs_diff_track": 0.0003685951232910156,
  "mean_abs_diff_track": 4.227538374834694e-05,
  "passed": true,
  "passed_profile": true,
  "passed_count": true,
  "passed_track": true,
  "pearson_profile": 0.9999999959743546,
  "pearson_track": 0.9999999649193883,
  "shape_profile": [
    1,
    184,
    8
  ],
  "shape_count": [
    1,
    8
  ]
}

性能

{
  "first_run_ms": 235.34870147705078,
  "second_run_ms": 2.0742416381835938,
  "avg_ms": 1.4245271682739258,
  "min_ms": 1.4004707336425781,
  "max_ms": 1.455545425415039,
  "p50_ms": 1.4227628707885742,
  "p90_ms": 1.4398813247680664,
  "throughput_seq_per_s": 701.9873135952066,
  "throughput_bases_per_s": 129165.66570151802,
  "batch_size": 1,
  "sequence_length": 184,
  "sequence_length_long_test": 1000,
  "dtype": "float32"
}

自验证截图

Agent workflow

NPU device call

Model result

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

已知限制

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

标签

#NPU #Ascend #Ascend910