Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[devops] Upgrade to lightning 2.0 #1514

Merged
merged 26 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
26cb5bd
relax torch to greater 2
ourownstory Jan 16, 2024
6cac2bb
upgrade lightning to 2.0, open version limits of other packages
ourownstory Jan 16, 2024
35133f5
upgrade to python3.11
ourownstory Jan 17, 2024
32146f7
re-relax python versions
ourownstory Jan 17, 2024
4176a75
merge main
ourownstory Jan 17, 2024
2fd30b1
merge py3.11
ourownstory Jan 17, 2024
329931a
merge main
ourownstory Jan 17, 2024
1222282
Merge branch 'main' into upgrade-lightning-2
ourownstory Jan 17, 2024
b059658
Merge branch 'main' into upgrade-lightning-2
ourownstory Jan 17, 2024
5e0428d
upgrade to lightning 2+
MaiBe-ctrl Jun 19, 2024
293755e
Merge branch 'main' into upgrade-lightning-2
MaiBe-ctrl Jun 19, 2024
65caa47
fix toml file
MaiBe-ctrl Jun 19, 2024
7f62f38
fic poetry
MaiBe-ctrl Jun 19, 2024
7cc25c9
added kaleido
MaiBe-ctrl Jun 19, 2024
7f71169
downgrade numpy
MaiBe-ctrl Jun 19, 2024
2b2a060
fix linting
MaiBe-ctrl Jun 20, 2024
2001d8d
added python 3.12
MaiBe-ctrl Jun 20, 2024
6ebb274
clean up pyproject.toml dependencies
ourownstory Jun 21, 2024
a0f921a
update poetry lock
ourownstory Jun 21, 2024
cadcc7b
Merge branch 'main' into upgrade-lightning-2
ourownstory Jun 21, 2024
64b4e17
changed is True
MaiBe-ctrl Jun 21, 2024
c4773e9
changed bool check
MaiBe-ctrl Jun 21, 2024
cfbe96e
Merge branch 'main' into upgrade-lightning-2
ourownstory Jun 21, 2024
891ba53
uncomment test_glocal lines 152 onward
ourownstory Jun 21, 2024
0be90e7
Merge branch 'main' into upgrade-lightning-2
ourownstory Jun 21, 2024
c4037b0
Merge branch 'main' into upgrade-lightning-2
ourownstory Jun 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions neuralprophet/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
import types
from collections import OrderedDict
from dataclasses import dataclass, field
from typing import Callable, Iterable, List, Optional
from typing import Callable, List, Optional
from typing import OrderedDict as OrderedDictType
from typing import Type, Union

import numpy as np
import pandas as pd
import torch

from neuralprophet import df_utils, np_types, utils, utils_torch
from neuralprophet import df_utils, np_types, utils_torch
from neuralprophet.custom_loss_metrics import PinballLoss
from neuralprophet.hdays_utils import get_holidays_from_country

Expand Down Expand Up @@ -306,17 +306,17 @@
self.trend_global_local = "global"

# If trend_local_reg < 0
if self.trend_local_reg < 0:

Check failure on line 309 in neuralprophet/configure.py

View workflow job for this annotation

GitHub Actions / pyright

Operator "<" not supported for "None" (reportOptionalOperand)
log.error("Invalid negative trend_local_reg '{}'. Set to False".format(self.trend_local_reg))
self.trend_local_reg = False

# If trend_local_reg = True
if self.trend_local_reg:
if self.trend_local_reg is True:
log.error("trend_local_reg = True. Default trend_local_reg value set to 1")
self.trend_local_reg = 1

# If Trend modelling is global.
if self.trend_global_local == "global" and self.trend_local_reg:
if self.trend_global_local == "global" and self.trend_local_reg is True:
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, your change was actually correct before:
if self.trend_global_local == "global" and self.trend_local_reg:

log.error("Trend modeling is '{}'. Setting the trend_local_reg to False".format(self.trend_global_local))
self.trend_local_reg = False

Expand Down Expand Up @@ -356,13 +356,13 @@
log.error("Invalid global_local mode '{}'. Set to 'global'".format(self.global_local))
self.global_local = "global"

