pytorch-forecasting: Type error when trying run trainer.fit with tft
- PyTorch-Forecasting version: 1.0
- PyTorch version: 2.0
- Python version:
- Operating System: running on google colab
Expected behavior
I executed code trainer.fit. It used to work and now I get a type error.
Actual behavior
I think it has to do with the april 10 release of pytorch-forecasting moving to pytorch 2.0
Code to reproduce the problem
trainer.fit( tft, train_dataloaders=train_dataloader, val_dataloaders=val_dataloader )
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
[<ipython-input-57-127e7bdaac70>](https://localhost:8080/#) in <cell line: 1>()
----> 1 trainer.fit(
2 tft,
3 train_dataloaders=train_dataloader,
4 val_dataloaders=val_dataloader
5 )
1 frames
[/usr/local/lib/python3.9/dist-packages/pytorch_lightning/utilities/compile.py](https://localhost:8080/#) in _maybe_unwrap_optimized(model)
123 if isinstance(model, pl.LightningModule):
124 return model
--> 125 raise TypeError(
126 f"`model` must be a `LightningModule` or `torch._dynamo.OptimizedModule`, got `{type(model).__qualname__}`"
127 )
TypeError: `model` must be a `LightningModule` or `torch._dynamo.OptimizedModule`, got `TemporalFusionTransformer`
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.
About this issue
- Original URL
- State: open
- Created 4 years ago
- Comments: 16
I suggest you to perform the following changes:
Everything is up to date in the usage examples section: https://github.com/jdb78/pytorch-forecasting
I use the same version and there is the same problem
pytorch-forecasting==1.0.0 pytorch-lightning==2.0.1.post0 torch==2.0.0
TypeError:
modelmust be aLightningModuleortorch._dynamo.OptimizedModule, gotTemporalFusionTransformerHad the same issue but change pytorch_lighting to lightning.pytorch and resolved.
same problem!!!