pytorch-forecasting
pytorch-forecasting copied to clipboard
ValueError: Trainer is already configured with a `LearningRateFinder` callback.Please remove it if you want to use the Tuner.
When running the notebook "Demand forecasting with the temporal fusion transformer", I cannot run the learning rate optimization.
Notebook code is here at cell [8]: https://github.com/sktime/pytorch-forecasting/blob/main/docs/source/tutorials/stallion.ipynb
# find optimal learning rate
from lightning.pytorch.tuner import Tuner
res = Tuner(trainer).lr_find(
tft,
train_dataloaders=train_dataloader,
val_dataloaders=val_dataloader,
max_lr=10.0,
min_lr=1e-6,
)
print(f"suggested learning rate: {res.suggestion()}")
fig = res.plot(show=True, suggest=True)
fig.show()`
I get the folowing error: "ValueError: Trainer is already configured with a LearningRateFinder callback.Please remove it if you want to use the Tuner."
Same unresolved error was mentioned in this StackOverflow link : https://stackoverflow.com/questions/74574988/trainer-already-configured-error-google-tft-temporal-fusion-transformer
Hi @TristanPy ,
I ran the following code block. It seems to be running fine.
# find optimal learning rate
from lightning.pytorch.tuner import Tuner
res = Tuner(trainer).lr_find(
tft,
train_dataloaders=train_dataloader,
val_dataloaders=val_dataloader,
max_lr=10.0,
min_lr=1e-6,
)
print(f"suggested learning rate: {res.suggestion()}")
fig = res.plot(show=True, suggest=True)
fig.show()
Output