Skip to content

Commit

Permalink
Replace deprecated method trainer.disable_validation() (#5075)
Browse files Browse the repository at this point in the history
Signed-off-by: Liang Zhang <liang.zhang@databricks.com>
  • Loading branch information
liangz1 committed Nov 17, 2021
1 parent 5ad33e0 commit 7b4ab0e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion mlflow/pytorch/_pytorch_autolog.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def on_train_epoch_end(
# If validation loop is enabled (meaning `validation_step` is overridden),
# log metrics in `on_validaion_epoch_end` to avoid logging the same metrics
# records twice
if trainer.disable_validation:
if not trainer.enable_validation:
self._log_metrics(trainer, pl_module)

@rank_zero_only
Expand Down
2 changes: 1 addition & 1 deletion tests/pytorch/test_pytorch_autolog.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def test_pytorch_autolog_logs_expected_data(pytorch_model):

def test_pytorch_autolog_logs_expected_metrics_without_validation(pytorch_model_without_validation):
trainer, run = pytorch_model_without_validation
assert trainer.disable_validation
assert not trainer.enable_validation

client = mlflow.tracking.MlflowClient()
for metric_key in ["loss", "train_acc"]:
Expand Down

0 comments on commit 7b4ab0e

Please sign in to comment.