Metadata-Version: 2.1
Name: cellarium-ml
Version: 0.0.7
Summary: Machine learning library for single-cell data analysis
Author-email: Yerdos Ordabayev <yordabay@broadinstitute.org>, Mehrtash Babadi <mehrtash@broadinstitute.org>
License: Copyright (c) 2023, Broad Institute
        
        Redistribution and use in source and binary forms, with or without
        modification, are permitted provided that the following conditions are met:
        
        1. Redistributions of source code must retain the above copyright notice, this
           list of conditions and the following disclaimer.
        
        2. Redistributions in binary form must reproduce the above copyright notice,
           this list of conditions and the following disclaimer in the documentation
           and/or other materials provided with the distribution.
        
        3. Neither the name of the copyright holder nor the names of its
           contributors may be used to endorse or promote products derived from
           this software without specific prior written permission.
        
        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
        AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
        IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
        DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
        FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
        DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
        SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
        CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
        OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
        OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
        
Project-URL: Homepage, https://cellarium-ai.github.io/cellarium-ml
Project-URL: Source Code, https://github.com/cellarium-ai/cellarium-ml
Project-URL: Bug Tracker, https://github.com/cellarium-ai/cellarium-ml/issues
Project-URL: Discussion Forum, https://github.com/cellarium-ai/cellarium-ml/discussions
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.10
Description-Content-Type: text/x-rst
License-File: LICENSE.md
Requires-Dist: anndata
Requires-Dist: boltons
Requires-Dist: braceexpand
Requires-Dist: crick>=0.0.4
Requires-Dist: google-cloud-storage
Requires-Dist: jsonargparse[signatures]==4.27.7
Requires-Dist: lightning>=2.2.0
Requires-Dist: pyro-ppl
Requires-Dist: pytest
Requires-Dist: torch>=2.2.0
Requires-Dist: transformers
Provides-Extra: lint
Requires-Dist: ruff; extra == "lint"
Provides-Extra: mypy
Requires-Dist: mypy; extra == "mypy"
Requires-Dist: types-PyYAML; extra == "mypy"
Provides-Extra: test
Requires-Dist: pytest-xdist; extra == "test"
Requires-Dist: tensorboard; extra == "test"
Requires-Dist: torchvision; extra == "test"
Provides-Extra: docs
Requires-Dist: nbsphinx; extra == "docs"
Requires-Dist: Pillow; extra == "docs"
Requires-Dist: seaborn>=0.13.0; extra == "docs"
Requires-Dist: sphinx; extra == "docs"
Requires-Dist: sphinx_rtd_theme; extra == "docs"
Requires-Dist: sphinx-copybutton; extra == "docs"
Provides-Extra: dev
Requires-Dist: cellarium-ml[docs,lint,mypy,test]; extra == "dev"

*Cellarium ML: distributed single-cell data analysis.*

---------

Cellarium ML is a PyTorch Lightning-based library for distributed single-cell data analysis.
It provides a set of tools for training deep learning models on large-scale single-cell datasets,
including distributed data loading, model training, and evaluation. Cellarium ML is designed to be
modular and extensible, allowing users to easily define custom models, data transformations,
and training pipelines.

Code organization
-----------------

The code is organized as follows:

- ``cellarium/ml/callbacks``: Contains custom PyTorch Lightning callbacks.
- ``cellarium/ml/core``: Includes essential Cellarium ML components:
  - ``CellariumModule``: A PyTorch Lightning Module tasked with defining and configuring the model, training step, and optimizer.
  - ``CellariumAnnDataDataModule``: A PyTorch Lightning DataModule designed for setting up a multi-GPU DataLoader for a collection of AnnData objects.
  - ``CellariumPipeline``: A Module List that pipes the input data through a series of transforms and a model.
- ``cellarium/ml/data``: Contains Distributed AnnData Collection and multi-GPU Iterable Dataset implementations.
- ``cellarium/ml/lr_schedulers``: Contains custom learning rate schedulers.
- ``cellarium/ml/models``: Features Cellarium ML models:
  - Models must subclass ``CellariumModel`` and implement the ``.reset_parameters`` method.
  - The ``.forward`` method should return a dictionary containing the computed loss under the ``loss`` key.
  - Optionally, hooks such as ``.on_train_start``, ``.on_epoch_end``, and ``.on_batch_end`` can be implemented to be triggered by the ``CellariumModule`` during training phases.
- ``cellarium/ml/preprocessing``: Provides pre-processing functions.
- ``cellarium/ml/transforms``: Contains data transformation modules:
  - Each transform is a subclass of ``torch.nn.Module``.
  - The ``.forward`` method should output a dictionary where the keys correspond to the input arguments of subsequent transforms and the model.
- ``cellarium/ml/utilities``: Contains utility functions for various submodules.
- ``cellarium/ml/cli.py``: Implements the ``cellarium-ml`` CLI. Models must be registered here to be accessible via the CLI.

Installation
------------

To install from the pip::

   $ pip install cellarium-ml

To install the developer version from the source::

   $ git clone https://github.com/cellarium-ai/cellarium-ml.git
   $ cd cellarium-ml
   $ make install               # runs pip install -e .[dev]

For developers
--------------

To run the tests::

   $ make test                  # runs single-device tests
   $ TEST_DEVICES=2 make test   # runs multi-device tests

To automatically format the code::

   $ 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