self.periods = OrderedDict(

Check failure on line 359 in neuralprophet/configure.py

View workflow job for this annotation

GitHub Actions / pyright

No overloads for "__init__" match the provided arguments (reportCallIssue)
{

Check failure on line 360 in neuralprophet/configure.py

View workflow job for this annotation

GitHub Actions / pyright

Argument of type "dict[str, Season]" cannot be assigned to parameter "iterable" of type "Iterable[list[bytes]]" in function "__init__" (reportArgumentType)
"yearly": Season(
resolution=6,
period=365.25,
arg=self.yearly_arg,
global_local=(

Check failure on line 365 in neuralprophet/configure.py

View workflow job for this annotation

GitHub Actions / pyright

Argument of type "SeasonGlobalLocalMode | Literal['auto']" cannot be assigned to parameter "global_local" of type "SeasonGlobalLocalMode" in function "__init__" (reportArgumentType)
self.yearly_global_local
if self.yearly_global_local in ["global", "local"]
else self.global_local
Expand All @@ -373,7 +373,7 @@
resolution=3,
period=7,
arg=self.weekly_arg,
global_local=(

Check failure on line 376 in neuralprophet/configure.py

View workflow job for this annotation

GitHub Actions / pyright

Argument of type "SeasonGlobalLocalMode | Literal['auto']" cannot be assigned to parameter "global_local" of type "SeasonGlobalLocalMode" in function "__init__" (reportArgumentType)
self.weekly_global_local
if self.weekly_global_local in ["global", "local"]
else self.global_local
Expand All @@ -384,7 +384,7 @@
resolution=6,
period=1,
arg=self.daily_arg,
global_local=(

Check failure on line 387 in neuralprophet/configure.py

View workflow job for this annotation

GitHub Actions / pyright

Argument of type "SeasonGlobalLocalMode | Literal['auto']" cannot be assigned to parameter "global_local" of type "SeasonGlobalLocalMode" in function "__init__" (reportArgumentType)
self.daily_global_local if self.daily_global_local in ["global", "local"] else self.global_local
),
condition_name=None,
Expand All @@ -393,17 +393,17 @@
)

# If seasonality_local_reg < 0
if self.seasonality_local_reg < 0:

Check failure on line 396 in neuralprophet/configure.py

View workflow job for this annotation

GitHub Actions / pyright

Operator "<" not supported for "None" (reportOptionalOperand)
log.error("Invalid negative seasonality_local_reg '{}'. Set to False".format(self.seasonality_local_reg))
self.seasonality_local_reg = False

# If seasonality_local_reg = True
if self.seasonality_local_reg:
if self.seasonality_local_reg is True:
log.error("seasonality_local_reg = True. Default seasonality_local_reg value set to 1")
self.seasonality_local_reg = 1

# If Season modelling is global.
if self.global_local == "global" and self.seasonality_local_reg:
if self.global_local == "global" and self.seasonality_local_reg is True:
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, your change was actually correct before:
if self.global_local == "global" and self.seasonality_local_reg:

log.error(
"Seasonality modeling is '{}'. Setting the seasonality_local_reg to False".format(self.global_local)
)
Expand All @@ -414,7 +414,7 @@
resolution=resolution,
period=period,
arg=arg,
global_local=global_local if global_local in ["global", "local"] else self.global_local,

Check failure on line 417 in neuralprophet/configure.py

View workflow job for this annotation

GitHub Actions / pyright

Argument of type "str" cannot be assigned to parameter "global_local" of type "SeasonGlobalLocalMode" in function "__init__"   Type "str" is incompatible with type "SeasonGlobalLocalMode"     "str" is incompatible with type "Literal['global']"     "str" is incompatible with type "Literal['local']"     "str" is incompatible with type "Literal['glocal']" (reportArgumentType)
condition_name=condition_name,
)

Expand Down Expand Up @@ -490,7 +490,7 @@
regressors: OrderedDict = field(init=False) # contains RegressorConfig objects

def __post_init__(self):
self.regressors = None

Check failure on line 493 in neuralprophet/configure.py

View workflow job for this annotation

GitHub Actions / pyright

Cannot assign to attribute "regressors" for class "ConfigFutureRegressors*"   "None" is incompatible with "OrderedDict[Unknown, Unknown]" (reportAttributeAccessIssue)


@dataclass
Expand Down
3 changes: 1 addition & 2 deletions neuralprophet/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
import os
import sys
from collections import OrderedDict
from typing import IO, TYPE_CHECKING, BinaryIO, Iterable, Optional, Union
from typing import IO, TYPE_CHECKING, BinaryIO, Optional, Union

import numpy as np
import pandas as pd
import pytorch_lightning as pl
import torch

from neuralprophet import utils_torch
from neuralprophet.hdays_utils import get_country_holidays
from neuralprophet.logger import ProgressBar

if TYPE_CHECKING:
Expand Down
Loading