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

fix: loader, etc, etc #1174

Merged
merged 9 commits into from Apr 14, 2021
Merged

fix: loader, etc, etc #1174

merged 9 commits into from Apr 14, 2021

Conversation

Scitator
Copy link
Member

Before submitting (checklist)

  • Was this discussed/approved via a Github issue? (no need for typos and docs improvements)
  • Did you read the contribution guide?
  • 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?
  • Did you check that your code passes the unit tests pytest . ?
  • Did you add your new functionality to the docs?
  • Did you update the CHANGELOG?
  • Did you run colab minimal CI/CD with latest and minimal requirements?

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.

FAQ

Please review the FAQ before submitting an issue:

@pep8speaks
Copy link

pep8speaks commented Apr 12, 2021

Hello @Scitator! 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 2021-04-13 19:46:35 UTC

prefix: deprecated alias for ``metric_key``

Python example - loss is a weighted sum of cross entropy loss and binary cross entropy loss:

Choose a reason for hiding this comment

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

[pep8] reported by reviewdog 🐶
W293 blank line contains whitespace

bagxi
bagxi previously requested changes Apr 13, 2021
Comment on lines +214 to +219
def on_loader_start(self, runner):
super().on_loader_start(runner)
self.meters = {
key: metrics.AdditiveValueMetric(compute_on_call=False)
for key in ["loss", "accuracy01", "accuracy03"]
}
Copy link
Member

Choose a reason for hiding this comment

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

What about removing on_loader_start/on_loader_end methods? I think it can make the example a little bit simpler?

metrics: Union[str, List[str], Dict[str, float]] = None,
mode: Union[str, Callable] = "mean",
scope: str = "batch",
multiplier: float = 1.0,
prefix: str = None,
Copy link
Member

Choose a reason for hiding this comment

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

If prefix is depreciated maybe we should throw warning?

Comment on lines +8 to +14
def _nan_to_num(tensor, nan=0.0):
tensor = torch.where(torch.isnan(tensor), torch.ones_like(tensor) * nan, tensor)
return tensor


# nan_to_num is available in PyTorch only from 1.8.0 version
NAN_TO_NUM_FN = torch.__dict__.get("nan_to_num", _nan_to_num)
Copy link
Member

Choose a reason for hiding this comment

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

In my opinion it will be better to check version of pytorch directly

if torch.__version__ >= "1.8.0":
    from torch import nan_to_num
else:
    define nan_to_num (tensor, nan=0.0):
    tensor = torch.where(torch.isnan(tensor), torch.ones_like(tensor) * nan, tensor)
    return tensor

@mergify mergify bot dismissed bagxi’s stale review April 13, 2021 19:46

Pull request has been modified.

@Scitator
Copy link
Member Author

moving CI issues and deprecations to the next PR :)

@Scitator Scitator merged commit 461c6aa into master Apr 14, 2021
@mergify mergify bot deleted the extras/fixes branch April 14, 2021 05:24
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