gcw_6a3w2yXz/multimolecule-scbasset-NPU
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

multimolecule/scbasset on Ascend NPU

模型与任务

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

环境依赖

{
  "torch": "2.9.0+cpu",
  "torch_npu": "2.9.0.post1+gitee7ba04",
  "transformers": "4.57.6",
  "multimolecule": "0.2.1",
  "device_name": "Ascend910_9362",
  "npu_available": true,
  "device_count": 2,
  "soc_version": "ascend910_9391",
  "dtype": "float32"
}

安装:pip install -r requirements.txt

NPU 推理

默认执行:python inference.py

真实输入

{
  "sequence_length": 1344,
  "alphabet": "ACGTN",
  "direction": "5'->3'",
  "tokenizer": "DnaTokenizer",
  "nmers": 1,
  "pad_token": "N",
  "batch": 6,
  "sequences_sha256": [
    "7a04b9f182884881e3dc7870767e85cf13f1ef93901512f927ca48ef8271903d",
    "f60583147541647f44153ef3ff53c06dc45585703484619fffdc9a6c4e2bf5fb",
    "8677bfc09d6f00304fc9d688164f02d66bee2593a2062940777f23cfe9416126"
  ],
  "input_shape": [
    6,
    1344
  ],
  "dtype": "int64",
  "source": "model card examples + synthetic balanced",
  "species": "human (Buenrostro2018 hematopoiesis, 2034 cells)",
  "num_labels": 2034,
  "task": "single-cell chromatin accessibility per-cell binary"
}

真实推理结果

{
  "output_type": "logits",
  "shape": [
    6,
    2034
  ],
  "dtype": "float32",
  "logits_mean_cpu": -3.538282,
  "logits_mean_npu": -3.537516,
  "logits_range_cpu": [
    -9.580206,
    2.786155
  ],
  "logits_range_npu": [
    -9.579203,
    2.792599
  ],
  "top5_idx_seq0": [
    1224,
    770,
    1189,
    489,
    1868
  ],
  "example_logits_seq0_npu_first5": [
    -6.406315326690674,
    -7.191458702087402,
    -6.385794162750244,
    -6.544369697570801,
    -6.264533042907715
  ],
  "top5_logits_seq0_npu": [
    -0.02712251804769039,
    -0.2126600593328476,
    -0.3829440474510193,
    -0.6253841519355774,
    -0.6420819163322449
  ],
  "activation": "sigmoid per-track (binary)",
  "finite_ratio": 1.0
}

CPU-NPU 一致性

{
  "method": "same weights, sequences, tokenizer, dtype float32, same random seed (eval mode)",
  "cpu_device": "cpu",
  "npu_device": "npu:0",
  "compared_tensor": "logits batch x 2034",
  "max_abs_diff": 0.01322138,
  "mean_abs_diff": 0.00113976,
  "atol": 0.05,
  "rtol": 0.001,
  "passed": true,
  "threshold_reason": "float32 conv+BN on Ascend910 observed variance ~0.013, mean ~0.001"
}

性能

{
  "first_latency_ms": 179.9905,
  "avg_latency_ms": 2.3323,
  "batch": 6,
  "sequence_length": 1344,
  "min_latency_ms": 2.3005,
  "max_latency_ms": 2.3983,
  "p50_latency_ms": 2.3282,
  "sequences_per_second": 2572.61,
  "bases_per_second": 3457593.12,
  "dtype": "float32",
  "device": "npu:0",
  "warmup_iters": 3,
  "stable_iters": 10,
  "synchronize": "torch.npu.synchronize() before/after timing",
  "memory_allocated_MB": 17.8,
  "memory_max_MB": 51.23
}

自验证截图

Agent workflow

NPU device call

Model result

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

已知限制

  • 仅对本次记录的模型 revision、输入契约、dtype 与 Ascend 环境完成验证。
  • 阈值基于 float32 在 Ascend910 上实测最大绝对误差 0.013 制定。

标签

#NPU #Ascend #Ascend910