m
mengsihan/basset
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

multimolecule/basset on Ascend NPU

模型与任务

  • 模型:multimolecule/basset
  • Revision:c5c82a89eec1ef04ba31017c4108f62da89086ac
  • 适配路线:regulatory-sequence
  • 设备:npu:0

环境依赖

{
  "torch": "2.9.0+cpu",
  "torch_npu": "available",
  "device_name": "Ascend910_9362",
  "device_count": 2,
  "cann": "8.5.1",
  "multimolecule": "installed",
  "python": "3.11.14"
}

安装:pip install -r requirements.txt

NPU 推理

默认执行:python inference.py

真实输入

{
  "alphabet": "A/C/G/T/N",
  "tokenizer": "DnaTokenizer",
  "sequence_length": 600,
  "batch": 3,
  "sequences": [
    {
      "name": "TP53_frag_184bp",
      "length": 184,
      "sha256": "7a04b9f1828848819..."
    },
    {
      "name": "HBB_frag_142bp",
      "length": 142,
      "sha256": "8677bfc09d6f0030..."
    },
    {
      "name": "BRCA1_frag_99bp",
      "length": 99,
      "sha256": "f60583147541647f..."
    }
  ],
  "vocab_size": 5,
  "pad_token": "N",
  "attention_mask_sums": [
    184,
    142,
    99
  ]
}

真实推理结果

{
  "type": "regulatory-activity multilabel logits",
  "shape": [
    3,
    164
  ],
  "num_labels": 164,
  "dtype": "float32",
  "logits_range": {
    "min": -102.61,
    "max": -3.17,
    "mean": -50.14
  },
  "prob_top5_TP53_idx": [
    108,
    148,
    147,
    26,
    131
  ],
  "interpretation": "logits for 164 ENCODE regulatory tracks, sigmoid->prob"
}

CPU-NPU 一致性

{
  "cpu_vs_npu_max_abs_diff": 0.00794219970703125,
  "mean_abs_diff": 0.0024625833611935377,
  "prob_max_abs_diff": 1.8e-05,
  "pearson_min": 0.999999,
  "threshold_atol": 0.01,
  "threshold_rtol": 0.01,
  "passed": true
}

性能

{
  "first_inference_ms": 180.87,
  "avg_ms": 1.41,
  "p50_ms": 1.41,
  "warmup_iters": 3,
  "stable_iters": 10,
  "batch": 3,
  "sequence_length": 600,
  "throughput_sequences_per_s": 2129.38,
  "throughput_bases_per_s": 1277626,
  "dtype": "float32",
  "device": "npu:0",
  "synchronize": true
}

自验证截图

Agent workflow

NPU device call

Model result

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

已知限制

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

标签

#NPU #Ascend #Ascend910