Views
No views yet
1from tahoe_x1.model import ComposerTX
2import scanpy as sc
3
4# Load model from Hugging Face in a single line
5# Options: "70m", "1b", or "3b"
6model, vocab, model_cfg, collator_cfg = ComposerTX.from_hf(
7 repo_id="tahoebio/Tahoe-x1",
8 model_size="3b"
9)
10
11# Load your single-cell data
12adata = sc.read_h5ad("your_data.h5ad")
13
14# Generate embeddings (see tutorials for full example)
15# Cell embeddings are stored in adata.obsmtahoex package from GitHub:1# Clone the repository
2git clone https://github.com/tahoebio/tahoe-x1
3cd tahoe-x1
4
5# Install using Docker (recommended) or uv
6# See installation guide: https://github.com/tahoebio/tahoe-x1#installationuv or pip for dependency management.ComposerTX.from_hf(). Training data is hosted publicly on S3 (s3://tahoe-hackathon-data) and will be downloaded as needed.| Tutorial | Description | Link |
|---|---|---|
| Clustering Tutorial | Cell clustering and UMAP visualization with Tahoe-x1 embeddings | clustering_tutorial.ipynb |
| Training Tutorial | Step-by-step guide to training and fine-tuning Tahoe-x1 models | training_tutorial.ipynb |
scripts/inference/configs/predict.yaml in the GitHub repo):1# Key configuration options:
2# - paths.hf_repo_id: Hugging Face repository (tahoebio/Tahoe-x1)
3# - paths.hf_model_size: model size (70m, 1b, or 3b)
4# - paths.adata_output: where to save AnnData output including embeddings
5# - predict.return_gene_embeddings: True (for extracting gene embeddings)1python scripts/inference/predict_embeddings.py path/to/config.yaml
2
3# Optional: override config values via command line
4python scripts/inference/predict_embeddings.py path/to/config.yaml \
5 --paths.model_name=tx --batch_size=1281from tahoex.tasks import get_batch_embeddings
2
3cell_embs, gene_embs = get_batch_embeddings(
4 adata=adata,
5 model=model,
6 vocab=vocab,
7 model_cfg=model_cfg,
8 collator_cfg=collator_cfg,
9 return_gene_embeddings=True
10)adata.obsm and gene embeddings to adata.varm (if return_gene_embeddings=True).1# Use the test configuration to train a small model on Tahoe-100M
2composer scripts/train.py -f configs/test_config.yaml
3
4# Fine-tune from a pretrained checkpoint
5composer scripts/train.py -f configs/finetune_config.yaml \
6 --load_path s3://tahoe-hackathon-data/MFM/ckpts/3b/1@article{gandhi2025tahoe,
2 title = {Tahoe-x1: Scaling Perturbation-Trained Single-Cell Foundation Models to 3 Billion Parameters},
3 author = {Gandhi, Shreshth and Javadi, Farnoosh and Svensson, Valentine and Khan, Umair and Jones, Matthew G. and Yu, Johnny and Merico, Daniele and Goodarzi, Hani and Alidoust, Nima},
4 journal = {bioRxiv},
5 year = {2025},
6 doi = {10.1101/2025.10.23.683759},
7 url = {https://www.biorxiv.org/content/10.1101/2025.10.23.683759v1},
8 publisher = {Cold Spring Harbor Laboratory}
9}