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

multimolecule/hal on Ascend NPU

模型与任务

  • 模型:multimolecule/hal
  • Revision:8d9a34ef9a5df3a44a832786d069020d269e9208
  • 适配路线:splicing
  • 设备: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": "unknown",
  "transformers": "5.9.0"
}

安装:pip install -r requirements.txt

NPU 推理

默认执行:python inference.py

真实输入

{
  "num_sequences": 9,
  "sequence_length_fixed": 160,
  "kmer_size": 6,
  "num_hexamers": 4096,
  "alphabet": "ACGU (T->U via tokenizer, N ignored if hexamer spans N)",
  "strand": "5'->3'",
  "region_length": 160,
  "replace_T_with_U": true,
  "sequences": [
    {
      "name": "canonical_ACGU_repeat",
      "length": 160,
      "sha256": "ea3085513a5844442a654c669e7c6db8c2ac35e96bc2616d84912ae0aef8a1bf",
      "preview": "ACGUACGUACGUACGUACGUACGUACGUAC"
    },
    {
      "name": "canonical_AAUAAA_A_context",
      "length": 160,
      "sha256": "289b6126e96a23e45ad8532b3a17b3353de5c356dd72d8cafcc911a78217b98b",
      "preview": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
    },
    {
      "name": "variant_AATAAA_DNA",
      "length": 160,
      "sha256": "4442dedc5d7060105e37cff5cfdf3a12e5ebde69e95be1b630d027b47cf8d3ac",
      "preview": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
    },
    {
      "name": "GC_rich_window",
      "length": 160,
      "sha256": "a59e4ecf2e567031bd4033aaa7c65b5badd93a5577f44d4e5a637b7533dc07c3",
      "preview": "GGGGGGGGGGGGGGGGGGGGGGGGGGGGGG"
    },
    {
      "name": "AU_rich_window",
      "length": 160,
      "sha256": "ce32b762bc397b3a7a264c1fd70a894c0728b9ec99d30e6970e7a1142853b4e7",
      "preview": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
    },
    {
      "name": "HIV_TAR_extended",
      "length": 160,
      "sha256": "f6105842eb6acb166d0dee47b2fa2d728dc4d5cde71b27d2ef8e832b05d6c452",
      "preview": "GGUCUCUCUGGUUAGACCAGAUCUGAGCCU"
    },
    {
      "name": "BRAF_3UTR_160",
      "length": 160,
      "sha256": "2453992f4114b794ca8009508c277a0c193e15f1f51308aa471c15b2c3d0837d",
      "preview": "AACAAAUGAGUGAGAGAGUUCAGGAGAGUA"
    },
    {
      "name": "N_masked_window",
      "length": 160,
      "sha256": "57283425abc4fd630ce26e31086331acceaca507a1b1b691768d6f69bdba3a6d",
      "preview": "NNNNNNNNNNNNNNNNNNNNNNNNNNNNNN"
    },
    {
      "name": "shuffled_deterministic",
      "length": 160,
      "sha256": "39e81e2c680919dd76a06e2c9cd0226f8ee980d6913ba6be8f442378ce921f40",
      "preview": "ACGUACGUUGCAUGCAUCGAUCGAUCGAUC"
    }
  ],
  "tokenizer": "RnaTokenizer vocab A0 C1 G2 U3 N4, pad N",
  "add_special_tokens": false
}

真实推理结果

{
  "output_shape": [
    9,
    1
  ],
  "dtype": "float32",
  "logits_per_sequence": [
    {
      "name": "canonical_ACGU_repeat",
      "logit": 0.18374286592006683
    },
    {
      "name": "canonical_AAUAAA_A_context",
      "logit": -0.0785045400261879
    },
    {
      "name": "variant_AATAAA_DNA",
      "logit": -0.0785045400261879
    },
    {
      "name": "GC_rich_window",
      "logit": -0.008144384250044823
    },
    {
      "name": "AU_rich_window",
      "logit": -0.03752732649445534
    },
    {
      "name": "HIV_TAR_extended",
      "logit": -0.04645855352282524
    },
    {
      "name": "BRAF_3UTR_160",
      "logit": 0.008088339120149612
    },
    {
      "name": "N_masked_window",
      "logit": -0.009142894297838211
    },
    {
      "name": "shuffled_deterministic",
      "logit": 0.037346672266721725
    }
  ],
  "logits_cpu": [
    0.18374288082122803,
    -0.0785045400261879,
    -0.0785045400261879,
    -0.008144382387399673,
    -0.037527330219745636,
    -0.04645855352282524,
    0.008088338188827038,
    -0.009142894297838211,
    0.037346675992012024
  ],
  "logits_npu": [
    0.18374286592006683,
    -0.0785045400261879,
    -0.0785045400261879,
    -0.008144384250044823,
    -0.03752732649445534,
    -0.04645855352282524,
    0.008088339120149612,
    -0.009142894297838211,
    0.037346672266721725
  ],
  "variant_effect_DNA_vs_RNA": {
    "ref": "canonical_AAUAAA",
    "alt": "variant_AATAAA_DNA",
    "delta_npu": 0.0,
    "delta_cpu": 0.0
  },
  "hexamer_check": {
    "cpu_sum": 1.0,
    "npu_sum": 1.0
  },
  "device_proof": "first_param:npu:0, logits:npu:0, input:npu:0"
}

CPU-NPU 一致性

{
  "atol": 1e-05,
  "rtol": 0.0001,
  "max_abs_diff": 1.4901161193847656e-08,
  "mean_abs_diff": 2.7939677238464355e-09,
  "mae": 2.7939677238464355e-09,
  "rmse": 5.313891549008076e-09,
  "passed": true,
  "pearson": 0.9999999999999997,
  "shape": [
    9,
    1
  ],
  "finite": true
}

性能

{
  "first_run_ms": 195.16515731811523,
  "second_run_ms": 30.68685531616211,
  "avg_ms": 28.20441722869873,
  "min_ms": 27.9543399810791,
  "max_ms": 28.36012840270996,
  "p50_ms": 28.218865394592285,
  "p90_ms": 28.35218906402588,
  "throughput_seq_per_s": 319.09895272866214,
  "throughput_bases_per_s": 51055.832436585944,
  "batch_size": 9,
  "sequence_length": 160,
  "dtype": "float32"
}

自验证截图

Agent workflow

NPU device call

Model result

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

已知限制

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

标签

#NPU #Ascend #Ascend910