Update pytorch lightning import to work with Ray and other libraries. #2432
Labels
devops
CI/CD, packaging, code maintenance, ...
good first issue
Good for newcomers
improvement
New feature or improvement
Is your feature request related to a current problem? Please describe.
Importing and using
lightning.pytorch
andpytorch_lightning
in the same program causes conflicts. Ray has migrated their tuning toray.tune.Tuner
and is deprecatingray.tune.run
. Ray uses a conditional import, importingpytorch_lightning
only if the other is not available. However, it will importlightning.pytorch
first, where the dartspl_forecasting_module
imports pytorch_lightning. This may also apply to other places.Describe proposed solution
Darts should incorporate a conditional import that matches this priority in
pl_forecasting_module
,lr_finder
, etc as follows:Note that files may import more than just
pl
- those other imports could also be wrapped under the conditional.Describe potential alternatives
Change imports of pytorch_lightning to lightning.pytorch
Additional context
I noticed this issue when attempting to use
ray.tune.Tuner
andray.train.torch.TorchTrainer
in conjunction withRNNModel
. I solved it by making the change in the proposed solution.The text was updated successfully, but these errors were encountered: