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

A bug when importing pytorch_forecasting #1479

Open
kkckk1110 opened this issue Dec 18, 2023 · 5 comments
Open

A bug when importing pytorch_forecasting #1479

kkckk1110 opened this issue Dec 18, 2023 · 5 comments

Comments

@kkckk1110
Copy link

  • PyTorch-Forecasting version: 1.0.0
  • Torch version: 2.1.2
  • Python version: 3.9.19
  • Operating System: Windows 64

Expected behavior

I executed code from pytorch_forecasting.models.temporal_fusion_transformer.tuning import optimize_hyperparameters
but have the following error:

TypeError Traceback (most recent call last)
Cell In[10], line 18
16 from pytorch_forecasting.data import GroupNormalizer
17 from pytorch_forecasting.metrics import MAE, MAPE,SMAPE, MAPE,PoissonLoss, QuantileLoss
---> 18 from pytorch_forecasting.models.temporal_fusion_transformer.tuning import optimize_hyperparameters
19 from pytorch_forecasting.data.examples import get_stallion_data
20 import datetime

File D:\Anaconda\envs\torch\lib\site-packages\pytorch_forecasting\models\temporal_fusion_transformer\tuning.py:29
25 optuna_logger = logging.getLogger("optuna")
28 # need to inherit from callback for this to work
---> 29 class PyTorchLightningPruningCallbackAdjusted(pl.Callback, PyTorchLightningPruningCallback):
30 pass
33 def optimize_hyperparameters(
34 train_dataloaders: DataLoader,
35 val_dataloaders: DataLoader,
(...)
52 **kwargs,
53 ) -> optuna.Study:

TypeError: Cannot create a consistent method resolution
order (MRO) for bases Callback, PyTorchLightningPruningCallback
del should be also included.

@ruuttt
Copy link

ruuttt commented Dec 22, 2023

For me it worked to downgrade to optuna version 3.4 and pytorch 2.0.1
pip install torch==2.0.1 pytorch-lightning==2.0.2 pytorch_forecasting==1.0.0 torchaudio==2.0.2 torchdata==0.6.1 torchtext==0.15.2 torchvision==0.15.2 optuna==3.4

@flight505
Copy link

same issue, optuna version 3.5, pytorch 2.2 and pytorch_forecasting==1.0.0
hope to see it resolved

@Superzero31
Copy link

same issue with:
optuna==3.5
pytorch-lightning==2.2.1
pytorch_forecasting==1.0.0

@tty666
Copy link

tty666 commented Mar 21, 2024

I agree I have the same issue here with :

torch 2.2.1
optuna 3.6.0
pytorch-lightning 2.2.1
pytorch-forecasting 1.0.0

@Xinyu-Wu-0000
Copy link

also see #1468

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants