pytorch-forecasting icon indicating copy to clipboard operation
pytorch-forecasting copied to clipboard

A bug when importing pytorch_forecasting

Open kkckk1110 opened this issue 1 year ago • 5 comments

  • 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.

kkckk1110 avatar Dec 18 '23 09:12 kkckk1110

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

ruuttt avatar Dec 22 '23 14:12 ruuttt

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

flight505 avatar Feb 04 '24 16:02 flight505

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

Superzero31 avatar Mar 10 '24 15:03 Superzero31

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

tty666 avatar Mar 21 '24 15:03 tty666

also see https://github.com/jdb78/pytorch-forecasting/issues/1468

XinyuWuu avatar Mar 27 '24 02:03 XinyuWuu