liucu/aparent-npu
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

multimolecule/aparent on Ascend NPU

模型与任务

  • 模型:multimolecule/aparent
  • Revision:2d2848b4ca089699d174c23ef091428731413215
  • 适配路线:polyadenylation
  • 设备:npu:0

环境依赖

{
  "torch": "2.9.0+cpu",
  "torch_npu": "2.9.0.post1+gitee7ba04",
  "device_name": "Ascend910_9362",
  "device_count": 2,
  "python": "3.11.14",
  "cann": "8.5.1",
  "model_dir": "/opt/atomgit/adapt-npu-agent/working/aparent_weights",
  "dtype": "float32",
  "revision": "2d2848b4ca089699d174c23ef091428731413215"
}

安装:pip install -r requirements.txt

NPU 推理

默认执行:python inference.py

真实输入

{
  "route": "polyadenylation",
  "alphabet": "RNA A/C/G/U/N (vocab 5, replace_T_with_U true)",
  "strand": "5'->3'",
  "sequence_length": 205,
  "batch": 1,
  "primary_sequence_name": "human_GPI_3UTR_trunc",
  "primary_sequence": "UUUUUAAAAGGAAAAGAUACCAAAUGCCUGCUGCUACCACCCUUUUCAAUUGCUAUGUUUUGAAAGGCACCAGUAUGUGUUUUAGAUUGAUUUAAAUGUUUCAUUUAAAUCACGGACAGUAGUUUCAGUUCUGAUGGUAUAAGCAAAACAAAUAAAACGUUUAUAAAAGUUGUAUCUUGAAACACUGGUGUUCAACAGCUAGCAG",
  "primary_sha256": "89bb4bf79483b7af70e479e95cbff58fc1b466b1f63db154108c8633764fcd97",
  "all_sequences": {
    "synthetic_PAS": {
      "length": 205,
      "sha256": "131fa34ae063fc433cf980a91ecf893ca5886f795eec0cf4dbad10478ec53bc5",
      "preview": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA..."
    },
    "human_GPI_3UTR_trunc": {
      "length": 205,
      "sha256": "89bb4bf79483b7af70e479e95cbff58fc1b466b1f63db154108c8633764fcd97",
      "preview": "UUUUUAAAAGGAAAAGAUACCAAAUGCCUGCUGCUACCACCCUUUUCAAUUGCUAUGUUU..."
    },
    "reference_variant_ref": {
      "length": 205,
      "sha256": "c0f06faf89c32430d09be4c03842c667713833ac1d954ac00800dcfad65c5ce3",
      "preview": "GGCCGGGCGCGGUGGCUCACGCCUGUAAUCCCAGCUCUCAGGGAGGCUAAGAGGCGGGAG..."
    }
  },
  "tokenizer": "RnaTokenizer 1-mer, pad=N id4, replace_T_with_U true",
  "model_dir": "/opt/atomgit/adapt-npu-agent/working/aparent_weights",
  "revision": "2d2848b4ca089699d174c23ef091428731413215",
  "species": "human",
  "task": "polyadenylation isoform proportion + cleavage distribution",
  "output_contract": "isoform_logits shape [batch,1] (regression), cleavage_logits shape [batch,206] from AparentModel",
  "source": "model card widget 3UTR + synthetic PAS"
}

真实推理结果

{
  "isoform_logits_shape": [
    1,
    1
  ],
  "isoform_logits_dtype": "float32",
  "isoform_logit_cpu": -7.432636737823486,
  "isoform_logit_npu": -7.432460308074951,
  "isoform_proportion_cpu": 0.0005912756896577775,
  "isoform_proportion_npu": 0.0005913799395784736,
  "cleavage_logits_shape": [
    1,
    206
  ],
  "cleavage_logits_dtype": "float32",
  "cleavage_sample_cpu": [
    -2.0180320739746094,
    -2.1183364391326904,
    -2.1166868209838867,
    -2.1310691833496094,
    -2.3670177459716797
  ],
  "cleavage_sample_npu": [
    -2.019134759902954,
    -2.119180679321289,
    -2.117587089538574,
    -2.131959915161133,
    -2.3678228855133057
  ],
  "num_cleavage_labels": 206,
  "num_isoform_labels": 1,
  "problem_type": "regression",
  "variant_effect_demo": "PAS AAUAAA -> AACAAA reduces isoform proportion, validated"
}

CPU-NPU 一致性

{
  "passed": true,
  "isoform": {
    "max_abs_diff": 0.00017642974853515625,
    "mean_abs_diff": 0.00017642974853515625,
    "atol": 0.001,
    "rtol": 0.001,
    "passed": true,
    "shape": [
      1,
      1
    ],
    "elements": 1
  },
  "cleavage": {
    "max_abs_diff": 0.001373291015625,
    "mean_abs_diff": 0.0003436197632996058,
    "atol": 0.005,
    "rtol": 0.005,
    "passed": true,
    "shape": [
      1,
      206
    ],
    "elements": 206
  },
  "max_abs_diff": 0.001373291015625,
  "mean_abs_diff": 0.000260024755917381,
  "atol": 0.005,
  "rtol": 0.005,
  "shape": [
    1,
    1
  ],
  "elements": 1
}

性能

{
  "single_infer_ms": 1.7299652099609375,
  "avg_ms": 0.8900165557861328,
  "min_ms": 0.8699893951416016,
  "max_ms": 0.9138584136962891,
  "seq_per_s": 1123.5746048754354,
  "bases_per_s": 230332.79399946425,
  "input_length": 205,
  "batch_size": 1,
  "dtype": "float32",
  "device": "npu:0",
  "warmup": 3,
  "stable_runs": 10,
  "peak_memory_mb": 66.21484375,
  "first_compile_ms": 0.9000301361083984
}

自验证截图

Agent workflow

NPU device call

Model result

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

已知限制

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

标签

#NPU #Ascend #Ascend910