Migrate old pytorch-lightning
imports to modern lightning
imports
#9887
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #9811.
As the title says. PyTorch Lightning as been recommending a new import style (
import Lightning as L
rather thanimport pytorch_lightning as pl
) since early 2023 now.The old style was/is still supported for backwards compatibility, but both styles cannot be used at the same time (see here). Since PyG uses the old style, this means that projects using PyG are stuck with the old style. Most importantly, it can cause clashes when projects rely on other dependencies that use the modern import style (see #9811).
Therefore, I would suggest that PyG migrates to the new style, like other projects have done (e.g. Optuna here).
Since the task didn't seem to massive, I've migrated over all of the Lightning that I found across the project, and standardized the import styles between examples and tests (to use the style recommended in Lightning's own docs).