z
zhangyuge147/procapnet
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

multimolecule/procapnet on Ascend NPU

模型与任务

  • 模型:multimolecule/procapnet
  • Revision:8703b8aa772c754dbd87f90e074c55f25d723442
  • 适配路线:regulatory-sequence
  • 设备:npu:0

环境依赖

{
  "torch": "2.9.0+cpu",
  "torch_npu": "2.9.0.post1+gitee7ba04",
  "transformers": "5.9.0",
  "multimolecule": "0.2.1",
  "npu_name": "Ascend910_9362",
  "device_count": 2,
  "python": "3.11.14",
  "cann": "8.5.1"
}

安装:pip install -r requirements.txt

NPU 推理

默认执行:python inference.py

真实输入

{
  "sequence": "ACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGT...GTACGTACGTACGTACGTACGTACGTACGTAC",
  "full_length": 2114,
  "sequence_sha256": "c40b532a83994ba982de92e95a2c97f6b1832dd29ade7a63ed911f7941b55f4c",
  "alphabet": "A/C/G/T/N",
  "direction": "5'->3'",
  "species": "human K562",
  "window_bp": 2114,
  "profile_bp": 1000,
  "strands": 2,
  "tokenizer": "DnaTokenizer",
  "input_ids_shape": [
    1,
    2114
  ],
  "attention_mask_shape": [
    1,
    2114
  ],
  "source": "synthetic ACGT repeat truncated to 2114 (SHA c40b532a) - traceable, mirrors model card example (ACGT*529)[:2114]"
}

真实推理结果

{
  "profile_logits_shape": [
    1,
    1000,
    2
  ],
  "count_logits_shape": [
    1,
    1
  ],
  "track_shape": [
    1,
    1000,
    2
  ],
  "profile_logits_sample": [
    -11.293557167053223,
    -9.28838062286377,
    -12.38500690460205,
    -8.576783180236816,
    -11.293557167053223
  ],
  "count_logits_value": 10.210614,
  "track_sum_cpu": 27189.269531,
  "track_sum_npu": 27190.328125,
  "dtype": "float32",
  "postprocess": "ProCapNetForProfilePrediction.postprocess => base-resolution two-stranded PRO-cap track"
}

CPU-NPU 一致性

{
  "profile_logits_max_abs_diff": 0.0015378,
  "profile_logits_mean_abs_diff": 0.0007579327,
  "count_logits_max_abs_diff": 3.910065e-05,
  "track_max_abs_diff": 0.01734543,
  "track_mean_abs_diff": 0.004785132,
  "atol": 0.01,
  "rtol": 0.001,
  "passed": true,
  "comparison": "CPU vs NPU same weights, same sequence, float32, profile+count heads compared"
}

性能

{
  "device": "npu:0",
  "first_compile_time_s": 0.2008,
  "avg_stable_time_s": 0.0124,
  "warmup": 3,
  "stable_iterations": 10,
  "sequence_per_s": 80.79,
  "bases_per_s": 170781.6,
  "dtype": "float32",
  "batch": 1,
  "input_length": 2114,
  "peak_memory_MiB": 44.9,
  "synchronize": "torch.npu.synchronize() before/after timing"
}

自验证截图

Agent workflow

NPU device call

Model result

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

已知限制

  • 仅对本次记录的模型 revision、输入契约、dtype 与 Ascend 环境完成验证。
  • 长上下文窗口已做显存预判(6.43M参数, 2114bp输入, 1000x2输出约轻量),单卡Ascend910可运行。

标签

#NPU #Ascend #Ascend910