Spatial transcriptomics foundation model
Project description
TERRA
Installation
To install the project and its dependencies, run:
pip install -e .
Repository Structure
-
main.py
The main entry point for the project, which supports running training and evaluation sweeps. It includes command-line arguments for customization and handles multi-GPU setups. -
configs/$DATASET.yaml
Configuration file that defines the dataset specific hyperparameters and settings used during the training process, such as model architecture, data handling, and optimization settings ($DATASETis the name of the dataset, e.g.merfish_300k). -
src/terra/models/gene_transformer.py
Contains the model definition for the gene transformer, implementing the core architecture that will be trained and evaluated. -
src/terra/train.py
Handles the training process in a distributed setting. This script contains the logic for executing the training loop and logging results. -
src/terra/infer.py
Manages the evaluation process. It evaluates the trained model on the specified tasks and logs the performance metrics. -
src/terra/utils/config.py
Includes helper functions to setup the model and batch size params. -
src/terra/utils/embedding.py
Provides utility functions for handling and loading embeddings required by the model during training and inference. -
src/terra/utils/evaluation.py
Includes helper functions to streamline the evaluation process, such as metrics calculations and data preparation. -
src/terra/datasets/cell_neighborhood_dataset.pyIncludes helper functions to create torch datasets for data loading. -
tests
Includes test cases for different functionalities.
Usage
Training
To start training with a single GPU, use the following command:
python -m pdb main.py --fname configs/$DATASET.yaml --devices cuda:0
where $DATASET is the name of the dataset, e.g. merfish_300k.
To start training with multiple GPUs, use the following command:
python -m pdb main.py --fname configs/$DATASET.yaml --devices cuda:0 cuda:1
To perform a sweep during training, use:
python -m pdb main.py --fname configs/$DATASET.yaml --devices cuda:0 --do_sweep
For multi-node training, first configure the required settings in your job_config file. Then, execute the following command:
bsub_mn_mg_yaml configs/job/hst_corpus_70m_test.yaml
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file terra_st-0.0.0.tar.gz.
File metadata
- Download URL: terra_st-0.0.0.tar.gz
- Upload date:
- Size: 2.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.1 {"installer":{"name":"uv","version":"0.11.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a5328c494692b6fda61a0c83391227f060f407b7bef200bbbb26e0f22df25e7
|
|
| MD5 |
ab4f1f0b6590cc06347603947adfab74
|
|
| BLAKE2b-256 |
19a463597804dde6c65a908ad255a835d36f6ada42690dd2e40e772552745be8
|
File details
Details for the file terra_st-0.0.0-py3-none-any.whl.
File metadata
- Download URL: terra_st-0.0.0-py3-none-any.whl
- Upload date:
- Size: 234.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.1 {"installer":{"name":"uv","version":"0.11.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc9dfcd88944aa2ebbc0fb4b07119f3ef6b30d64fa3b9ff9579472963cfe9b6f
|
|
| MD5 |
5f89722cbae3d32a4412356fb276ec7b
|
|
| BLAKE2b-256 |
fb78b7016190b05f44cb36a45619627bbc408d5a55899ff6e806330386c75ce8
|