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

Logging additional metrics #448

Merged
merged 5 commits into from
Oct 10, 2023
Merged

Logging additional metrics #448

merged 5 commits into from
Oct 10, 2023

Conversation

prabhuteja12
Copy link
Contributor

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@github-actions
Copy link

github-actions bot commented Oct 6, 2023

Coverage report

Note

Coverage evolution disabled because this PR targets a different branch
than the default branch, for which coverage data is not available.

The coverage rate is 82.79%.

100% of new lines are covered.

Diff Coverage details (click to unfold)

src/renate/updaters/model_updater.py

100% of new lines are covered (95.58% of the complete file).

src/renate/utils/misc.py

100% of new lines are covered (100% of the complete file).

@prabhuteja12 prabhuteja12 marked this pull request as ready for review October 9, 2023 15:47
self._log(trainer=trainer, training=pl_module.training)
self._log(trainer=trainer, pl_module=pl_module)

def on_train_start(self, trainer: Trainer, pl_module: LightningModule) -> None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this called also for sanity_checking?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on_train_start()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It runs on on_validation_start, hence the special handling checking for None in the Additional metrics class.


def __call__(self, model: torch.nn.Module) -> Dict[str, Union[float, int]]:
if self._training_times:
epoch_training_time = self._training_times[-1] - self._training_times[0]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this the epoch_training_time? isn't this total training time?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modifying.

Comment on lines 48 to 52
def on_train_start(self) -> None:
self._training_times.append(time.time())

def on_train_epoch_end(self) -> None:
self._training_times.append(time.time())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of using a list, maybe simply save start and end time?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just wanted to keep the flexibility of retrieving all times, though the current interface doesn't
necessarily allow for it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unless we use it or plan to use it soon, we shouldn't sacrifice simplicity for flexibility. unless you strongly disagree, let's keep this simple.

@wistuba wistuba merged commit 8ef6d3e into dev Oct 10, 2023
18 checks passed
@wistuba wistuba deleted the pt_additional_logging branch October 10, 2023 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants