remove auto lr find since it's bugged

This commit is contained in:
hobogalaxy committed 2021-01-16 23:14:40 +01:00
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 progress_bar_refresh_rate: 10
weights_summary: null # null in yaml represents python None value weights_summary: null # null in yaml represents python None value
default_root_dir: "lightning_logs/" default_root_dir: "lightning_logs/"
auto_lr_find: False # "https://pytorch-lightning.readthedocs.io/en/stable/lr_finder.html"
+13 -11
View File
@@ -178,17 +178,19 @@ def show_init_info(model, datamodule, callbacks, loggers):
log.info(message) log.info(message)
def auto_find_lr(trainer, model, datamodule, loggers): # for some reason auto_lr_find crashes training
lr_finder = trainer.tuner.lr_find(model=model, datamodule=datamodule) # also there's no good way to update lr in wandb config after they it was set
new_lr = lr_finder.suggestion() # def auto_find_lr(trainer, model, datamodule, loggers):
# lr_finder = trainer.tuner.lr_find(model=model, datamodule=datamodule)
# Save lr plot # new_lr = lr_finder.suggestion()
fig = lr_finder.plot(suggest=True) #
fig.savefig("lr_loss_curve.jpg") # # Save lr plot
# fig = lr_finder.plot(suggest=True)
# Set new lr # fig.savefig("lr_loss_curve.jpg")
model.hparams.lr = new_lr #
log_hparams(loggers, {"lr": new_lr}) # # Set new lr
# model.hparams.lr = new_lr
# log_hparams(loggers, {"lr": new_lr})
def show_config(config: DictConfig): def show_config(config: DictConfig):
-4
View File
@@ -64,10 +64,6 @@ def train(config):
loggers=loggers 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 # Train the model
trainer.fit(model=model, datamodule=datamodule) trainer.fit(model=model, datamodule=datamodule)