scverse / scvi-tools

Deep probabilistic analysis of single-cell and spatial omics data
http://scvi-tools.org/
BSD 3-Clause "New" or "Revised" License
1.21k stars 344 forks source link

Weird message when training pyro model `this fit will run with no optimizer` #1057

Closed vitkl closed 3 years ago

vitkl commented 3 years ago

This warning is not expected. Would be good if you can catch this:

lib/python3.7/site-packages/pytorch_lightning/utilities/distributed.py:52: UserWarning: `LightningModule.configure_optimizers` returned `None`, this fit will run with no optimizer
  warnings.warn(*args, **kwargs)
adamgayoso commented 3 years ago

We can filter this warning. First we should reproduce the issue using one of the test cases in test_pyro.py and then add the filter here:

https://github.com/YosefLab/scvi-tools/blob/a9da914764d311ff18b4b557b78d9550a3b940af/scvi/train/_trainer.py#L143-L159

Though maybe we can also only filter it if it's a Pyro base module instance.

mjayasur commented 3 years ago

warning is replicated with test_pyro_bayesian_regression_jit

tests/models/test_pyro.py::test_pyro_bayesian_regression_jit /Users/mjayasur/venv3.8.5/lib/python3.8/site-packages/pytorch_lightning/utilities/distributed.py:50: UserWarning: LightningModule.configure_optimizers returned None, this fit will run with no optimizer warnings.warn(*args, **kwargs)