# New in 0.9.0 (2021-03-03)

This release features our new software development kit for building new probabilistic models. Our hope is that others will be able to develop new models by importing scvi-tools into their own packages.

## Important changes

From the user perspective, there are two package-wide API breaking changes and one {class}`~scvi.model.SCANVI` specific breaking change enumerated below. From the method developer perspective, the entire model backend has been revamped using PyTorch Lightning, and no old code will be compatible with this and future versions. Also, we dropped support for Python 3.6.

### Breaking change: The `train` method

-   `n_epochs` is now `max_epochs` for consistency with PytorchLightning and to better relect the functionality of the parameter.
-   `use_cuda` is now `use_gpu` for consistency with PytorchLightning.
-   `frequency` is now `check_val_every_n_epoch` for consistency with PytorchLightning.
-   `train_fun_kwargs` and `kwargs` throughout the `train()` methods in the codebase have been removed and various arguments have been reorganized into `plan_kwargs` and `trainer_kwargs`. Generally speaking, `plan_kwargs` deal with model optimization like kl warmup, while `trainer_kwargs` deal with the actual training loop like early stopping.

### Breaking change: GPU handling

-   `use_cuda` was removed from the init of each model and was not replaced by `use_gpu`. By default every model is intialized on CPU but can be moved to a device via `model.to_device()`. If a model is trained with `use_gpu=True` the model will remain on the GPU after training.
-   When loading saved models, scvi-tools will always attempt to load the model on GPU unless otherwise specified.
-   We now support specifying which GPU device to use if there are multiple available GPUs.

### Breaking change: {class}`~scvi.model.SCANVI`

-   {class}`~scvi.model.SCANVI` no longer pretrains an {class}`~scvi.model.SCVI` model by default. This functionality however is preserved via the new {func}`~scvi.model.SCANVI.from_scvi_model` method.
-   `n_epochs_unsupervised` and `n_epochs_semisupervised` have been removed from `train`. It has been replaced with `max_epochs` for semisupervised training.
-   `n_samples_per_label` is a new argument which will subsample the number of labelled training examples to train on per label each epoch.

## New Model Implementations

-   {class}`~scvi.model.PEAKVI` implementation ([#877], [#921])
-   {class}`~scvi.external.SOLO` implementation ([#923], [#933])
-   {class}`~scvi.external.CellAssign` implementation ([#940])
-   {class}`~scvi.external.RNAStereoscope` and {class}`~scvi.external.SpatialStereoscope` implementation ([#889], [#959])
-   Pyro integration via {class}`~scvi.module.base.PyroBaseModuleClass` ([#895] [#903], [#927], [#931])

## Enhancements

-   {class}`~scvi.model.SCANVI` bug fixes ([#879])
-   {class}`~scvi.external.GIMVI` moved to external api ([#885])
-   {class}`~scvi.model.TOTALVI`, {class}`~scvi.model.SCVI`, and {class}`~scvi.model.SCANVI` now support multiple covariates ([#886])
-   Added callback for saving the best state of a model ([#887])
-   Option to disable progress bar ([#905])
-   load() documentation improvements ([#913])
-   updated tutorials, guides, documentation ([#924], [#925], [#929], [#934], [#947], [#971])
-   track is now public ([#938])
-   {class}`~scvi.model.SCANVI` now logs classficiation loss ([#966])
-   get_likelihood_parameter() bug ([#967])
-   model.history are now pandas DataFrames ([#949])

## Contributors

-   [@adamgayoso]
-   [@galenxing]
-   [@romain-lopez]
-   [@wukathy]
-   [@giovp]
-   [@njbernstein]
-   [@saketkc]

[#877]: https://github.com/YosefLab/scvi-tools/pull/887
[#879]: https://github.com/YosefLab/scvi-tools/pull/879
[#885]: https://github.com/YosefLab/scvi-tools/pull/885
[#886]: https://github.com/YosefLab/scvi-tools/pull/886
[#887]: https://github.com/YosefLab/scvi-tools/pull/887
[#889]: https://github.com/YosefLab/scvi-tools/pull/889
[#895]: https://github.com/YosefLab/scvi-tools/pull/895
[#903]: https://github.com/YosefLab/scvi-tools/pull/903
[#905]: https://github.com/YosefLab/scvi-tools/pull/905
[#913]: https://github.com/YosefLab/scvi-tools/pull/913
[#921]: https://github.com/YosefLab/scvi-tools/pull/921
[#923]: https://github.com/YosefLab/scvi-tools/pull/923
[#924]: https://github.com/YosefLab/scvi-tools/pull/924
[#925]: https://github.com/YosefLab/scvi-tools/pull/925
[#927]: https://github.com/YosefLab/scvi-tools/pull/927
[#929]: https://github.com/YosefLab/scvi-tools/pull/929
[#931]: https://github.com/YosefLab/scvi-tools/pull/931
[#933]: https://github.com/YosefLab/scvi-tools/pull/933
[#934]: https://github.com/YosefLab/scvi-tools/pull/934
[#938]: https://github.com/YosefLab/scvi-tools/pull/938
[#940]: https://github.com/YosefLab/scvi-tools/pull/940
[#947]: https://github.com/YosefLab/scvi-tools/pull/947
[#949]: https://github.com/YosefLab/scvi-tools/pull/949
[#959]: https://github.com/YosefLab/scvi-tools/pull/959
[#966]: https://github.com/YosefLab/scvi-tools/pull/966
[#967]: https://github.com/YosefLab/scvi-tools/pull/967
[#971]: https://github.com/YosefLab/scvi-tools/pull/971
[@adamgayoso]: https://github.com/adamgayoso
[@galenxing]: https://github.com/galenxing
[@giovp]: https://github.com/giovp
[@njbernstein]: https://github.com/njbernstein
[@romain-lopez]: https://github.com/romain-lopez
[@saketkc]: https://github.com/saketkc
[@wukathy]: https://github.com/wukathy
