Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Draft PR] allow logging on_train_end #16013

Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ class _LogOptions(TypedDict):
"on_train_start": _LogOptions(
allowed_on_step=(False,), allowed_on_epoch=(True,), default_on_step=False, default_on_epoch=True
),
"on_train_end": None,
"on_train_end": _LogOptions(
allowed_on_step=(False,), allowed_on_epoch=(True,), default_on_step=False, default_on_epoch=True
),
"on_validation_start": _LogOptions(
allowed_on_step=(False,), allowed_on_epoch=(True,), default_on_step=False, default_on_epoch=True
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def test_fx_validator():
is_stage = "train" in func_name or "test" in func_name or "validation" in func_name
is_start = "start" in func_name or "batch" in func_name
is_epoch = "epoch" in func_name
on_step = is_stage and not is_start and not is_epoch
on_step = is_stage and not is_start and not is_epoch and func_name not in ["on_train_end"]
on_epoch = True
# creating allowed condition
allowed = (
Expand All @@ -124,7 +124,7 @@ def test_fx_validator():
allowed
and "pretrain" not in func_name
and "predict" not in func_name
and func_name not in ["on_train_end", "on_test_end", "on_validation_end"]
and func_name not in ["on_test_end", "on_validation_end"]
)
if allowed:
validator.check_logging_levels(fx_name=func_name, on_step=on_step, on_epoch=on_epoch)
Expand Down Expand Up @@ -198,7 +198,6 @@ def test_fx_validator_integration(tmpdir):
"transfer_batch_to_device": "You can't",
"on_after_batch_transfer": "You can't",
"on_validation_end": "You can't",
"on_train_end": "You can't",
"on_fit_end": "You can't",
"teardown": "You can't",
"on_sanity_check_start": "You can't",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def _make_assertion(model, hooks, result_mock, on_step, on_epoch, extra_kwargs):

hooks = [
"on_train_start",
"on_train_end",
"on_train_epoch_start",
"on_train_epoch_end",
"training_epoch_end",
Expand Down