Skip to content

Commit

Permalink
Fix lightning import (#3018)
Browse files Browse the repository at this point in the history
  • Loading branch information
shchur authored Oct 18, 2023
1 parent e6f5663 commit 257bfc9
Show file tree
Hide file tree
Showing 15 changed files with 14 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ To train the model using PyTorch Lightning, we only need to extend the class wit


```python
import lightning.pytorch as pl
import pytorch_lightning as pl
```


Expand Down
2 changes: 0 additions & 2 deletions requirements/requirements-pytorch.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
torch>=1.9,<3
lightning>=1.8,<2.2
# Capping `lightning` does not cap `pytorch_lightning`, so we cap manually
pytorch_lightning>=1.8,<2.2
# Need to pin protobuf (for now)
# See: https://github.com/PyTorchLightning/pytorch-lightning/issues/13159
Expand Down
2 changes: 1 addition & 1 deletion src/gluonts/torch/model/d_linear/estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from typing import Optional, Iterable, Dict, Any

import torch
import lightning.pytorch as pl
import pytorch_lightning as pl

from gluonts.core.component import validated
from gluonts.dataset.common import Dataset
Expand Down
2 changes: 1 addition & 1 deletion src/gluonts/torch/model/d_linear/lightning_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# express or implied. See the License for the specific language governing
# permissions and limitations under the License.

import lightning.pytorch as pl
import pytorch_lightning as pl
import torch

from gluonts.core.component import validated
Expand Down
2 changes: 1 addition & 1 deletion src/gluonts/torch/model/deepar/lightning_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# express or implied. See the License for the specific language governing
# permissions and limitations under the License.

import lightning.pytorch as pl
import pytorch_lightning as pl
import torch
from torch.optim.lr_scheduler import ReduceLROnPlateau

Expand Down
2 changes: 1 addition & 1 deletion src/gluonts/torch/model/estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import logging

import numpy as np
import lightning.pytorch as pl
import pytorch_lightning as pl
import torch.nn as nn

from gluonts.core.component import validated
Expand Down
2 changes: 1 addition & 1 deletion src/gluonts/torch/model/lag_tst/estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from typing import Optional, Iterable, Dict, Any, List

import torch
import lightning.pytorch as pl
import pytorch_lightning as pl

from gluonts.core.component import validated
from gluonts.dataset.common import Dataset
Expand Down
2 changes: 1 addition & 1 deletion src/gluonts/torch/model/lag_tst/lightning_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# express or implied. See the License for the specific language governing
# permissions and limitations under the License.

import lightning.pytorch as pl
import pytorch_lightning as pl
import torch

from gluonts.core.component import validated
Expand Down
2 changes: 1 addition & 1 deletion src/gluonts/torch/model/lightning_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

from packaging import version

import lightning.pytorch as pl
import pytorch_lightning as pl


def has_validation_loop(trainer: pl.Trainer):
Expand Down
2 changes: 1 addition & 1 deletion src/gluonts/torch/model/mqf2/lightning_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

from typing import Dict

import lightning.pytorch as pl
import pytorch_lightning as pl
import torch
from torch.optim.lr_scheduler import ReduceLROnPlateau

Expand Down
2 changes: 1 addition & 1 deletion src/gluonts/torch/model/patch_tst/estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from typing import Optional, Iterable, Dict, Any

import torch
import lightning.pytorch as pl
import pytorch_lightning as pl

from gluonts.core.component import validated
from gluonts.dataset.common import Dataset
Expand Down
2 changes: 1 addition & 1 deletion src/gluonts/torch/model/patch_tst/lightning_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# express or implied. See the License for the specific language governing
# permissions and limitations under the License.

import lightning.pytorch as pl
import pytorch_lightning as pl
import torch

from gluonts.core.component import validated
Expand Down
2 changes: 1 addition & 1 deletion src/gluonts/torch/model/simple_feedforward/estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from typing import List, Optional, Iterable, Dict, Any

import torch
import lightning.pytorch as pl
import pytorch_lightning as pl

from gluonts.core.component import validated
from gluonts.dataset.common import Dataset
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# express or implied. See the License for the specific language governing
# permissions and limitations under the License.

import lightning.pytorch as pl
import pytorch_lightning as pl
import torch

from gluonts.core.component import validated
Expand Down
2 changes: 1 addition & 1 deletion src/gluonts/torch/model/tft/lightning_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# express or implied. See the License for the specific language governing
# permissions and limitations under the License.

import lightning.pytorch as pl
import pytorch_lightning as pl
import torch
from gluonts.core.component import validated
from gluonts.itertools import select
Expand Down

0 comments on commit 257bfc9

Please sign in to comment.