Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
martinkim0 authored Feb 20, 2024
2 parents a4b080e + fea055e commit a24ef28
Show file tree
Hide file tree
Showing 145 changed files with 1,094 additions and 2,060 deletions.
3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE/release_checklist.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ assignees: ""
- [ ] If patch release, backport version bump PR into the appropriate branch. Else, create a new branch off `main` with the appropriate rules
- [ ] Trigger a Docker image build in [`scvi-tools-docker`](https://github.com/YosefLab/scvi-tools-docker) targeting the release branch
- [ ] After image builds and pushes to the registry, run the [tutorials](https://github.com/scverse/scvi-tutorials) using the new image
- [ ] Publish a new release on the tutorials repo off `main` after all tutorials changes have been merged.
- [ ] Publish a new release on the tutorials repo off `main` after all tutorials changes have been merged
- [ ] Create a new branch off `main` in the main repo and run `git submodule update --remote`, and then merge the PR, with an appropriate backport as needed
- [ ] Create a new GitHub release targeting the release branch with the same body as the previous release
- [ ] Check that the version updates correctly on [PyPI](https://pypi.org/project/scvi-tools/)
- [ ] Build new Docker images with the `stable` and semantic versioning tags
- [ ] Check that the [feedstock repo](https://github.com/conda-forge/scvi-tools-feedstock) updates correctly
- [ ] (Optional) Post threads on Discourse and Twitter
4 changes: 3 additions & 1 deletion .github/workflows/test_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,6 @@ jobs:
run: |
coverage report
- name: Upload coverage
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
6 changes: 4 additions & 2 deletions .github/workflows/test_linux_cuda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
fail-fast: false
matrix:
python: ["3.11"]
cuda: ["11"]
cuda: ["11", "12"]

container:
image: scverse/scvi-tools:py${{ matrix.python }}-cu${{ matrix.cuda }}-base
Expand Down Expand Up @@ -61,4 +61,6 @@ jobs:
run: |
coverage report
- name: Upload coverage
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
4 changes: 3 additions & 1 deletion .github/workflows/test_linux_pre.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,6 @@ jobs:
run: |
coverage report
- name: Upload coverage
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
4 changes: 3 additions & 1 deletion .github/workflows/test_linux_private.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,6 @@ jobs:
run: |
coverage report
- name: Upload coverage
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
4 changes: 3 additions & 1 deletion .github/workflows/test_macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,6 @@ jobs:
run: |
coverage report
- name: Upload coverage
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
4 changes: 3 additions & 1 deletion .github/workflows/test_macos_m1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,6 @@ jobs:
run: |
coverage report
- name: Upload coverage
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
4 changes: 3 additions & 1 deletion .github/workflows/test_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,6 @@ jobs:
run: |
coverage report
- name: Upload coverage
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ repos:
# https://github.com/jupyterlab/jupyterlab/issues/12675
language_version: "17.9.1"
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.11
rev: v0.2.1
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down
1 change: 1 addition & 0 deletions docs/api/developer.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ Utility functions used by scvi-tools.
utils.track
utils.setup_anndata_dsp
utils.attrdict
model.get_max_epochs_heuristic
```

[ray tune]: https://docs.ray.io/en/latest/tune/index.html
113 changes: 60 additions & 53 deletions docs/release_notes/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,48 +7,52 @@ is available in the [commit logs](https://github.com/scverse/scvi-tools/commits/
[keep a changelog]: https://keepachangelog.com/en/1.0.0/
[semantic versioning]: https://semver.org/spec/v2.0.0.html

### 1.1.0 (2024-02-DD)
### 1.1.1 (unreleased)

#### Fixed

- Correctly apply non-default user parameters in {class}`scvi.external.POISSONVI` {pr}`2522`.

### 1.1.0 (2024-02-13)

#### Added

- Add {class}`scvi.external.ContrastiveVI` for contrastiveVI {pr}`2242`.
- Add {class}`scvi.dataloaders.BatchDistributedSampler` for distributed training {pr}`2102`.
- Add `additional_val_metrics` argument to {class}`scvi.train.Trainer`, allowing to
specify additional metrics to compute and log during the validation loop using
- Add `additional_val_metrics` argument to {class}`scvi.train.Trainer`, allowing to specify
additional metrics to compute and log during the validation loop using
{class}`scvi.train._callbacks.MetricsCallback` {pr}`2136`.
- Expose `accelerator` and `device` arguments in {meth}`scvi.hub.HubModel.load_model`
`pr`{2166}.
- Add `load_sparse_tensor` argument in {class}`scvi.data.AnnTorchDataset` for directly
loading SciPy CSR and CSC data structures to their PyTorch counterparts, leading to
faster data loading depending on the sparsity of the data {pr}`2158`.
- Add per-group LFC information to the
{meth}`scvi.criticism.PosteriorPredictiveCheck.differential_expression`
method {pr}`2173`. `metrics["diff_exp"]` is now a dictionary where the `summary`
stores the summary dataframe, and the `lfc_per_model_per_group` key stores the
per-group LFC.
- Expose `accelerator` and `device` arguments in {meth}`scvi.hub.HubModel.load_model` `pr`{2166}.
- Add `load_sparse_tensor` argument in {class}`scvi.data.AnnTorchDataset` for directly loading
SciPy CSR and CSC data structures to their PyTorch counterparts, leading to faster data loading
depending on the sparsity of the data {pr}`2158`.
- Add per-group LFC information to
{meth}`scvi.criticism.PosteriorPredictiveCheck.differential_expression`. `metrics["diff_exp"]`
is now a dictionary where `summary` stores the summary dataframe, and `lfc_per_model_per_group`
stores the per-group LFC {pr}`2173`.
- Expose {meth}`torch.save` keyword arguments in {class}`scvi.model.base.BaseModelClass.save`
and {class}`scvi.external.GIMVI.save` {pr}`2200`.
- Add `model_kwargs` and `train_kwargs` arguments to {meth}`scvi.autotune.ModelTuner.fit`
{pr}`2203`.
- Add `datasplitter_kwargs` to model `train` methods {pr}`2204`.
- Add `use_posterior_mean` argument to {meth}`scvi.model.SCANVI.predict` for
stochastic prediction of celltype labels {pr}`2224`.
- Add `use_posterior_mean` argument to {meth}`scvi.model.SCANVI.predict` for stochastic prediction
of celltype labels {pr}`2224`.
- Add support for Python 3.10+ type annotations in {class}`scvi.autotune.ModelTuner` {pr}`2239`.
- Add option to log device statistics in {meth}`scvi.autotune.ModelTuner.fit`
with argument `monitor_device_stats` {pr}`2260`.
- Add option to pass in a random seed to {meth}`scvi.autotune.ModelTuner.fit`
with argument `seed` {pr}`2260`.
- Automatically log the learning rate when `reduce_lr_on_plateau=True` in
training plans {pr}`2280`.
- Add option to log device statistics in {meth}`scvi.autotune.ModelTuner.fit` with argument
`monitor_device_stats` {pr}`2260`.
- Add option to pass in a random seed to {meth}`scvi.autotune.ModelTuner.fit` with argument `seed`
{pr}`2260`.
- Automatically log the learning rate when `reduce_lr_on_plateau=True` in training plans
{pr}`2280`.
- Add {class}`scvi.external.POISSONVI` to model scATAC-seq fragment counts with a Poisson
distribution {pr}`2249`
- {class}`scvi.train.SemiSupervisedTrainingPlan` now logs the classifier
calibration error {pr}`2299`.
- Passing `enable_checkpointing=True` into `train` methods is now
compatible with our model saves. Additional options can be specified
by initializing with {class}`scvi.train.SaveCheckpoint` {pr}`2317`.
- {attr}`scvi.settings.dl_num_workers` is now correctly applied as the default
`num_workers` in {class}`scvi.dataloaders.AnnDataLoader` {pr}`2322`.
- {class}`scvi.train.SemiSupervisedTrainingPlan` now logs the classifier calibration error
{pr}`2299`.
- Passing `enable_checkpointing=True` into `train` methods is now compatible with our model saves.
Additional options can be specified by initializing with {class}`scvi.train.SaveCheckpoint`
{pr}`2317`.
- {attr}`scvi.settings.dl_num_workers` is now correctly applied as the default `num_workers` in
{class}`scvi.dataloaders.AnnDataLoader` {pr}`2322`.
- Passing in `indices` to {class}`scvi.criticism.PosteriorPredictiveCheck` allows for running
metrics on a subset of the data {pr}`2361`.
- Add `seed` argument to {func}`scvi.model.utils.mde` for reproducibility {pr}`2373`.
Expand All @@ -59,16 +63,20 @@ is available in the [commit logs](https://github.com/scverse/scvi-tools/commits/
{meth}`scvi.hub.HubModel.pull_from_s3` and {meth}`scvi.hub.HubModel.push_to_s3` {pr}`2378`.
- Add clearer error message for {func}`scvi.data.poisson_gene_selection` when input data does not
contain raw counts {pr}`2422`.
- Add API for using custom dataloaders with {class}`scvi.model.SCVI` by making `adata` argument
optional on initialization and adding optional argument `data_module` to
{meth}`scvi.model.base.UnsupervisedTrainingMixin.train` {pr}`2467`.
- Add support for Ray 2.8-2.9 in {class}`scvi.autotune.ModelTuner` {pr}`2478`.

#### Fixed

- Fix bug where `n_hidden` was not being passed into {class}`scvi.nn.Encoder`
in {class}`scvi.model.AmortizedLDA` {pr}`2229`
- Fix bug in {class}`scvi.module.SCANVAE` where classifier probabilities
were interpreted as logits. This is backwards compatible as loading older
models will use the old code path {pr}`2301`.
- Fix bug in {class}`scvi.external.GIMVI` where `batch_size` was not
properly used in inference methods {pr}`2366`.
- Fix bug where `n_hidden` was not being passed into {class}`scvi.nn.Encoder` in
{class}`scvi.model.AmortizedLDA` {pr}`2229`
- Fix bug in {class}`scvi.module.SCANVAE` where classifier probabilities were interpreted as
logits. This is backwards compatible as loading older models will use the old code path
{pr}`2301`.
- Fix bug in {class}`scvi.external.GIMVI` where `batch_size` was not properly used in inference
methods {pr}`2366`.
- Fix error message formatting in {meth}`scvi.data.fields.LayerField.transfer_field` {pr}`2368`.
- Fix ambiguous error raised in {meth}`scvi.distributions.NegativeBinomial.log_prob` and
{meth}`scvi.distributions.ZeroInflatedNegativeBinomial.log_prob` when `scale` not passed in
Expand All @@ -80,34 +88,33 @@ is available in the [commit logs](https://github.com/scverse/scvi-tools/commits/

#### Changed

- Replace `sparse` with `sparse_format` argument in {meth}`scvi.data.synthetic_iid`
for increased flexibility over dataset format {pr}`2163`.
- Add per-group LFC information to the
{meth}`scvi.criticism.PosteriorPredictiveCheck.differential_expression`
method {pr}`2173`. `metrics["diff_exp"]` is now a dictionary where the `summary`
stores the summary dataframe, and the `lfc_per_model_per_group` key stores the
per-group LFC.
- Revalidate `devices` when automatically switching from MPS to CPU
accelerator in {func}`scvi.model._utils.parse_device_args` {pr}`2247`.
- Refactor {class}`scvi.data.AnnTorchDataset`, now loads continuous data as
{class}`numpy.float32` and categorical data as {class}`numpy.int64` by
default {pr}`2250`.
- Replace `sparse` with `sparse_format` argument in {meth}`scvi.data.synthetic_iid` for increased
flexibility over dataset format {pr}`2163`.
- Revalidate `devices` when automatically switching from MPS to CPU accelerator in
{func}`scvi.model._utils.parse_device_args` {pr}`2247`.
- Refactor {class}`scvi.data.AnnTorchDataset`, now loads continuous data as {class}`numpy.float32`
and categorical data as {class}`numpy.int64` by default {pr}`2250`.
- Support fractional GPU usage in {class}`scvi.autotune.ModelTuner` `pr`{2252}.
- Tensorboard is now the default logger in {class}`scvi.autotune.ModelTuner`
`pr`{2260}.
- Match `momentum` and `epsilon` in {class}`scvi.module.JaxVAE` to the
default values in PyTorch {pr}`2309`.
- Tensorboard is now the default logger in {class}`scvi.autotune.ModelTuner` `pr`{2260}.
- Match `momentum` and `epsilon` in {class}`scvi.module.JaxVAE` to the default values in PyTorch
{pr}`2309`.
- Change {class}`scvi.train.SemiSupervisedTrainingPlan` and
{class}`scvi.train.ClassifierTrainingPlan` accuracy and F1 score
computations to use `"micro"` reduction rather than `"macro"` {pr}`2339`.
- Internal refactoring of {meth}`scvi.module.VAE.sample` and
{meth}`scvi.model.base.RNASeqMixin.posterior_predictive_sample` {pr}`2377`.
- Change `xarray` and `sparse` from mandatory to optional dependencies {pr}`2480`.
- Use {class}`anndata.experimental.CSCDataset` and {class}`anndata.experimental.CSRDataset`
instead of the deprecated {class}`anndata._core.sparse_dataset.SparseDataset` for type checks
{pr}`2485`.
- Make `use_observed_lib_size` argument adjustable in {class}`scvi.module.LDVAE` `pr`{2494}.

#### Removed

- Remove deprecated `use_gpu argument in favor of PyTorch Lightning arguments
`accelerator`and`devices` {pr}`2114`.
- Remove deprecated `use_gpu` argument in favor of PyTorch Lightning arguments `accelerator` and
`devices` {pr}`2114`.
- Remove deprecated `scvi._compat.Literal` class {pr}`2115`.
- Remove chex dependency {pr}`2482`.

## Version 1.0

Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/notebooks
14 changes: 6 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ requires = ["hatchling"]

[project]
name = "scvi-tools"
version = "1.1.0"
version = "1.1.1"
description = "Deep probabilistic analysis of single-cell omics data."
readme = "README.md"
requires-python = ">=3.9"
Expand Down Expand Up @@ -33,14 +33,13 @@ classifiers = [
]
dependencies = [
"anndata>=0.7.5",
"chex<=0.1.8", # see https://github.com/scverse/scvi-tools/pull/2187
"docrep>=0.3.2",
"flax",
"jax>=0.4.4",
"jaxlib>=0.4.3",
"optax",
"numpy>=1.21.0",
"pandas>=1.0,!=2.1.2",
"pandas>=1.0",
"scipy",
"scikit-learn>=0.21.2",
"rich>=12.0.0",
Expand All @@ -54,8 +53,6 @@ dependencies = [
"numpyro>=0.12.1",
"ml-collections>=0.1.1",
"mudata>=0.1.2",
"sparse>=0.14.0",
"xarray>=2023.2.0",
]


Expand Down Expand Up @@ -91,20 +88,21 @@ docsbuild = ["scvi-tools[docs,optional]"] # docs build dependencies

autotune = [
"hyperopt>=0.2",
"ray[tune]>=2.5.0,<2.8.0",
"ray[tune]>=2.5.0,<2.10.0",
"ipython",
"scib-metrics>=0.4.1",
"tensorboard",
] # scvi.autotune
aws = ["boto3"] # scvi.hub.HubModel.pull_from_s3
census = ["cellxgene-census"] # scvi.data.cellxgene
criticism = ["sparse>=0.14.0", "xarray>=2023.2.0"] # scvi.criticism
hub = ["huggingface_hub"] # scvi.hub dependencies
pymde = ["pymde"] # scvi.model.utils.mde dependencies
regseq = ["biopython>=1.81", "genomepy"] # scvi.data.add_dna_sequence
loompy = ["loompy>=3.0.6"] # read loom
scanpy = ["scanpy>=1.6"] # scvi.criticism and read 10x
optional = [
"scvi-tools[autotune,aws,census,hub,loompy,pymde,regseq,scanpy]"
"scvi-tools[autotune,aws,criticism,hub,loompy,pymde,regseq,scanpy]"
] # all optional user functionality

tutorials = [
Expand Down Expand Up @@ -140,7 +138,7 @@ xfail_strict = true

[tool.ruff]
src = ["."]
line-length = 89
line-length = 99
indent-width = 4
target-version = "py39"

Expand Down
2 changes: 1 addition & 1 deletion scvi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from ._settings import settings

# this import needs to come after prior imports to prevent circular import
from . import data, model, external, utils, criticism
from . import data, model, external, utils

from importlib.metadata import version

Expand Down
4 changes: 1 addition & 3 deletions scvi/_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,7 @@ def verbosity(self, level: Union[str, int]):
console = Console(force_terminal=True)
if console.is_jupyter is True:
console.is_jupyter = False
ch = RichHandler(
level=level, show_path=False, console=console, show_time=False
)
ch = RichHandler(level=level, show_path=False, console=console, show_time=False)
formatter = logging.Formatter("%(message)s")
ch.setFormatter(formatter)
scvi_logger.addHandler(ch)
Expand Down
Loading

0 comments on commit a24ef28

Please sign in to comment.