8000 `torch.compile` can not be used out of the box in nightly/2.1 · Issue #109387 · pytorch/pytorch · GitHub
[go: up one dir, main page]

Skip to content
torch.compile can not be used out of the box in nightly/2.1 #109387
@malfet

Description

@malfet

🐛 Describe the bug

Consider following trivial sample:

import torch

def foo(x: torch.Tensor) -> torch.Tensor:
   return torch.sin(x) + torch.cos(x)

if __name__=="__main__":
    x = torch.rand(3, 3, device="cuda")
    x_eager = foo(x)
    x_pt2 = torch.compile(foo)(x)
    print(torch.allclose(x_eager, x_pt2))

Following sample can be executed on vanilla ubuntu:20.04 using 2.0.1, but fails with 2.1 release candidate, due to the spurious dependencies:

% python3 foo.py 
...
  File "/usr/local/lib/python3.8/dist-packages/torch/_dynamo/variables/base.py", line 96, in __call__
    obj = type.__call__(cls, *args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/torch/_dynamo/variables/constant.py", line 36, in __init__
    if isinstance(value, np.number):
torch._dynamo.exc.InternalTorchDynamoError: 'NoneType' object has no attribute 'number'

from user code:
   File "foo.py", line 4, in foo
    return torch.sin(x) + torch.cos(x)



Please note, that this is a regression, i.e. it used to work in 2.0
### Versions

2.1/nightly

cc @ezyang @msaroufim @wconstab @bdhirsh @anijain2305

Metadata

Metadata

Assignees

No one assigned

    Labels

    dependency issuemodule: regressionIt used to work, and now it doesn'toncall: pt2triagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0