Retrieval-based-Voice-Conversion-WebUI: AMD Support - Segmentation Fault

System:

Ubuntu 22.04 LTS
Intel i5-12600k
32GB DDR4
AMD Radeon RX 6650 XT

Manually installed PyTorch 2.0.1 for rocm. Then installed requirements from requirements.txt. webui boots up without problems but when trying inference or training I get the following message:

python infer-web.py
Use Language: en_US
Running on local URL:  http://0.0.0.0:7865
loading weights/zro.pth
gin_channels: 256 self.spk_embed_dim: 109
<All keys matched successfully>
Segmentation fault (core dumped)

Can we expect AMD support in the near future?

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Reactions: 1
  • Comments: 41 (6 by maintainers)

Most upvoted comments

AMD GPU have not been supported now. Maybe we could try to add the dml support later.

I got it to work on my Gentoo Linux with RX 7900 XT and ROCm 5.7.1 this way:

  1. create new micromamba/conda python3.10 environment

  2. activate said environment

  3. git clone the repo and cd into it

  4. install prerequisites with correct source like so pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm5.7 pip install -r requirements-amd.txt make sure you don’t see nvidia or cuda or cu11 or cu12 mentioned in the packages installed. they instead should mention +rocm5.7 behind their version or have rocm in the package name e.g. pytorch-triton-rocm-2.2.0 torch-2.2.2+rocm5.7 torchaudio-2.2.2+rocm5.7

if you mess this step up go back to step 1 and make sure you have a fresh environment

  1. find out your gpu id with rocm-smi --showproductname it will look something like this. In my case the dGPU is ID 0 and the iGPU is ID 1 image

  2. take the Id from step 5 and export it in those 2 torch related variables export CUDA_VISIBLE_DEVICES=0 export HIP_VISIBLE_DEVICES=0 0 being the ID of my RX 7900 XT

  3. find out your llvm amdgpu architecture by issuing rocminfo then look for your dGPU under HSA Agents. It will look something like this image the interesting part is the “name”. Make sure you pick the actual dGPU and not the iGPU (in my case for Ryzen 7950x APU it’s called AMD Radeon Graphics) image

  4. so now that we have the internal name (gfx1100 for RX 7900 XT and RX 7900 XTX) we look up the supported devices for rocm amd official supported architectures if your gpu is not listed there don’t worry. as long as your architecture family is supported you are fine. i.e. any RX 7xxx series card is RDNA 3 and every RX 6xxx series card is RDNA 2 which are the most popular consumer cards currently I guess. So in my example we export another two variables with the following structure/syntax export PYTORCH_ROCM_ARCH="gfx1100" here we put the actual name from step 7 export HSA_OVERRIDE_GFX_VERSION=11.0.0 this one can be a bit tricky but in our case is simple. the syntax here is always xx.x.x, you take it from the “gfx…” so gfx1100 turns into 11.0.0 and gfx1030 turns into 10.3.0. Now remember only few gfx have official support and if you have lets say gfx1103 or gfx 1033 you must put a 0 for the last digit. so gfx1103 becomes 11.0.0 and gfx 1033 will be 10.3.0

this is it. I put all in one little bash script so I don’t have to type as much. However before executing it you need to activate the minimamba environment because it’s not possible from scripts/subprocesses so you can create a file like this in the RVC folder with nano rvc.sh, paste this (edit as you need to)

#!/bin/bash
export CUDA_VISIBLE_DEVICES=0
export HIP_VISIBLE_DEVICES=0
export HSA_OVERRIDE_GFX_VERSION=11.0.0
export PYTORCH_ROCM_ARCH="gfx1100"

python3 infer-web.py --pycmd python3

then make it executable with chmod +x rvc.sh now you can run it with ./rvc.sh (make sure you activated the micromamba environment in your shell)

That’s not very useful. We want AMD support, not Windows vendor-locking…

I made a pull request with some instructions on how to run RVC with ROCm.

Training is running with ~40 sec per epoch on a RX6700XT (12GB) with a batch size of 16.