Cellarium ML: a machine learning framework for single-cell biology
Cellarium ML is a PyTorch Lightning-based library for distributed single-cell data analysis. It provides tools for training deep learning models on large-scale single-cell datasets, including distributed data loading, model training, and evaluation. Designed to be modular and extensible, Cellarium ML allows users to easily define custom models, data transformations, and training pipelines.
Code Organization
The code is organized as follows:
cellarium/
└── ml/
├── "callbacks" # Custom PyTorch Lightning callbacks
├── "core" # Essential components
│ ├── "CellariumModule" # PyTorch Lightning Module for model, training step, and optimizer
│ ├── "CellariumAnnDataDataModule" # DataModule for multi-GPU DataLoader for AnnData objects
│ └── "CellariumPipeline" # Pipeline for data transformations and model inference
├── "data" # Distributed AnnData Collection and multi-GPU Iterable Datasets
├── "lr_schedulers" # Custom learning rate schedulers
├── "models" # Cellarium ML models
├── "preprocessing" # Pre-processing functions
├── "transforms" # Data transformation modules
├── "utilities" # Utility functions for various submodules
└── "cli.py" # Implements the "cellarium-ml" CLI. Models must be registered here
Important Notes
cellarium/ml/models/*
Models must subclass CellariumModel and implement the following:
reset_parameters: Initializes model parameters.
forward: Returns a dictionary containing the computed loss under the loss key.
Optional hooks for training include:
on_train_start: Called at the start of training.
on_train_epoch_end: Triggered at the end of each epoch.
on_train_batch_end: Triggered at the end of each batch.
cellarium/ml/transforms/*
All transforms must subclass torch.nn.Module.
The forward method must output a dictionary where keys correspond to the input arguments for subsequent transforms or the model.
cellarium/ml/cli.py
Models must be registered here to be accessible via the command-line interface (cellarium-ml CLI).
Installation
To install via pip:
pip install cellarium-ml
To install the developer version from source:
git clone https://github.com/cellarium-ai/cellarium-ml.git
cd cellarium-ml
make install # runs pip install -e .[dev]
API Documentation and Tutorials
For detailed API documentation and tutorials, visit: Cellarium ML Documentation
For Developers
To run the tests:
make test-examples # runs single-device cli example tests
make test-dataloader # runs single-device dataloader related tests
TEST_DEVICES=2 make test-dataloader # runs multi-device dataloader related test
make test # runs single-device (all other) tests
TEST_DEVICES=2 make test # runs multi-device (all other) tests
To format the code automatically:
make format # runs ruff formatter and fixes linter errors
To run the linters:
make lint # runs ruff linter and checks for formatter errors
To build the documentation:
make docs # builds the documentation at docs/build/html
Metadata
Release files for cellarium-ml 0.0.14
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cellarium_ml-0.0.14.tar.gz | 246.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cellarium_ml-0.0.14-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 472.5 kB
Release files / cellarium_ml-0.0.14.tar.gz
| Download URL | cellarium_ml-0.0.14.tar.gz |
|---|---|
| Size | 246.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f40b071990ec97281425e5c813d7429b93cf0cae4696a379f1ac7b2fdd7f13fd
|
|
BLAKE2b-256 checksum How to use checksums |
31516819dca29cc2ed8426313a02e1ae1027a95f6ad50e557b83e4466a8f90aa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 6, 2026.
Transparency logRelease files / cellarium_ml-0.0.14-py3-none-any.whl
| Download URL | cellarium_ml-0.0.14-py3-none-any.whl |
|---|---|
| Size | 226.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f41bd65669277e5b75acba55aefeacec1e19d4a82cc0ed9df568251f4bcbfd4a
|
|
BLAKE2b-256 checksum How to use checksums |
021dc2309b4e0db300a38c77632566859838da209b2ee6a9b7840c4f3118e279
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 6, 2026.
Transparency log