Skip to content

Add TCR-BERT predictor / TCR embedder wrapper #225

Description

@iskandr

Wrap TCR-BERT as an mhctools predictor / TCR embedder.

Upstream: https://github.com/wukevin/tcr-bert — a BERT model pretrained on TCR sequences, with a fixed-label antigen-specificity classifier head.

Pretrained weights: on HuggingFace — wukevin/tcr-bert (~219 MB) and wukevin/tcr-bert-mlm-only. Auto-downloaded via the standard transformers API; no manual step.

Framework / deps: PyTorch + transformers (upstream used 4.4.2, but it's a standard BERT and should load on modern transformers).

License: Apache-2.0 — the cleanest license of the benchmark set; weights are freely redistributable.

Inputs / output: CDR3 sequence (no MHC). Two use modes: (1) sequence embeddings, and (2) a classifier over a fixed antigen label set — so it predicts specificity against known epitopes rather than scoring an arbitrary (peptide, TCR) pair. Worth capturing this limitation in the wrapper's docs.

Ease: Easy. from transformers import ..., auto-download, standard forward pass.

Suggested wrapping approach: in-process via transformers as an optional extra (mhctools doesn't depend on transformers today). Expose embeddings + the fixed-label classifier; be explicit that it isn't an arbitrary-epitope binding scorer.


Surfaced from a survey of TCREpitopeBenchmark for methods with public pretrained weights that run easily for inference.

https://claude.ai/code/session_01LZahFhBSCiehXTESCYQ7wG

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions