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

Feature/periodical validation callback #818

Merged

Conversation

ditwoo
Copy link
Contributor

@ditwoo ditwoo commented May 22, 2020

Before submitting

  • Was this discussed/approved via a Github issue? (no need for typos and docs improvements)
  • Did you read the contribution guide, Pull Request section?
  • Did you check the code style? catalyst-make-codestyle && catalyst-check-codestyle (pip install -U catalyst-codestyle).
  • Did you make sure to update the docs? We use Google format for all the methods and classes.
  • Did you check the docs with make check-docs?
  • Did you write any new necessary tests?
  • If you made a notable change (that affects users), did you update the CHANGELOG?

Description

Related Issue

Type of Change

  • Examples / docs / tutorials / contributors update
  • Bug fix (non-breaking change which fixes an issue)
  • Improvement (non-breaking change which improves an existing feature)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

PR review

Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.

You can use 'Login as guest' to see Teamcity build logs.

@ditwoo
Copy link
Contributor Author

ditwoo commented May 27, 2020

@Scitator what do you think about adding some message (or warning?) about missing loaders (specified in arguments but not presented in loaders dictionary) ?

Like:

Missing loaders - <missing loader 1>, <missing loader 2>, ... <missing loader N>

@Scitator
Copy link
Member

@ditwoo I am not sure, if we really need them. I think, the typical usage would be to periodically iterate over valid-like datasets only. That means, that typical usage would consist of only a subset of loader and I don't think we need a warning every epoch/stage during training.

@ditwoo ditwoo marked this pull request as ready for review May 28, 2020 09:49
@Scitator
Copy link
Member

@ditwoo could you please fix docs codestyle?

Comment on lines 14 to 16
.. note::
``'train'`` is a required loader and will
be ignored from passed loaders.
Copy link
Member

Choose a reason for hiding this comment

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

why do we need train loader?

Copy link
Contributor Author

@ditwoo ditwoo May 29, 2020

Choose a reason for hiding this comment

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

Hmm, I thought that train is the main training loader, something like valid loader used for collecting validation metrics.
But, seems like it is not required.

Copy link
Member

Choose a reason for hiding this comment

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

by catalyst design you can pass loaders with any names you want
we have quite simple logic for loaders naming :)
https://github.com/catalyst-team/catalyst/blob/master/catalyst/core/runner.py#L440#L448

Comment on lines 46 to 48
if not isinstance(loader, str) or not isinstance(
period, (int, float)
):
Copy link
Member

Choose a reason for hiding this comment

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

what do you think about assert here, to make sure, that all passed params are correct?
I think,it's better to raise an error, rather then silently "forget" about some loader :)

Copy link
Contributor Author

@ditwoo ditwoo May 29, 2020

Choose a reason for hiding this comment

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

Yep, seems correct.
What do you think about raising TypeError with some message instead of assert statement?

Copy link
Member

Choose a reason for hiding this comment

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

TypeError looks good 👍

Comment on lines 80 to 84
state.valid_loader = (
self.valid_loader
if self.valid_loader in epoch_loaders
else "train"
)
Copy link
Member

Choose a reason for hiding this comment

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

sorry, but we could not use train loader as valid one;
I suggest to remember valid_metrics from state and pass them for the epochs without valid_loader

Copy link
Member

Choose a reason for hiding this comment

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

oh, looks like it was required only as a trick around our requirement, that valid_loader in loaders....
in such case I suggest to use just the first key from loaders, rather than fix some name, like train

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, I'll update that and will add information about this behaviour to docs.

@pep8speaks
Copy link

pep8speaks commented May 30, 2020

Hello @ditwoo! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2020-05-31 10:01:13 UTC

Comment on lines 148 to 149
PeriodicLoaderRunnerCallback
""""""""""""""""""""""
Copy link
Member

Choose a reason for hiding this comment

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

could you fix docs codestyle?

PeriodicLoaderRunnerCallback
""""""""""""""""""""""""""""""""""

from catalyst.core import Callback, CallbackOrder, State


class PeriodicLoaderRunnerCallback(Callback):
Copy link
Member

Choose a reason for hiding this comment

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

is it possible to rename it to something without Runner (it could be misleading for users)
PeriodicLoaderRunCallback ? or just PeriodicLoaderCallback? what do you think about it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, I'll use PeriodicLoaderCallback

Copy link
Member

@Scitator Scitator left a comment

Choose a reason for hiding this comment

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

@Scitator Scitator merged commit 9a73e83 into catalyst-team:master May 31, 2020
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

3 participants