microsoft / DirectML

DirectML is a high-performance, hardware-accelerated DirectX 12 library for machine learning. DirectML provides GPU acceleration for common machine learning tasks across a broad range of supported hardware and drivers, including all DirectX 12-capable GPUs from vendors such as AMD, Intel, NVIDIA, and Qualcomm.
MIT License
2.15k stars 286 forks source link

module 'torch' has no attribute 'dml' #290

Closed gkiler closed 1 year ago

gkiler commented 1 year ago

I tried looking through the issues section and didn't find anyone else with this issue, sorry if it's a duplicate.

After following the instructions here: https://docs.microsoft.com/en-us/windows/ai/directml/gpu-pytorch-windows and making sure that I have all the prerequisite windows versions, python anaconda environment, and running the commands to install the packages in order, the environment seems to not detect dml at all.

Getting errors such as: image image

Here is my pip list: Package Version


absl-py 0.15.0 aiohttp 3.8.1 aiosignal 1.2.0 async-timeout 4.0.1 attrs 21.4.0 blinker 1.4 Bottleneck 1.3.5 brotlipy 0.7.0 cachetools 4.2.2 certifi 2022.6.15 cffi 1.15.1 charset-normalizer 2.0.4 click 8.0.4 colorama 0.4.5 cryptography 37.0.1 cycler 0.11.0 fonttools 4.25.0 frozenlist 1.2.0 google-auth 2.6.0 google-auth-oauthlib 0.4.4 grpcio 1.42.0 idna 3.3 importlib-metadata 4.11.3 kiwisolver 1.4.2 Markdown 3.3.4 matplotlib 3.5.2 mkl-fft 1.3.1 mkl-random 1.2.2 mkl-service 2.4.0 multidict 5.2.0 munkres 1.1.4 numexpr 2.8.3 numpy 1.23.1 oauthlib 3.2.0 opencv-python 4.6.0.66 packaging 21.3 pandas 1.4.3 Pillow 9.2.0 pip 21.2.2 ply 3.11 protobuf 3.20.1 pyasn1 0.4.8 pyasn1-modules 0.2.8 pycparser 2.21 PyJWT 2.4.0 pyOpenSSL 22.0.0 pyparsing 3.0.9 PyQt5 5.15.7 PyQt5-sip 12.11.0 PySocks 1.7.1 python-dateutil 2.8.2 pytorch-directml 1.8.0a0.dev220506 pytz 2022.1 PyYAML 6.0 requests 2.28.1 requests-oauthlib 1.3.0 rsa 4.7.2 setuptools 61.2.0 sip 6.6.2 six 1.16.0 tensorboard 2.9.0 tensorboard-data-server 0.6.0 tensorboard-plugin-wit 1.8.1 toml 0.10.2 torch 1.8.0 torchvision 0.9.0 tornado 6.2 tqdm 4.64.0 typing_extensions 4.3.0 urllib3 1.26.11 Werkzeug 2.0.3 wget 3.2 wheel 0.37.1 win-inet-pton 1.1.0 wincertstore 0.2 yarl 1.8.1 zipp 3.8.0

Xuldry commented 7 months ago

have you found a solution to this? Can't seem to be able to fix it

edit: I fixed it by deleting the venv folder and running with --use-directml in the args