Downloads · 30 days
586
4% of all-time downloads
theislab/Nicheformer
Nicheformer is a machine learning model from theislab. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
Nicheformer is a transformer-based model designed for understanding and predicting cellular niches and their interactions. The model uses masked language modeling to learn representations of cellular contexts and thei…
Downloads · 30 days
586
4% of all-time downloads
All-time downloads
16.1K
Public
Parameters
49M
197 MB on disk
Likes
3
Public
Click a slice to open those files.
.safetensors196 MB · 99%
How the weights are stored.
F3249M · 100%
From the Hugging Face model README
Nicheformer is a transformer-based model designed for understanding and predicting cellular niches and their interactions. The model uses masked language modeling to learn representations of cellular contexts and their relationships.
Nicheformer is built on a transformer architecture with the following key features:
from transformers import AutoModelForMaskedLM, AutoTokenizer
import anndata as ad
# Load model and tokenizer
model = AutoModelForMaskedLM.from_pretrained("aletlvl/Nicheformer", trust_remote_code=True)
tokenizer = AutoTokenizer.from_pretrained("aletlvl/Nicheformer", trust_remote_code=True)
# Set technology mean for HF tokenizer
technology_mean_path = 'technology_mean.npy'
technology_mean = np.load(technology_mean_path)
tokenizer._load_technology_mean(technology_mean)
# Load your single-cell data
adata = ad.read_h5ad("your_data.h5ad")
# Tokenize the data
inputs = tokenizer(adata)
# Get embeddings
embeddings = model.get_embeddings(
input_ids=inputs["input_ids"],
attention_mask=inputs["attention_mask"],
layer=-1,
with_context=False
)
The model was trained on single-cell gene expression data from various tissues and organisms. It supports:
This model is released under the MIT License. See the LICENSE file for more details.
For questions and issues, please open an issue on the GitHub repository or contact the maintainers.
This is the official repository for Nicheformer: a foundation model for single-cell and spatial omics
If you use our tool or build upon our concepts in your own work, please cite it as
Schaar, A.C., Tejada-Lapuerta, A., et al. Nicheformer: a foundation model for single-cell and spatial omics. bioRxiv (2024). doi: https://doi.org/10.1101/2024.04.15.589472
For questions and help requests, you can reach out on GitHub or email to the corresponding author (alejandro.tejadalapuerta@helmholtz-munich.de).