-
-
Notifications
You must be signed in to change notification settings - Fork 391
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
fix: loader, etc, etc #1174
Conversation
prefix: deprecated alias for ``metric_key`` | ||
|
||
Python example - loss is a weighted sum of cross entropy loss and binary cross entropy loss: | ||
|
There was a problem hiding this comment.
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
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"] | ||
} |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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?
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) |
There was a problem hiding this comment.
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
moving CI issues and deprecations to the next PR :) |
Before submitting (checklist)
catalyst-make-codestyle && catalyst-check-codestyle
(pip install -U catalyst-codestyle
).make check-docs
?pytest .
?latest
andminimal
requirements?Description
Related Issue
Type of 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: