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

PyTorch 2.0 support #415

Closed
Looong01 opened this issue Mar 16, 2023 · 9 comments
Closed

PyTorch 2.0 support #415

Looong01 opened this issue Mar 16, 2023 · 9 comments
Labels
pytorch-directml Issues in PyTorch when using its DirectML backend

Comments

@Looong01
Copy link

Looong01 commented Mar 16, 2023

PyTorch 2.0 has been released.
But when I try to install torch-directml, it removed torch-2.0.0 and installed torch-1.13.1
We need it because it has fixed the problem of #400

Besides, can you set the version checking as >=version (Like 1.13.1) rather than ==version (Like 1.13.1) in the pip installing processing?

@lshqqytiger
Copy link

lshqqytiger commented Mar 16, 2023

I think there should be more fixes and adaptations to support PyTorch 2.0.
Not just installing PyTorch 2.0.0 instead of 1.13.1.
Nevertheless, it will be nice to support PyTorch 2.0.
I'm also waiting for it.

@iperov
Copy link

iperov commented Mar 20, 2023

forget about 2.0
There are too many bugs in current version.

@zhangxiang1993 zhangxiang1993 added the pytorch-directml Issues in PyTorch when using its DirectML backend label Apr 17, 2023
@zhangxiang1993
Copy link
Member

We have torch-directml 0.2.0 published today, which is built with torch 2.0.0.

@znsoftm
Copy link

znsoftm commented May 2, 2023

I have test 0.2.0, it works well with transformers. Thank you guys.

@Looong01 Looong01 closed this as completed May 3, 2023
@Looong01
Copy link
Author

Looong01 commented May 3, 2023

I have test 0.2.0, it works well with transformers. Thank you guys.

How? I still get this:

import torch
import torch_directml
dml = torch_directml.device()
tensor1 = torch. Tensor([1]).to(dml)
tensor2 = torch. Tensor([2]).to(dml)
tensor1 = tensor1.new(tensor1.shape[0]).fill_(0)
tensor2 = tensor2.new(tensor2.shape[0]).fill_(0)
print("sum:", (tensor1 + tensor2).item())


---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
Cell In[24], line 8
      5 tensor1 = torch.tensor([1]).to(dml)
      6 tensor2 = torch.tensor([2]).to(dml)
----> 8 tensor1 = tensor1.new(tensor1.shape[0]).fill_(0)
      9 tensor2 = tensor2.new(tensor2.shape[0]).fill_(0)
     11 print("sum:", (tensor1 + tensor2).item())

RuntimeError: new(): expected key in DispatchKeySet(CPU, CUDA, HIP, XLA, MPS, IPU, XPU, HPU, Lazy, Meta) but got: PrivateUse1

@Lovinity
Copy link

Lovinity commented Jun 13, 2023

As of pyTorch 2.0 and 2.0.1 (Python 3.11; which is supposed to work with 2.0.1), pip is still erroring and cannot install torch-directml basically saying there are no compatible versions (implying it still won't work with pyTorch 2 / 2.0.1).

Looking in the samples, I see there are none for pyTorch 2, so I don't know how you can say it works and close the issue when it clearly doesn't and does not have the samples to do so.

This is also a big problem because the latest supported version, pyTorch 1.13, can no longer be installed via conventional means like pip.

Thus, torch-directml is basically broken.

EDIT: Looks like the problem is actually Python... seems directml does not yet support torch 2.0.1 / Python 3.11, but it will work on torch 2.0.0 / Python 3.10.6. So to summarize:

  • PyTorch 2 / Python 3.10.6: Works
  • PyTorch 2 / Python 3.11: Does not work (expected; PyTorch 2 does not support python 3.11 until 2.0.1)
  • PyTorch 2.0.1 / Python 3.10.6: Untested. I expect it to work.
  • PyTorch 2.0.1 / Python 3.11: Does not work (unexpected; maybe directml does not support Python 3.11)

@lshqqytiger
Copy link

Every release of torch-directml is bounded to a specific version of torch. (Because torch-directml-native should be built with torch)
torch-directml==0.2.0.dev230426, which is the latest one, is bounded to torch==2.0.0.
So only Python 3.10 + torch 2.0.0 will work.

@aljohnston112
Copy link

Docs are very out of date. This issue is the only "recent" source of version compatibilities I could find.

@kovtcharov
Copy link

any plans for supporting torch-directml going forward (torch 2.2.1 and 3.12.2)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pytorch-directml Issues in PyTorch when using its DirectML backend
Projects
None yet
Development

No branches or pull requests

8 participants