w
gcw_uQ09W7jl/deepstarr
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

multimolecule/deepstarr on Ascend NPU

模型与任务

  • 模型:multimolecule/deepstarr
  • Revision:f52a09a023db34889a8e6a60aa8e0ffe87c59b98
  • 适配路线: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",
  "multimolecule": "0.2.1",
  "transformers": "4.44.0",
  "hf_endpoint": "https://hf-mirror.com",
  "python": "3.11.14"
}

安装:pip install -r requirements.txt

NPU 推理

默认执行:python inference.py

真实输入

{
  "num_sequences": 3,
  "sequence_length_fixed": 249,
  "alphabet": "A/C/G/T/N (N->4 zero-vector, U->T via replace_U_with_T)",
  "strand": "5'->3' retained",
  "species": "Drosophila melanogaster S2",
  "genome": "dm6 STARR-seq",
  "padding": "no padding, exact 249bp window; longer truncated, shorter would be N-padded (pad_token_id=4)",
  "tokenizer": "DnaTokenizer custom ACGT->0-3, N->4 zero-vector via one_hot clamp, replace_U_with_T=true",
  "sequences": [
    {
      "name": "p53_249",
      "length": 249,
      "sha256": "191ac3d612f41a38dffd47e77f0887400d316f79835e21bd0b77941e53c8ee3c",
      "preview": "ACTCCCCTGCCCTCAACAAGATGTTTTGCCAA",
      "desc": "tumor p53 fragment repeated to 249bp"
    },
    {
      "name": "ACGT_repeat_249",
      "length": 249,
      "sha256": "d29e7c41c3673fc32dd3d68c460678f2b5399b7548d7c8b1ad9d3d7f04da5ea2",
      "preview": "ACGTACGTACGTACGTACGTACGTACGTACGT",
      "desc": "ACGT periodic repeat 249bp"
    },
    {
      "name": "enhancer_motif_249",
      "length": 249,
      "sha256": "f18cf7e628ae4115a84dbc50952c3ea8ba5d7a89e9a9796f667b7065820aaf83",
      "preview": "GATTACAGATTACAGATTACAGATTACAGATT",
      "desc": "GATTACA enhancer motif repeat 249bp"
    }
  ],
  "input_ids_shape": [
    3,
    249
  ],
  "attention_mask_shape": [
    3,
    249
  ],
  "add_special_tokens": false
}

真实推理结果

{
  "output_shape": [
    3,
    2
  ],
  "dtype": "float32",
  "task": "regulatory-sequence enhancer activity regression (developmental, housekeeping) log2 enrichment",
  "logits_range": [
    -0.61,
    3.64
  ],
  "samples": [
    {
      "name": "p53_249",
      "logits": [
        -0.556588,
        -1.043166
      ],
      "cpu_logits": [
        -0.556607,
        -1.043163
      ]
    },
    {
      "name": "ACGT_repeat_249",
      "logits": [
        3.635379,
        1.900541
      ],
      "cpu_logits": [
        3.6352,
        1.900423
      ]
    },
    {
      "name": "enhancer_motif_249",
      "logits": [
        -0.610599,
        -0.801093
      ],
      "cpu_logits": [
        -0.610611,
        -0.80146
      ]
    }
  ],
  "device_proof": "first_param:npu:0, input_ids:npu:0, logits:npu:0",
  "finite_ok": true
}

CPU-NPU 一致性

{
  "atol": 0.005,
  "rtol": 0.001,
  "max_abs_diff": 0.0003674030303955078,
  "mean_abs_diff": 0.00011638800303141276,
  "pearson": 1.0,
  "passed": true,
  "shape": [
    3,
    2
  ],
  "elements": 6,
  "note": "3 sequences batch compared; allclose passed"
}

性能

{
  "first_run_ms": 3.01,
  "avg_ms": 3.01,
  "min_ms": 2.97,
  "max_ms": 3.04,
  "single_latency_ms": 2.97,
  "throughput_seq_per_s": 997.16,
  "throughput_bases_per_s": 248293.9,
  "throughput_single_seq_per_s": 337.11,
  "batch_size": 3,
  "sequence_length": 249,
  "dtype": "float32",
  "warmup": 3,
  "iters": 10,
  "device": "npu:0"
}

自验证截图

Agent workflow

NPU device call

Model result

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

已知限制

  • 仅对本次记录的模型 revision、输入契约、dtype 与 Ascend 环境完成验证。
  • 固定 249bp 窗口,Drosophila S2 双任务回归;非人类基因组直接外推需谨慎。
  • N 视为 zero vector,与原实现 one_hot clamp 语义一致;U 自动映射为 T。
  • 单次 smoke consistency 验证(3 序列),非完整精度评测。

标签

#NPU #Ascend #Ascend910