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

running opcheck leads to Fail to import hypothesis in common_utils, tests are not derandomized print #126871

Closed
Tracked by #130151
zou3519 opened this issue May 22, 2024 · 4 comments
Assignees
Labels
module: opcheck Related to opcheck testing for custom operators module: pt2-dispatcher PT2 dispatcher-related issues (e.g., aotdispatch, functionalization, faketensor, custom-op, oncall: pt2 triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Milestone

Comments

@zou3519
Copy link
Contributor

zou3519 commented May 22, 2024

likely shouldn't happen

cc @ezyang @msaroufim @bdhirsh @anijain2305 @chauhang

@zou3519 zou3519 added this to the 2.4.0 milestone May 22, 2024
@zou3519 zou3519 self-assigned this May 22, 2024
@jbschlosser jbschlosser added triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module module: opcheck Related to opcheck testing for custom operators labels May 22, 2024
@zou3519 zou3519 added the module: pt2-dispatcher PT2 dispatcher-related issues (e.g., aotdispatch, functionalization, faketensor, custom-op, label May 28, 2024
zou3519 added a commit that referenced this issue May 28, 2024
This PR excises opcheck's dependency on
torch.testing._internal.common_utils, (which comes with dependencies on
expecttest and hypothesis). We do this by moving what we need to
torch.testing._utils and adding a test for it.

Fixes #126870, #126871

Test Plan:
- new tests

[ghstack-poisoned]
zou3519 added a commit that referenced this issue May 28, 2024
This PR excises opcheck's dependency on
torch.testing._internal.common_utils, (which comes with dependencies on
expecttest and hypothesis). We do this by moving what we need to
torch.testing._utils and adding a test for it.

Fixes #126870, #126871

Test Plan:
- new tests

[ghstack-poisoned]
zou3519 added a commit that referenced this issue May 28, 2024
This PR excises opcheck's dependency on
torch.testing._internal.common_utils, (which comes with dependencies on
expecttest and hypothesis). We do this by moving what we need to
torch.testing._utils and adding a test for it.

Fixes #126870, #126871

Test Plan:
- new tests

[ghstack-poisoned]
zou3519 added a commit that referenced this issue May 28, 2024
…dependencies"

This PR excises opcheck's dependency on
torch.testing._internal.common_utils, (which comes with dependencies on
expecttest and hypothesis). We do this by moving what we need to
torch.testing._utils and adding a test for it.

Fixes #126870, #126871

Test Plan:
- new tests

[ghstack-poisoned]
zou3519 added a commit that referenced this issue May 28, 2024
This PR excises opcheck's dependency on
torch.testing._internal.common_utils, (which comes with dependencies on
expecttest and hypothesis). We do this by moving what we need to
torch.testing._utils and adding a test for it.

Fixes #126870, #126871

Test Plan:
- new tests

[ghstack-poisoned]
zou3519 added a commit that referenced this issue May 29, 2024
…dependencies"

This PR excises opcheck's dependency on
torch.testing._internal.common_utils, (which comes with dependencies on
expecttest and hypothesis). We do this by moving what we need to
torch.testing._utils and adding a test for it.

Fixes #126870, #126871

Test Plan:
- new tests

[ghstack-poisoned]
zou3519 added a commit that referenced this issue May 29, 2024
This PR excises opcheck's dependency on
torch.testing._internal.common_utils, (which comes with dependencies on
expecttest and hypothesis). We do this by moving what we need to
torch.testing._utils and adding a test for it.

Fixes #126870, #126871

Test Plan:
- new tests

[ghstack-poisoned]
pytorchmergebot pushed a commit that referenced this issue May 29, 2024
This PR excises opcheck's dependency on
torch.testing._internal.common_utils, (which comes with dependencies on
expecttest and hypothesis). We do this by moving what we need to
torch.testing._utils and adding a test for it.

Fixes #126870, #126871

Test Plan:
- new tests
Pull Request resolved: #127292
Approved by: https://github.com/williamwen42
ghstack dependencies: #127291
@zou3519
Copy link
Contributor Author

zou3519 commented May 29, 2024

Fixed by #127292

@zou3519 zou3519 closed this as completed May 29, 2024
zou3519 added a commit that referenced this issue May 29, 2024
…dependencies"

This PR excises opcheck's dependency on
torch.testing._internal.common_utils, (which comes with dependencies on
expecttest and hypothesis). We do this by moving what we need to
torch.testing._utils and adding a test for it.

Fixes #126870, #126871

Test Plan:
- new tests

[ghstack-poisoned]
zou3519 added a commit that referenced this issue May 29, 2024
This PR excises opcheck's dependency on
torch.testing._internal.common_utils, (which comes with dependencies on
expecttest and hypothesis). We do this by moving what we need to
torch.testing._utils and adding a test for it.

Fixes #126870, #126871

Test Plan:
- new tests

[ghstack-poisoned]
zou3519 added a commit that referenced this issue May 29, 2024
…dependencies"

This PR excises opcheck's dependency on
torch.testing._internal.common_utils, (which comes with dependencies on
expecttest and hypothesis). We do this by moving what we need to
torch.testing._utils and adding a test for it.

Fixes #126870, #126871

Test Plan:
- new tests

[ghstack-poisoned]
zou3519 added a commit that referenced this issue May 29, 2024
This PR excises opcheck's dependency on
torch.testing._internal.common_utils, (which comes with dependencies on
expecttest and hypothesis). We do this by moving what we need to
torch.testing._utils and adding a test for it.

Fixes #126870, #126871

Test Plan:
- new tests

[ghstack-poisoned]
zou3519 added a commit that referenced this issue May 29, 2024
…dependencies"

This PR excises opcheck's dependency on
torch.testing._internal.common_utils, (which comes with dependencies on
expecttest and hypothesis). We do this by moving what we need to
torch.testing._utils and adding a test for it.

Fixes #126870, #126871

Test Plan:
- new tests

[ghstack-poisoned]
zou3519 added a commit that referenced this issue May 29, 2024
This PR excises opcheck's dependency on
torch.testing._internal.common_utils, (which comes with dependencies on
expecttest and hypothesis). We do this by moving what we need to
torch.testing._utils and adding a test for it.

Fixes #126870, #126871

Test Plan:
- new tests

[ghstack-poisoned]
pytorch-bot bot pushed a commit that referenced this issue May 30, 2024
This PR excises opcheck's dependency on
torch.testing._internal.common_utils, (which comes with dependencies on
expecttest and hypothesis). We do this by moving what we need to
torch.testing._utils and adding a test for it.

Fixes #126870, #126871

Test Plan:
- new tests
Pull Request resolved: #127292
Approved by: https://github.com/williamwen42
ghstack dependencies: #127291
@atalman
Copy link
Contributor

atalman commented Jul 9, 2024

@zou3519 I still see this warning on 2.4.0 rc:

python test_custom_ops.py 
Fail to import hypothesis in common_utils, tests are not derandomized
.......................................................sx..................sss./home/atalman/temo/pytorch/test/test_custom_ops.py:1634: FutureWarning: `torch.library.impl_abstract` was renamed to `torch.library.register_fake`. Please use that instead; we will remove `torch.library.impl_abstract` in a future version of PyTorch.
  @torch.library.impl_abstract(qualname, lib=self.lib())

@atalman atalman removed this from the 2.4.0 milestone Jul 9, 2024
@zou3519
Copy link
Contributor Author

zou3519 commented Jul 9, 2024

@atalman the way to verify this is:

import torch
@torch.library.custom_op("mylib::numpy_mul", mutates_args=())
def numpy_add(x: Tensor, y: float) -> Tensor:
    x_np = x.numpy(force=True)
    z_np = x_np + y
    return torch.from_numpy(z_np).to(x.device)
@numpy_sin.register_fake
def _(x, y):
    return torch.empty_like(x)

sample_inputs = [
    (torch.randn(3), 3.14),
]
for args in sample_inputs:
    torch.library.opcheck(foo, args)

and see if that raises an error

@atalman
Copy link
Contributor

atalman commented Jul 10, 2024

Validated I can run tutorial successfully : https://pytorch.org/tutorials/advanced/python_custom_ops.html

@atalman atalman added this to the 2.4.0 milestone Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: opcheck Related to opcheck testing for custom operators module: pt2-dispatcher PT2 dispatcher-related issues (e.g., aotdispatch, functionalization, faketensor, custom-op, oncall: pt2 triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Projects
None yet
Development

No branches or pull requests

3 participants