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

multimolecule/malinois on Ascend NPU

模型与任务

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

环境依赖

{
  "python": "3.11.14",
  "torch": "2.9.0+cpu",
  "torch_npu": "2.9.0.post1+gitee7ba04",
  "device_name": "Ascend910_9362",
  "device_count": 2,
  "dtype": "float32",
  "model_dir": "/tmp/malinois_dl",
  "revision": "0c670497e829ec4db586900ff35e89cf3666aa3e"
}

安装:pip install -r requirements.txt

NPU 推理

默认执行:python inference.py

真实输入

{
  "source": "malinois model card widget examples + official 600 bp example",
  "n_sequences": 7,
  "names": [
    "tp53",
    "brca1",
    "hbb",
    "cftr",
    "tert",
    "kras",
    "official_minimal_600bp"
  ],
  "lengths_after_tokenization": [
    600
  ],
  "primary_sequence_name": "tp53",
  "primary_sequence_length_bp": 184,
  "primary_sequence_sha256": "7a04b9f182884881e3dc7870767e85cf13f1ef93901512f927ca48ef8271903d",
  "alphabet": "ACGTN",
  "padding": "pad to 600 with N (token 4)",
  "input_ids_shape": [
    7,
    600
  ],
  "input_ids_dtype": "torch.int64"
}

真实推理结果

{
  "logits_shape": [
    7,
    3
  ],
  "cell_lines": [
    "K562",
    "HepG2",
    "SK-N-SH"
  ],
  "mean_logits_cpu": {
    "K562": 1.7077,
    "HepG2": 1.6356,
    "SK-N-SH": 2.8695
  },
  "mean_logits_npu": {
    "K562": 1.708,
    "HepG2": 1.6358,
    "SK-N-SH": 2.8702
  },
  "primary_prediction": {
    "name": "tp53",
    "K562": 0.6858,
    "HepG2": 0.6121,
    "SK-N-SH": 0.7846
  },
  "official_minimal_prediction": {
    "name": "official_minimal_600bp",
    "K562": 8.4219,
    "HepG2": 7.5144,
    "SK-N-SH": 15.2516
  }
}

CPU-NPU 一致性

{
  "cpu_vs_npu": {
    "max_abs_diff": 0.004555702209472656,
    "mean_abs_diff": 0.0004863057817731585,
    "pearson_r": 1.0,
    "allclose_atol_rtol": "1e-2/1e-2",
    "allclose": true
  },
  "finite_elements": "21/21",
  "cell_line_rank_agreement": 1.0
}

性能

{
  "warmup_runs": 3,
  "stable_runs": 10,
  "mean_inference_s": 0.00177,
  "first_stable_s": 0.001773,
  "sequences_per_s": 3955.424,
  "bases_per_s": 2373254.5,
  "input_length_bp": 600,
  "batch_size": 7,
  "dtype": "float32",
  "device": "npu:0"
}

自验证截图

Agent workflow

NPU device call

Model result

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

已知限制

  • 验证覆盖固定 revision 0c670497e829ec4db586900ff35e89cf3666aa3e、600 bp 输入窗口、float32 与单卡 Ascend910。
  • 模型卡说明 ~200 bp 候选经 MPRA 侧翼填充至 600 bp 属于数据管线;此处以 N 填充补齐 600 bp 窗口,生物学意义为 CRE 活性打分。

标签

#NPU #Ascend #Ascend910