Views
No views yet
input [batch, num_cells, 18301 genes]
→ MLP cell embedder → [batch, num_cells, 512]
→ Attention aggregator → [batch, 512]
→ Dropout + Linear head → [batch, 10 classes]oncological, immune_inflammatory, neurological, metabolic_vascular,
gastrointestinal, respiratory, epithelial_barrier, sensory_specialized,
healthy_control, other.train.py. Download them all
(or clone the repo) and install dependencies:pip install -r requirements.txtwandb is optional and only needed when training with --wandb_project.Tip:train.pyuses multiple workers for data loading. A machine with at least 8 CPU cores is recommended for good throughput — set--num_workersto match your core count.
1import torch
2from transformers import AutoModel
3
4model = AutoModel.from_pretrained(
5 "ConvergeBio/virtual-cell-patient",
6 trust_remote_code=True,
7).eval()
8
9x = torch.randn(1, 500, 18_301) # [batch, num_cells, num_genes]
10with torch.no_grad():
11 out = model(input_ids=x)
12
13print(out.logits.shape) # [1, 10]
14print(out.logits.softmax(-1))1from datasets import load_dataset
2import torch
3from transformers import AutoModel
4
5ds = load_dataset("ConvergeBio/virtual-cell-patient-example", split="validation")
6
7model = AutoModel.from_pretrained(
8 "ConvergeBio/virtual-cell-patient",
9 trust_remote_code=True,
10).eval()
11
12sample = torch.tensor(ds[0]["input_ids"]).unsqueeze(0) # [1, 500, 18_301]
13with torch.no_grad():
14 out = model(input_ids=sample)
15
16print(out.logits.softmax(-1))Note:ConvergeBio/virtual-cell-patient-exampleis a minimal sample dataset intended only to verify the data format and run a quick end-to-end check. It contains a small number of patients and is not representative of a real training or evaluation distribution. Metrics produced from inference or training on this dataset should not be interpreted.
train.py expects a HuggingFace dataset with train (and optionally validation)
splits. Each row represents one cell sample for a patient, with the following
required columns:| Column | Shape | Type | Description |
|---|---|---|---|
input_ids | [500, 18301] | float32 | Log-normalized gene expression matrix, aligned to gene_names.txt |
attention_mask | [500] | bool | Cell mask (all ones for fixed cell count) |
labels | scalar | int | Class index |
entity_id | scalar | int | Patient identifier — groups augmented views of the same patient |
entity_id. At inference, the model averages softmax probabilities across views
for a more robust prediction. A factor of 5 augmentations per patient is a good
default.1python train.py \
2 --dataset_path <your_dataset> \
3 --num_classes 2 \
4 --freeze_embedder \
5 --output_dir ./my_binary_model--freeze_embedder keeps the pretrained cell embedder frozen and only trains
the new head — recommended when your dataset is small.1python train.py \
2 --dataset_path <your_dataset> \
3 --num_classes <N> \
4 --output_dir ./my_finetuned_model \
5 --num_train_epochs 15 \
6 --learning_rate 1e-41python train.py \
2 --dataset_path <your_dataset> \
3 --from_scratch \
4 --output_dir ./my_scratch_model| File | Description |
|---|---|
modeling_virtual_cell.py | Full model implementation |
config.json | Architecture config |
gene_names.txt | Ordered list of 18,301 HGNC gene symbols |
train.py | Fine-tuning / training script |
requirements.txt | Python dependencies |
model.safetensors | Pretrained weights |
1@article{convergecell2026,
2 author = {ConvergeBio},
3 title = {ConvergeCELL: An end-to-end platform from patient transcriptomics to therapeutic hypotheses},
4 year = {2026},
5 note = {Preprint available on bioRxiv},
6}1@article{liu2026pascient,
2 author = {Liu, T. and De Brouwer, E. and Verma, A. and Missarova, A. and
3 Kuo, T. and others},
4 title = {Learning multi-cellular representations of single-cell transcriptomics
5 data enables characterization of patient-level disease states},
6 journal = {Cell Systems},
7 volume = {17},
8 pages = {101570},
9 year = {2026},
10}