電子趣味の部屋

電子系のガジェットやアプリ開発等の趣味の話題を書いてます

Windows環境でのROCmに対応したPyTorchのインストール

Beelink GTR9 Pro (AMD Ryzen AI Max+ 395)ASUS Vivobook S 14 (AMD Ryzen AI 9 HX 370)のWindows環境へROCmに対応したPyTorchのインストールしたので、メモしておきます。

バージョン等は2025年10月4日時点の情報です。

基本的にAMDの公式ページに書かれている内容でインストールしました。
rocm.docs.amd.com

Python

Pythonのバージョンは 3.12 が条件になります。
今回は 3.12.10 をインストールしました。
www.python.org

インストール時に「Add Python to environment variables」にチェックを付け、パスを追加しておいてください。

PyTorch

Windowsのターミナルやコマンドラインで以下のコマンドを実行します。

pip install --no-cache-dir https://repo.radeon.com/rocm/windows/rocm-rel-6.4.4/torch-2.8.0a0%2Bgitfc14c65-cp312-cp312-win_amd64.whl
pip install --no-cache-dir https://repo.radeon.com/rocm/windows/rocm-rel-6.4.4/torchaudio-2.6.0a0%2B1a8f621-cp312-cp312-win_amd64.whl
pip install --no-cache-dir https://repo.radeon.com/rocm/windows/rocm-rel-6.4.4/torchvision-0.24.0a0%2Bc85f008-cp312-cp312-win_amd64.whl

確認

詳細は省略しますが、以下のようにPythonのコンソールからGPUが認識されていることを確認しました。

>python
Python 3.12.10 (tags/v3.12.10:0cc8128, Apr  8 2025, 12:21:36) [MSC v.1943 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> print(torch.__version__)
2.8.0a0+gitfc14c65
>>> print(torch.cuda.is_available())
True
>>> print(torch.cuda.device_count())
1
>>> print(torch.cuda.current_device())
0
>>> print(torch.cuda.get_device_name())
AMD Radeon(TM) 8060S Graphics
>>> print(torch.cuda.get_device_capability())
(11, 5)
>>>

PyTorchではじめるAI開発

PyTorchではじめるAI開発

Amazon