Skip to content

UFMT formatting on test/distributions, test/error_messages, test/forward_backward_compatability #123527

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
wants to merge 5 commits into from

Conversation

arunppsg
Copy link
Contributor

@arunppsg arunppsg commented Apr 7, 2024

Partiall addresses #123062

UFMT formatting on

  • test/distributions
  • test/error_messages, test/forward_backward_compatability

cc @albanD

Copy link

pytorch-bot bot commented Apr 7, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/123527

Note: Links to docs will display an error until the docs builds have been completed.

❌ 1 New Failure

As of commit ca7ced7 with merge base 7c23fed (image):

NEW FAILURE - The following job has failed:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@pytorch-bot pytorch-bot bot added the topic: not user facing topic category label Apr 7, 2024
@arunppsg
Copy link
Contributor Author

arunppsg commented Apr 8, 2024

fixed the following lint errors in e29c8ec

@ezyang
Copy link
Contributor

ezyang commented Apr 9, 2024

export will conflict with #123520

@ezyang
Copy link
Contributor

ezyang commented Apr 9, 2024

has nontrivial changes

diff --git b/test/export/test_passes.py a/test/export/test_passes.py
index 79cfbd68086..dae9e203747 100644
--- b/test/export/test_passes.py
+++ a/test/export/test_passes.py
@@ -651,7 +651,7 @@ def forward(self, arg_0):
     cos = torch.ops.aten.cos.default(add);  add = None
     sum_2 = torch.ops.aten.sum.default(cos);  cos = None
     submod_3 = self.submod_1
-    wrap_with_set_grad_enabled = torch._higher_order_ops.wrap.wrap_with_set_grad_enabled(False, submod_3, sum_1, sum_2);  submod_3 = sum_1 = sum_2 = None
+    wrap_with_set_grad_enabled = torch._higher_order_ops.wrap.wrap_with_set_grad_enabled(False, submod_3, sum_1, sum_2);  submod_3 = sum_1 = sum_2 = None  # noqa: B950
     add_1 = wrap_with_set_grad_enabled[0]
     add_2 = wrap_with_set_grad_enabled[1];  wrap_with_set_grad_enabled = None
     sub = torch.ops.aten.sub.Tensor(add_1, 1)
@@ -667,13 +667,13 @@ def forward(self, arg_0):
     x, = fx_pytree.tree_flatten_spec(([arg_0], {}), self._in_spec)
     add = torch.ops.aten.add.Tensor(x, 1);  x = None
     submod_5 = self.submod_1
-    wrap_with_set_grad_enabled = torch._higher_order_ops.wrap.wrap_with_set_grad_enabled(True, submod_5, add);  submod_5 = add = None
+    wrap_with_set_grad_enabled = torch._higher_order_ops.wrap.wrap_with_set_grad_enabled(True, submod_5, add);  submod_5 = add = None  # noqa: B950
     sum_1 = wrap_with_set_grad_enabled[0]
     sum_2 = wrap_with_set_grad_enabled[1];  wrap_with_set_grad_enabled = None
     add_1 = torch.ops.aten.add.Tensor(sum_1, 1);  sum_1 = None
     add_2 = torch.ops.aten.add.Tensor(sum_2, 1);  sum_2 = None
     submod_6 = self.submod_3
-    wrap_with_set_grad_enabled_1 = torch._higher_order_ops.wrap.wrap_with_set_grad_enabled(True, submod_6, add_1, add_2);  submod_6 = None
+    wrap_with_set_grad_enabled_1 = torch._higher_order_ops.wrap.wrap_with_set_grad_enabled(True, submod_6, add_1, add_2);  submod_6 = None  # noqa: B950
     sub = wrap_with_set_grad_enabled_1[0]
     sub_1 = wrap_with_set_grad_enabled_1[1];  wrap_with_set_grad_enabled_1 = None
     return pytree.tree_unflatten((add_1, add_2, sub, sub_1), self._out_spec)

You can't put the noqa directly in multistring line, has to go at end.

Copy link
Contributor

@ezyang ezyang left a comment

Choose a reason for hiding this comment

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

will fail ci

@arunppsg
Copy link
Contributor Author

arunppsg commented Apr 9, 2024

dropped changes to export as it is already covered on #123520

@arunppsg arunppsg requested a review from ezyang April 9, 2024 11:10
@arunppsg arunppsg changed the title UFMT formatting on test/distributions, test/error_messages, test/export test/forward_backward_compatability UFMT formatting on test/distributions, test/error_messages, test/forward_backward_compatability Apr 9, 2024
@ezyang
Copy link
Contributor

ezyang commented Apr 9, 2024

Diff is now

diff --git b/test/distributions/test_distributions.py a/test/distributions/test_distributions.py
index 3bb3e4fa5ae..01c598b427d 100644
--- b/test/distributions/test_distributions.py
+++ a/test/distributions/test_distributions.py
@@ -2787,9 +2787,7 @@ class TestDistributions(DistributionsTestCase):
             scipy.stats.multivariate_normal(
                 mean.detach().numpy(), cov.detach().numpy()
             ),
-            "LowRankMultivariateNormal(loc={}, cov_factor={}, cov_diag={})".format(
-                mean, cov_factor, cov_diag
-            ),
+            f"LowRankMultivariateNormal(loc={mean}, cov_factor={cov_factor}, cov_diag={cov_diag})",
             multivariate=True,
         )
 
@@ -5959,9 +5957,7 @@ class TestNumericalStability(DistributionsTestCase):
             expected_value,
             atol=atol,
             rtol=0,
-            msg="Incorrect value for tensor type: {}. Expected = {}, Actual = {}".format(
-                type(x), expected_value, log_pdf
-            ),
+            msg=f"Incorrect value for tensor type: {type(x)}. Expected = {expected_value}, Actual = {log_pdf}",
         )
         if expected_gradient is not None:
             self.assertEqual(
@@ -5969,9 +5965,7 @@ class TestNumericalStability(DistributionsTestCase):
                 expected_gradient,
                 atol=atol,
                 rtol=0,
-                msg="Incorrect gradient for tensor type: {}. Expected = {}, Actual = {}".format(
-                    type(x), expected_gradient, p.grad
-                ),
+                msg=f"Incorrect gradient for tensor type: {type(x)}. Expected = {expected_gradient}, Actual = {p.grad}",
             )
 
     def test_bernoulli_gradient(self):

which looks acceptable

@ezyang
Copy link
Contributor

ezyang commented Apr 9, 2024

@pytorchbot merge

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Apr 9, 2024
@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@pytorchmergebot
Copy link
Collaborator

Merge failed

Reason: 1 mandatory check(s) failed. The first few are:

Dig deeper by viewing the failures on hud

Details for Dev Infra team Raised by workflow job

Failing merge rule: Core Maintainers

@ezyang
Copy link
Contributor

ezyang commented Apr 9, 2024

@pytorchbot merge -i

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged while ignoring the following 1 checks: Lint / pr-sanity-checks

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

sanketpurandare pushed a commit to sanketpurandare/pytorch that referenced this pull request Apr 22, 2024
…ard_backward_compatability (pytorch#123527)

Partiall addresses pytorch#123062

UFMT formatting on
- test/distributions
- test/error_messages, test/forward_backward_compatability

Pull Request resolved: pytorch#123527
Approved by: https://github.com/huydhn
pytorch-bot bot pushed a commit that referenced this pull request May 3, 2024
…ard_backward_compatability (#123527)

Partiall addresses #123062

UFMT formatting on
- test/distributions
- test/error_messages, test/forward_backward_compatability

Pull Request resolved: #123527
Approved by: https://github.com/huydhn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants