From 86eb008f9718dafc7f3fc0d3ca608d3028d3225e Mon Sep 17 00:00:00 2001 From: alexhegit <31022192+alexhegit@users.noreply.github.com> Date: Mon, 12 May 2025 10:56:22 +0800 Subject: [PATCH 1/2] Update README.md: add steps to run CosyVoice on AMD GPU. --- README.md | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/README.md b/README.md index 4a1dbd30e..f47e1ffbf 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,47 @@ sudo apt-get install sox libsox-dev sudo yum install sox sox-devel ``` +Run with AMD GPU + +Above env setup is for CUDA. CosyVoice could run on AMD GPU with AMD ROCm. The only difference with the setup of CUDA GPU is to use PyTorch-ROCm to replace the PyTorch-CUDA. +ROCm is be part of PyTorch which could be installed as https://pytorch.org/. The steps are, +1. Install ROCm driver and Runtime. + Rerfer to https://rocm.docs.amd.com/projects/install-on-linux/en/latest/install/quick-start.html +2. Create conda env ( + - create the env + ```shell + conda create -n cosyvoice -y python=3.10 + conda activate cosyvoice + ``` + - Install PyTorch-ROCm to replace the PyTorch-CUDA + + ```shell + pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm6.3 + ``` + + - Install the requirements + Just comments the first two lines of [requirements.txt](https://github.com/FunAudioLLM/CosyVoice/blob/main/requirements.txt) + + ```shell + # requirements.txt + #--extra-index-url https://download.pytorch.org/whl/cu121 + #--extra-index-url https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/onnxruntime-cuda-12/pypi/simple/ # https://github.com/microsoft/onnxruntime/issues/21684 + ``` + + And then run + + ```shell + conda install -y -c conda-forge pynini==2.1.5 + pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/ --trusted-host=mirrors.aliyun.com + + # If you encounter sox compatibility issues + # ubuntu + sudo apt-get install sox libsox-dev + # centos + sudo yum install sox sox-devel + ``` + You could refer to the tutorial [Play CosyVoice on AMD ROCm GPU](https://medium.com/@alexhe.amd/play-cosyvoice-on-amd-rocm-gpu-459c942f7214) to get the details. This tutorial also provide a ROCm env file to help setuping. + **Model download** We strongly recommend that you download our pretrained `CosyVoice2-0.5B` `CosyVoice-300M` `CosyVoice-300M-SFT` `CosyVoice-300M-Instruct` model and `CosyVoice-ttsfrd` resource. From 5de28517f7523f0d526e79bac2af4fcd95035206 Mon Sep 17 00:00:00 2001 From: alexhegit <31022192+alexhegit@users.noreply.github.com> Date: Thu, 5 Jun 2025 15:42:11 +0800 Subject: [PATCH 2/2] Update README.md Force to use onnxruntime for AMD GPU. --- README.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f47e1ffbf..369f92b6b 100644 --- a/README.md +++ b/README.md @@ -95,14 +95,21 @@ ROCm is be part of PyTorch which could be installed as https://pytorch.org/. The ``` - Install the requirements - Just comments the first two lines of [requirements.txt](https://github.com/FunAudioLLM/CosyVoice/blob/main/requirements.txt) + You need do some modification about the [requirements.txt](https://github.com/FunAudioLLM/CosyVoice/blob/main/requirements.txt) before installing the depency library. + 1. To comments the first two lines of [requirements.txt](https://github.com/FunAudioLLM/CosyVoice/blob/main/requirements.txt) ```shell # requirements.txt #--extra-index-url https://download.pytorch.org/whl/cu121 #--extra-index-url https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/onnxruntime-cuda-12/pypi/simple/ # https://github.com/microsoft/onnxruntime/issues/21684 ``` - + 2. Force to use onnxruntime + + ```shell + #onnxruntime-gpu==1.18.0; sys_platform == 'linux' + onnxruntime==1.18.0; sys_platform == 'linux' + ``` + And then run ```shell