-
-
Notifications
You must be signed in to change notification settings - Fork 656
Explore fixing test issues for older pytorch versions #3434
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
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -37,7 +37,7 @@ def fid_score( | |||||||||||||
| diff = mu1 - mu2 | ||||||||||||||
|
|
||||||||||||||
| # Product might be almost singular | ||||||||||||||
| covmean, _ = scipy.linalg.sqrtm(sigma1.mm(sigma2), disp=False) | ||||||||||||||
| covmean, _ = scipy.linalg.sqrtm(sigma1.mm(sigma2).numpy(), disp=False) | ||||||||||||||
| # Numerical error might give slight imaginary component | ||||||||||||||
| if np.iscomplexobj(covmean): | ||||||||||||||
| if not np.allclose(np.diagonal(covmean).imag, 0, atol=1e-3): | ||||||||||||||
|
|
@@ -48,7 +48,7 @@ def fid_score( | |||||||||||||
| tr_covmean = np.trace(covmean) | ||||||||||||||
|
|
||||||||||||||
| if not np.isfinite(covmean).all(): | ||||||||||||||
| tr_covmean = np.sum(np.sqrt(((np.diag(sigma1) * eps) * (np.diag(sigma2) * eps)) / (eps * eps))) | ||||||||||||||
| tr_covmean = np.sum(np.sqrt(((np.diag(sigma1.numpy()) * eps) * (np.diag(sigma2.numpy()) * eps)) / (eps * eps))) | ||||||||||||||
|
|
||||||||||||||
| return float(diff.dot(diff).item() + torch.trace(sigma1) + torch.trace(sigma2) - 2 * tr_covmean) | ||||||||||||||
|
Comment on lines
+51
to
53
|
||||||||||||||
| tr_covmean = np.sum(np.sqrt(((np.diag(sigma1.numpy()) * eps) * (np.diag(sigma2.numpy()) * eps)) / (eps * eps))) | |
| return float(diff.dot(diff).item() + torch.trace(sigma1) + torch.trace(sigma2) - 2 * tr_covmean) | |
| tr_covmean = np.sum(np.sqrt(((np.diag(sigma1) * eps) * (np.diag(sigma2) * eps)) / (eps * eps))) | |
| return float(diff.dot(diff).item() + torch.trace(torch.tensor(sigma1)) + torch.trace(torch.tensor(sigma2)) - 2 * tr_covmean) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -872,7 +872,7 @@ def test__compute_recall_and_precision(available_device): | |
| def test_compute(sample): | ||
| device = idist.device() | ||
|
|
||
| if device == torch.device("mps"): | ||
| if device.type == "mps": | ||
| pytest.skip("Due to MPS backend out of memory") | ||
|
|
||
| # [email protected], [email protected], [email protected], AP-S, AP-M, AP-L, AR-1, AR-10, AR-100, AR-S, AR-M, AR-L | ||
|
|
@@ -932,7 +932,7 @@ def test_integration(sample): | |
| bs = 3 | ||
|
|
||
| device = idist.device() | ||
| if device == torch.device("mps"): | ||
| if device.type == "mps": | ||
| pytest.skip("Due to MPS backend out of memory") | ||
|
|
||
| def update(engine, i): | ||
|
|
@@ -1003,7 +1003,7 @@ def test_distrib_update_compute(distributed, sample): | |
|
|
||
| device = idist.device() | ||
|
|
||
| if device == torch.device("mps"): | ||
| if device.type == "mps": | ||
| pytest.skip("Due to MPS backend out of memory") | ||
|
|
||
| metric_device = "cpu" if device.type == "xla" else device | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Converting the tensor to numpy adds an unnecessary GPU-to-CPU transfer. Consider checking if the input tensors are on GPU and handle the conversion more efficiently, or use PyTorch native operations if available.