Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

STYLE: Fix lightning deprecation warnings #843

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion InnerEye/ML/lightning_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,5 +395,5 @@ def write_loss(self, is_training: bool, loss: torch.Tensor) -> None:
assert isinstance(self.trainer, Trainer)
self.log_on_epoch(MetricType.LOSS, loss, is_training)
if is_training:
learning_rate = self.trainer.lr_schedulers[0]['scheduler'].get_last_lr()[0]
learning_rate = self.trainer.lr_scheduler_configs[0].scheduler.get_last_lr()[0] # type: ignore
self.log_on_epoch(MetricType.LEARNING_RATE, learning_rate, is_training)
3 changes: 2 additions & 1 deletion InnerEye/ML/model_training.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,8 @@ def model_train(checkpoint_path: Optional[Path],
logging.info("Starting training")

trainer.fit(lightning_model, datamodule=data_module)
trainer.logger.close() # type: ignore
for logger in trainer.loggers:
logger.finalize("success")

world_size = getattr(trainer, "world_size", 0)
is_azureml_run = not is_offline_run_context(RUN_CONTEXT)
Expand Down