When attempting to use TuneReportCheckpointCallback
with my Lightning trainer
, I get an error that seems to be due to a compatibility issue between Lightning
and pytorch_lightning
. Is this expected, and are there plans to fully support Lightning in Ray?
To work around the issue, I rewrote most of the ray.tune.integration.pytorch_lightning
module using Lightning imports instead.
Stack trace of one of the errors I’ve encountered when using TuneReportCheckpointCallback
with a Lightning.Trainer:
trainer = L.Trainer(
^^^^^^^^^^
File "/home/paperspace/miniconda3/envs/ncm/lib/python3.11/site-packages/lightning/pytorch/utilities/argparse.py", line 70, in insert_env_defaults
return fn(self, **kwargs)
^^^^^^^^^^^^^^^^^^
File "/home/paperspace/miniconda3/envs/ncm/lib/python3.11/site-packages/lightning/pytorch/trainer/trainer.py", line 430, in __init__
self._callback_connector.on_trainer_init(
File "/home/paperspace/miniconda3/envs/ncm/lib/python3.11/site-packages/lightning/pytorch/trainer/connectors/callback_connector.py", line 79, in on_trainer_init
_validate_callbacks_list(self.trainer.callbacks)
File "/home/paperspace/miniconda3/envs/ncm/lib/python3.11/site-packages/lightning/pytorch/trainer/connectors/callback_connector.py", line 227, in _validate_callbacks_list
stateful_callbacks = [cb for cb in callbacks if is_overridden("state_dict", instance=cb)]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/paperspace/miniconda3/envs/ncm/lib/python3.11/site-packages/lightning/pytorch/trainer/connectors/callback_connector.py", line 227, in <listcomp>
stateful_callbacks = [cb for cb in callbacks if is_overridden("state_dict", instance=cb)]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/paperspace/miniconda3/envs/ncm/lib/python3.11/site-packages/lightning/pytorch/utilities/model_helpers.py", line 42, in is_overridden
raise ValueError("Expected a parent")
ValueError: Expected a parent```