liucu/maxentscan-score3-NPU
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

multimolecule/maxentscan-score3 on Ascend NPU

模型与任务

  • 模型:multimolecule/maxentscan-score3
  • Revision:a6329dab709cf4e4a15c70124acbdafa48097d28
  • 适配路线:splicing
  • 设备:npu:0

环境依赖

{
  "torch_version": "2.9.0+cpu",
  "torch_npu_available": true,
  "device_name": "Ascend910_9362",
  "device_count": 2,
  "python_version": "3.11.14",
  "dtype": "float32",
  "model_dir": "/opt/atomgit/.cache/huggingface/hub/models--multimolecule--maxentscan-score3/snapshots/a6329dab709cf4e4a15c70124acbdafa48097d28",
  "multimolecule_version": "0.2.1",
  "cann": "8.5.1"
}

安装:pip install -r requirements.txt

NPU 推理

默认执行:python inference.py

真实输入

{
  "route": "splicing",
  "alphabet": "RNA A/C/G/U/N (vocab 5, replace_T_with_U true, N->clamp to A for hash, masked N=4)",
  "strand": "5'->3' fixed 23-nt acceptor window, donor/acceptor consensus at positions 19-20 (AG), no padding required",
  "window": 23,
  "mode": "score3",
  "vocab_size": 5,
  "sequences": {
    "acceptor_canonical_TTT_AG": "UUUUUUUUUUUUUUUUUUUCAGU",
    "acceptor_GC_rich": "CCCCCCCCCCCCCCCCCCCCCCC",
    "acceptor_AT_rich": "AAAAAAAAAAAAAAAAAAAAAAA",
    "poly_U_acceptor": "UUUUUUUUUUUUUUUUUUUUUUU",
    "ACGT_repeat_23": "ACGUACGUACGUACGUACGUACG",
    "CT_rich_acceptor_CAG": "CUCUCUCUCUCUCUCUCUCUCAG",
    "intron_exon_TTTTTCAG": "AUUUUUUUUUUUUUUUUUUCAGA",
    "intron_exon_GGGGCAG": "GGGGGGGGGGGGGGGGGGGCAGG",
    "high_score_candidate": "UUUUUUUUUUUUUUUUUUACAGU",
    "low_score_random": "GCAUGCAUGCAUGCAUGCAUGCA"
  },
  "primary_seq": "UUUUUUUUUUUUUUUUUUUCAGU",
  "primary_seq_name": "acceptor_canonical_TTT_AG",
  "primary_sha256": "1bf2b85bc2213ef774ed0af87ec4acf8b6a95da98a6255217cee8431f9e5beeb",
  "primary_sha256_short": "1bf2b85bc2213ef7",
  "batch": 10,
  "dtype": "float32",
  "tokenizer": "RnaTokenizer 1-mer, model_max_length 23, attention_mask all-1 for fixed window, device-migrated",
  "model_dir": "/opt/atomgit/.cache/huggingface/hub/models--multimolecule--maxentscan-score3/snapshots/a6329dab709cf4e4a15c70124acbdafa48097d28",
  "revision": "a6329dab709cf4e4a15c70124acbdafa48097d28",
  "species": "human GRCh38 synthetic acceptor splice site 23-mer windows",
  "output_contract": "logits shape [batch,1] single MaxEnt acceptor score log2 scale, regression, no activation, no threshold"
}

真实推理结果

{
  "logits_shape": [
    10,
    1
  ],
  "logits_dtype": "float32",
  "logits_device": "npu:0",
  "primary_seq": "UUUUUUUUUUUUUUUUUUUCAGU",
  "primary_seq_name": "acceptor_canonical_TTT_AG",
  "primary_score_npu": -4.625666618347168,
  "primary_score_cpu": -4.625666618347168,
  "primary_sha256": "1bf2b85bc2213ef7",
  "batch_shape": [
    10,
    1
  ],
  "batch_scores_npu": [
    -4.625666618347168,
    -5.756258010864258,
    -16.265111923217773,
    -5.7374653816223145,
    -13.5939359664917,
    -4.482032299041748,
    -6.053434371948242,
    -36.869140625,
    3.7410929203033447,
    -5.796389102935791
  ],
  "batch_scores_cpu": [
    -4.625666618347168,
    -5.756258010864258,
    -16.265111923217773,
    -5.7374653816223145,
    -13.5939359664917,
    -4.482032299041748,
    -6.053433895111084,
    -36.869140625,
    3.7410926818847656,
    -5.796389102935791
  ],
  "batch_scores_map": {
    "acceptor_canonical_TTT_AG": -4.625666618347168,
    "acceptor_GC_rich": -5.756258010864258,
    "acceptor_AT_rich": -16.265111923217773,
    "poly_U_acceptor": -5.7374653816223145,
    "ACGT_repeat_23": -13.5939359664917,
    "CT_rich_acceptor_CAG": -4.482032299041748,
    "intron_exon_TTTTTCAG": -6.053434371948242,
    "intron_exon_GGGGCAG": -36.869140625,
    "high_score_candidate": 3.7410929203033447,
    "low_score_random": -5.796389102935791
  },
  "ranking_top": [
    {
      "name": "high_score_candidate",
      "seq": "UUUUUUUUUUUUUUUUUUACAGU",
      "score": 3.7410929203033447
    },
    {
      "name": "CT_rich_acceptor_CAG",
      "seq": "CUCUCUCUCUCUCUCUCUCUCAG",
      "score": -4.482032299041748
    },
    {
      "name": "acceptor_canonical_TTT_AG",
      "seq": "UUUUUUUUUUUUUUUUUUUCAGU",
      "score": -4.625666618347168
    }
  ],
  "ranking_all": [
    {
      "name": "high_score_candidate",
      "seq": "UUUUUUUUUUUUUUUUUUACAGU",
      "score": 3.7410929203033447
    },
    {
      "name": "CT_rich_acceptor_CAG",
      "seq": "CUCUCUCUCUCUCUCUCUCUCAG",
      "score": -4.482032299041748
    },
    {
      "name": "acceptor_canonical_TTT_AG",
      "seq": "UUUUUUUUUUUUUUUUUUUCAGU",
      "score": -4.625666618347168
    },
    {
      "name": "poly_U_acceptor",
      "seq": "UUUUUUUUUUUUUUUUUUUUUUU",
      "score": -5.7374653816223145
    },
    {
      "name": "acceptor_GC_rich",
      "seq": "CCCCCCCCCCCCCCCCCCCCCCC",
      "score": -5.756258010864258
    },
    {
      "name": "low_score_random",
      "seq": "GCAUGCAUGCAUGCAUGCAUGCA",
      "score": -5.796389102935791
    },
    {
      "name": "intron_exon_TTTTTCAG",
      "seq": "AUUUUUUUUUUUUUUUUUUCAGA",
      "score": -6.053434371948242
    },
    {
      "name": "ACGT_repeat_23",
      "seq": "ACGUACGUACGUACGUACGUACG",
      "score": -13.5939359664917
    },
    {
      "name": "acceptor_AT_rich",
      "seq": "AAAAAAAAAAAAAAAAAAAAAAA",
      "score": -16.265111923217773
    },
    {
      "name": "intron_exon_GGGGCAG",
      "seq": "GGGGGGGGGGGGGGGGGGGCAGG",
      "score": -36.869140625
    }
  ],
  "stats_npu": {
    "mean": -9.543832778930664,
    "std": 10.438443183898926,
    "min": -36.869140625,
    "max": 3.7410929203033447
  },
  "stats_cpu": {
    "mean": -9.54383373260498,
    "std": 10.438443183898926,
    "min": -36.869140625,
    "max": 3.7410926818847656
  },
  "high_score_candidate": {
    "name": "high_score_candidate",
    "seq": "UUUUUUUUUUUUUUUUUUACAGU",
    "score": 3.7410929203033447
  },
  "low_score_example": {
    "name": "intron_exon_GGGGCAG",
    "seq": "GGGGGGGGGGGGGGGGGGGCAGG",
    "score": -36.869140625
  },
  "delta_example_ref_alt": {
    "ref": "UUUUUUUUUUUUUUUUUUACAGU",
    "ref_score": 3.741093158721924,
    "alt": "AAAAAAAAAAAAAAAAAAAAAAA",
    "alt_score": -16.265112,
    "delta": -20.006205
  },
  "device": "npu:0",
  "window": 23,
  "num_labels": 1,
  "problem_type": "regression"
}

CPU-NPU 一致性

{
  "passed": true,
  "atol": 1e-05,
  "rtol": 1e-05,
  "max_abs_diff": 4.76837158203125e-07,
  "mean_abs_diff": 7.152557373046875e-08,
  "shape": [
    10,
    1
  ],
  "elements": 10,
  "pearson_r": 0.9999999999999999,
  "dtype": "float32",
  "note": "CPU same revision, same tokenizer, same 10 acceptor 23-mers, N clamped handling, synchronized NPU, strict atol 1e-5"
}

性能

{
  "avg_ms_per_iter": 2.872,
  "p50_ms_per_iter": 2.87,
  "min_ms": 2.838,
  "max_ms": 2.9,
  "throughput_seq_per_s": 348.18,
  "throughput_bases_per_s": 8008.14,
  "throughput_windows_per_s": 348.18,
  "batch": 10,
  "window": 23,
  "dtype": "float32",
  "warmup": 3,
  "stable_iters": 10,
  "device": "npu:0",
  "peak_hbm_mb": 3106,
  "note": "torch.npu.synchronize before/after each iter, first compile included? Stable avg excludes first warmup, 10 stable iters batch 10"
}

自验证截图

Agent workflow

NPU device call

Model result

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

已知限制

  • 仅对本次记录的模型 revision、输入契约、dtype 与 Ascend 环境完成验证。
  • MaxEntScan score3 固定 23-nt 窗口,不支持可变长度或 inputs_embeds;N token 按官方 clamp 到 A 处理。
  • 单卡 npu:0 流水测量,未评估 score5 (9-nt donor) 窗口变体及大 batch 吞吐。
  • 生物学排名仅对合成 10 窗口的相对 MaxEnt分数,非完整基因组 splice site AUPRC 评测。

标签

#NPU #Ascend #Ascend910