sktime / pytorch-forecasting

Time series forecasting with PyTorch
https://pytorch-forecasting.readthedocs.io/
MIT License
3.89k stars 617 forks source link

Pytorch sample project not working #1014

Open daniwxcode opened 2 years ago

daniwxcode commented 2 years ago

Expected behavior

i'm trying to apply the sample tutorial code https://pytorch-forecasting.readthedocs.io/en/latest/tutorials/stallion.html I executed code bellow in order to Train model

Actual behavior

i got this error message init() got an unexpected keyword argument 'weights_summary'

Code to reproduce the problem

configure network and trainer

early_stop_callback = EarlyStopping(monitor="val_loss", min_delta=1e-4, patience=10, verbose=False, mode="min") lr_logger = LearningRateMonitor() # log the learning rate logger = TensorBoardLogger("lightning_logs") # logging results to a tensorboard

trainer = pl.Trainer( max_epochs=30, gpus=0, weights_summary="top", gradient_clip_val=0.1, limit_train_batches=30, # coment in for training, running valiation every 30 batches

fast_dev_run=True, # comment in to check that networkor dataset has no serious bugs

callbacks=[lr_logger, early_stop_callback],
logger=logger,

)

Paste the command(s) you ran and the output. Including a link to a colab notebook will speed up issue resolution. If there was a crash, please include the traceback here. The code used to initialize the TimeSeriesDataSet and model should be also included.

Sinnaeve commented 2 years ago

weights_summary argument seems depreciated https://pytorch-lightning.readthedocs.io/en/stable/common/trainer.html#weights-summary

BenjaminData commented 2 years ago

I’m running into the same error with 1.7.0. I’ve passed the enable_model_summary = False through the trainer.

      trainer = pl.Trainer(
          max_epochs=100,
          gpus=1,
          enable_model_summary = False,
          gradient_clip_val=0.01,
          callbacks=[lr_logger, early_stop_callback],
          logger=logger,
      )

But this still results in an init() got an unexpected keyword argument 'weights_summary' error. How do I go about fixing this?

Sinnaeve commented 2 years ago

I had the same issue (init() got an unexpected keyword argument 'weights_summary' error), I had to downgrade pytorch lightning from 1.7 to 1.6.4 (then it worked)

luzhangao commented 1 year ago

you can fix it by reinstalling pytorch-forecasting with pip instead of conda. The current version is v0.10.2 for conda-forge while it is v0.10.3 for pip.