remove auto lr find since it's bugged
This commit is contained in:
1 parent
c3c2796dfc
commit
506fe6312f
3 files changed
+13
-16
No files matched your search
@@ -10,4 +10,3 @@ args:
|
||||
progress_bar_refresh_rate: 10
|
||||
weights_summary: null # null in yaml represents python None value
|
||||
default_root_dir: "lightning_logs/"
|
||||
auto_lr_find: False # "https://pytorch-lightning.readthedocs.io/en/stable/lr_finder.html"
|
||||
@@ -178,17 +178,19 @@ def show_init_info(model, datamodule, callbacks, loggers):
|
||||
log.info(message)
|
||||
|
||||
|
||||
def auto_find_lr(trainer, model, datamodule, loggers):
|
||||
lr_finder = trainer.tuner.lr_find(model=model, datamodule=datamodule)
|
||||
new_lr = lr_finder.suggestion()
|
||||
|
||||
# Save lr plot
|
||||
fig = lr_finder.plot(suggest=True)
|
||||
fig.savefig("lr_loss_curve.jpg")
|
||||
|
||||
# Set new lr
|
||||
model.hparams.lr = new_lr
|
||||
log_hparams(loggers, {"lr": new_lr})
|
||||
# for some reason auto_lr_find crashes training
|
||||
# also there's no good way to update lr in wandb config after they it was set
|
||||
# def auto_find_lr(trainer, model, datamodule, loggers):
|
||||
# lr_finder = trainer.tuner.lr_find(model=model, datamodule=datamodule)
|
||||
# new_lr = lr_finder.suggestion()
|
||||
#
|
||||
# # Save lr plot
|
||||
# fig = lr_finder.plot(suggest=True)
|
||||
# fig.savefig("lr_loss_curve.jpg")
|
||||
#
|
||||
# # Set new lr
|
||||
# model.hparams.lr = new_lr
|
||||
# log_hparams(loggers, {"lr": new_lr})
|
||||
|
||||
|
||||
def show_config(config: DictConfig):
|
||||
|
||||
@@ -64,10 +64,6 @@ def train(config):
|
||||
loggers=loggers
|
||||
)
|
||||
|
||||
# Automatically find learning rate if specified in config
|
||||
if "auto_lr_find" in config["trainer"]["args"] and config["trainer"]["args"]["auto_lr_find"]:
|
||||
utils.auto_find_lr(trainer, model, datamodule, loggers)
|
||||
|
||||
# Train the model
|
||||
trainer.fit(model=model, datamodule=datamodule)
|
||||
|
||||
|
||||
Reference in new issue
Block a user