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

Update to resolve CI warnings #2651

Merged
merged 18 commits into from
Aug 23, 2022
Merged

Update to resolve CI warnings #2651

merged 18 commits into from
Aug 23, 2022

Conversation

puhuk
Copy link
Contributor

@puhuk puhuk commented Aug 16, 2022

Fixes #2649

Description:
Update to resolve CI warnings
Will send soon to fix warnings in test_precision.py

Check list:

  • New tests are added (if a new feature is added)
  • New doc strings: description and/or example code are in RST format
  • Documentation is updated (if required)

To resolve issue pytorch#2649
Will send soon to fix warnings in `test_precision.py`
@github-actions github-actions bot added the module: metrics Metrics module label Aug 16, 2022
ignite/metrics/gan/utils.py Outdated Show resolved Hide resolved
tests/ignite/handlers/test_state_param_scheduler.py Outdated Show resolved Hide resolved
@puhuk
Copy link
Contributor Author

puhuk commented Aug 18, 2022

For warnings from tests/ignite/metrics/test_precision.py as I think those warnings are intended to warn.
In my thought, to fix those warnings, corner cases like (torch.zeros(size=(10,)), torch.randint(0, 2, size=(10,)), 1) should be deleted.
Is that correct? Or is there other methods to fix those warnings?

@vfdev-5
Copy link
Collaborator

vfdev-5 commented Aug 18, 2022

For warnings from tests/ignite/metrics/test_precision.py as I think those warnings are intended to warn.
In my thought, to fix those warnings, corner cases like (torch.zeros(size=(10,)), torch.randint(0, 2, size=(10,)), 1) should be deleted.

Can you point to the code what you are talking about ?

@puhuk
Copy link
Contributor Author

puhuk commented Aug 18, 2022

For warnings from tests/ignite/metrics/test_precision.py as I think those warnings are intended to warn.
In my thought, to fix those warnings, corner cases like (torch.zeros(size=(10,)), torch.randint(0, 2, size=(10,)), 1) should be deleted.

Can you point to the code what you are talking about ?

For this line, because it generates data with zeros,

(torch.zeros(size=(10,)), torch.randint(0, 2, size=(10,)), 1),

it occurs error with being set to zero in

assert precision_score(np_y, np_y_pred, average=sk_average_parameter) == pytest.approx(pr_compute)
.

When I add zero_divion=1 like this precision_score(np_y, np_y_pred, average=sk_average_parameter, zero_division=1), it occurs error when comparing computed metric and reference.

@vfdev-5
Copy link
Collaborator

vfdev-5 commented Aug 18, 2022

@puhuk here is the link on why this corner case was added : #2007
So, we need to keep this test case. Why you set zero_division=1, have you tried zero_division=0 ?

@puhuk
Copy link
Contributor Author

puhuk commented Aug 18, 2022

No, I didn't because document says the default value is warn and it acts as 0 in https://scikit-learn.org/stable/modules/generated/sklearn.metrics.precision_score.html
But when I set with zero_division=0, those warning fixed.

@vfdev-5
Copy link
Collaborator

vfdev-5 commented Aug 18, 2022

@puhuk please fix code formatting with https://github.com/pytorch/ignite/blob/master/CONTRIBUTING.md#formatting-code

bash ./tests/run_code_style.sh fmt

vfdev-5
vfdev-5 previously approved these changes Aug 19, 2022
Copy link
Collaborator

@vfdev-5 vfdev-5 left a comment

Choose a reason for hiding this comment

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

lgtm, thanks

@vfdev-5 vfdev-5 enabled auto-merge (squash) August 19, 2022 14:35
@vfdev-5 vfdev-5 disabled auto-merge August 19, 2022 14:38
@vfdev-5
Copy link
Collaborator

vfdev-5 commented Aug 19, 2022

@puhuk actually, there are still warnings:

  1. about model weights : https://github.com/pytorch/ignite/runs/7903177538?check_suite_focus=true#step:15:1850 and https://github.com/pytorch/ignite/runs/7903177538?check_suite_focus=true#step:15:1856
  2. "RuntimeWarning: y and y_pred should be of dtype long when entry type is binary and average!=False", https://github.com/pytorch/ignite/runs/7903177538?check_suite_focus=true#step:15:1844

Please fix them as well

@vfdev-5 vfdev-5 dismissed their stale review August 22, 2022 06:19

warning remains

@puhuk
Copy link
Contributor Author

puhuk commented Aug 23, 2022

Still some warings in https://github.com/pytorch/ignite/runs/7963618423?check_suite_focus=true#step:15:1826
Is it can be resolved in ignite?

@vfdev-5
Copy link
Collaborator

vfdev-5 commented Aug 23, 2022

Still some warings in https://github.com/pytorch/ignite/runs/7963618423?check_suite_focus=true#step:15:1826 Is it can be resolved in ignite?

No, these warnings are in installed packages, we can't do anything with them.

Copy link
Collaborator

@vfdev-5 vfdev-5 left a comment

Choose a reason for hiding this comment

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

Thanks @puhuk

@vfdev-5 vfdev-5 enabled auto-merge (squash) August 23, 2022 09:21
@vfdev-5 vfdev-5 merged commit 61fda5a into pytorch:master Aug 23, 2022
@@ -23,7 +24,13 @@ def __init__(self, return_features: bool, device: Union[str, torch.device] = "cp
raise RuntimeError("This module requires torchvision to be installed.")
super(InceptionModel, self).__init__()
self._device = device
self.model = models.inception_v3(pretrained=True).to(self._device)
if Version(torch.__version__) <= Version("1.7.0"):
Copy link
Collaborator

Choose a reason for hiding this comment

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

This version check is incorrect

Copy link
Collaborator

Choose a reason for hiding this comment

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

You have to check for torchvision version here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: metrics Metrics module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix CI warnings
2 participants