gcw_6a3w2yXz/xpresso
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

multimolecule/xpresso on Ascend NPU

模型与任务

  • 模型:multimolecule/xpresso
  • Revision:a40f5d8be7f28e93001677d11cb469bf96c66d52
  • 适配路线:expression
  • 设备:npu:0

环境依赖

{
  "torch_version": "2.9.0+cpu",
  "torch_npu_version": "2.9.0.post1+gitee7ba04",
  "device_name": "Ascend910_9362",
  "device_count": 2,
  "npu_available": true,
  "python_version": "3.11.14",
  "dtype": "float32",
  "model_dir": "/opt/atomgit/.cache/huggingface/hub/models--multimolecule--xpresso/snapshots/a40f5d8be7f28e93001677d11cb469bf96c66d52"
}

安装:pip install -r requirements.txt

NPU 推理

默认执行:python inference.py

真实输入

{
  "sequences": {
    "p53_promoter": {
      "len": 184,
      "sha256": "7a04b9f182884881"
    },
    "acgt_repeat_low": {
      "len": 10500,
      "sha256": "e45ab83ce1fc39ac"
    },
    "polyA": {
      "len": 10500,
      "sha256": "9c4408c7b64cf2ad"
    }
  },
  "test_batch": [
    "p53_promoter",
    "acgt_repeat_low",
    "polyA"
  ],
  "input_length": 10500,
  "alphabet": "A/C/G/T/N",
  "pad_token": "N",
  "pad_token_id": 4,
  "vocab_size": 5,
  "tokenizer": "DnaTokenizer",
  "padding": "max_length 10500, truncation center? right padded",
  "num_features": 6,
  "features_seed": 0,
  "features_shape": [
    3,
    6
  ],
  "features_sample": [
    -1.1258398294448853,
    -1.152360200881958,
    0.5666505098342896,
    0.7935084104537964,
    0.5988394618034363,
    -1.5550950765609741
  ],
  "input_ids_shape": [
    3,
    10500
  ],
  "attention_mask_shape": [
    3,
    10500
  ]
}

真实推理结果

{
  "logits_shape": [
    3,
    1
  ],
  "dtype": "float32",
  "cpu_logits": [
    -0.06484559178352356,
    -0.2694436311721802,
    -0.42443209886550903
  ],
  "npu_logits": [
    -0.06484851241111755,
    -0.2694609761238098,
    -0.4244285225868225
  ],
  "output_type": "scalar regression mRNA abundance (log-transformed)",
  "example_p53_cpu": -0.06484559178352356,
  "example_p53_npu": -0.06484851241111755
}

CPU-NPU 一致性

{
  "max_abs_diff": 1.734e-05,
  "mean_abs_diff": 7.95e-06,
  "pearson": 1.0,
  "atol": 0.01,
  "rtol": 0.01,
  "passed": true,
  "note": "CPU and NPU share same weights, sequence, features, seed; float32 conv variance minimal"
}

性能

{
  "warmup_iters": 3,
  "stable_iters": 10,
  "avg_latency_ms": 0.98,
  "min_ms": 0.95,
  "max_ms": 1.01,
  "batch_size": 3,
  "seq_length": 10500,
  "seq_per_s": 3071.27,
  "bases_per_s": 32248371.4,
  "dtype": "float32",
  "device": "npu:0",
  "model_params": "0.11M",
  "flops": "0.11G"
}

自验证截图

Agent workflow

NPU device call

Model result

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

已知限制

  • 仅对本次记录的模型 revision、输入契约、dtype 与 Ascend 环境完成验证。
  • Xpresso需6维mRNA半衰期特征,本次使用随机特征(种子0)完成技术验证,生物学半衰期特征需按基因注释提供。

标签

#NPU #Ascend #Ascend910