jsjs1258/tcrt5_pre_tcrdb
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

dkarthikeyan1/tcrt5_pre_tcrdb on Ascend NPU

模型与任务

  • 模型:dkarthikeyan1/tcrt5_pre_tcrdb
  • Revision:d315a64b63482852d25c296c6ea07701d9ab844b
  • 适配路线:tcr-sequence-generation
  • 设备:npu:0

环境依赖

{
  "python": "3.11.14",
  "torch": "2.9.0+cpu",
  "torch_npu": "2.9.0.post1+gitee7ba04",
  "transformers": "4.57.6",
  "sentencepiece": "0.2.1",
  "safetensors": "0.7.0",
  "device_name": "Ascend910_9362",
  "npu_devices": 2
}

安装:pip install -r requirements.txt

NPU 推理

默认执行:python inference.py

真实输入

{
  "tokenizer_class": "T5Tokenizer",
  "vocab_size": 128,
  "pmhc_input": "[PMHC]KLGGALQAK[SEP]YFAMYQENVAQTDVDTLYIIYRDYTWAELAYTWY[EOS]",
  "pmhc_sha256": "3db03a10cbc44b62a6de25ff09434326eed118e6fec2e3da5dac6943741dc715",
  "cdr3_source": "CASSLGQGYEQYF",
  "cdr3_sha256": "8d5c8634ed30aed893a497f1ede941468002607649787218f340e6808859e458",
  "masked_input": "CASSLG<extra_id_0>YEQYF",
  "span_target": "<extra_id_0>QG<extra_id_1>YEQYF<extra_id_2>",
  "batch_size": 2,
  "seq_len": 46
}

真实推理结果

{
  "encoder_last_hidden_state_shape": [
    2,
    46,
    256
  ],
  "decoder_logits_shape": [
    2,
    11,
    128
  ],
  "decoder_loss": 7.7656,
  "generated_pmhc_to_tcr": "[SOS] <extra_id_0> LLL <extra_id_1>",
  "generated_mask_recon": "[SOS] <extra_id_0> GS <extra_id_1>",
  "output_dtype": "float32"
}

CPU-NPU 一致性

{
  "encoder_hidden_state": {
    "passed": true,
    "max_abs_diff": 6.854534149169922e-07,
    "mean_abs_diff": 8.84807556691113e-08,
    "atol": 1e-05,
    "rtol": 0.001,
    "elements": 23552
  },
  "decoder_logits": {
    "passed": true,
    "max_abs_diff": 2.193450927734375e-05,
    "mean_abs_diff": 2.6529974919950208e-06,
    "atol": 0.0001,
    "rtol": 0.001,
    "elements": 2816
  },
  "generated_ids_identical": true,
  "note": "CPU baseline and npu:0 use identical revision, input, tokenizer seed and float32; biological span-reconstruction outputs and decoder sequence match exactly."
}

性能

{
  "dtype": "float32",
  "warmup_iters": 3,
  "stable_iters": 10,
  "latency_ms_per_iter": 636.6,
  "sequences_per_s": 1.57,
  "amino_acid_tokens_per_s": 154,
  "generated_len": 49,
  "device": "npu:0"
}

自验证截图

Agent workflow

NPU device call

Model result

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

已知限制

  • 本模型为 TCRT5 pre-training 权重(mlm/span-reconstruction 目标),未经过 pMHC->TCR 条件生成微调;跨设备一致性按 encoder 隐状态、decoder logits、span重建生成序列三个真实生物学输出比较。
  • 仅对固定 revision d315a64b63482852d25c296c6ea07701d9ab844b、float32、Ascend910(npu:0)环境完成验证。
  • 单卡 65536MB HBM,峰值占用约 3109MB 权重 + 推理激活;未做量化。

标签

#NPU #Ascend #Ascend910