Training with amd graphics card under Windows: Pytorch-directml major upgrade, changed to pytorch plug-in form, better compatibility

installation method:

Enable PyTorch with DirectML on Windows | Microsoft Learn

The new pytorch-directml is no longer an independent pytorch transplant, but a device plug-in, which is more usable and more compatible.

The original version cannot run transformers, the new version becomes an independent computing device dml, with better compatibility

import torch
import torch_directml


dml=torch_directml.device()
tensor1 = torch.tensor([1]).to(dml) # Note that dml is a variable, not a string!
tensor2 = torch.tensor([2]).to(dml)

for i in range(1000000):
    dml_algebra = tensor1 + tensor2
    dml_algebra.item()

Guess you like

Origin blog.csdn.net/znsoft/article/details/128403947