Skip to content

Commit

Permalink
new installer
Browse files Browse the repository at this point in the history
  • Loading branch information
blaise-tk committed Feb 20, 2024
1 parent a946e58 commit 141b1aa
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 43 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Development of VoRAS has been discontinued due to the absence of anticipated fur

## Windows

To start the web UI, run the `launch.py` script.
To start the web UI, run `./install.bat` and `python env/launch.py` script.

```
Tested environment: Windows 10, Python 3.10.9, torch 2.0.0+cu118
Expand Down
66 changes: 66 additions & 0 deletions install.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
@echo off

set "principal=%cd%"
set "URL_EXTRA=https://huggingface.co/IAHispano/applio/resolve/main"
set "CONDA_ROOT_PREFIX=%UserProfile%\Miniconda3"
set "INSTALL_ENV_DIR=%principal%\env"
set "MINICONDA_DOWNLOAD_URL=https://repo.anaconda.com/miniconda/Miniconda3-py39_23.9.0-0-Windows-x86_64.exe"
set "CONDA_EXECUTABLE=%CONDA_ROOT_PREFIX%\Scripts\conda.exe"

if not exist "%cd%\env.zip" (
echo Downloading the fairseq build...
curl -s -LJO %URL_EXTRA%/env.zip -o env.zip
)

if not exist "%cd%\env.zip" (
echo Download failed, trying with the powershell method
powershell -Command "& {Invoke-WebRequest -Uri '%URL_EXTRA%/env.zip' -OutFile 'mingit.zip'}"
)

if not exist "%cd%\env" (
echo Extracting the file...
powershell -command "& { Add-Type -AssemblyName System.IO.Compression.FileSystem ; [System.IO.Compression.ZipFile]::ExtractToDirectory('%cd%\env.zip', '%cd%') }"
)

if not exist "%cd%\env" (
echo Extracting failed trying with the tar method...
tar -xf %cd%\env.zip
)

if exist "%cd%\env" (
del env.zip
) else (
echo Theres a problem extracting the file please download the file and extract it manually.
echo https://huggingface.co/IAHispano/applio/resolve/main/env.zip
pause
exit
)

if not exist "%CONDA_EXECUTABLE%" (
echo Downloading Miniconda from %MINICONDA_DOWNLOAD_URL%...
curl %MINICONDA_DOWNLOAD_URL% -o miniconda.exe

if not exist "%principal%\miniconda.exe" (
echo Download failed trying with the powershell method.
powershell -Command "& {Invoke-WebRequest -Uri '%MINICONDA_DOWNLOAD_URL%' -OutFile 'miniconda.exe'}"
)

echo Installing Miniconda to %CONDA_ROOT_PREFIX%...
start /wait "" miniconda.exe /InstallationType=JustMe /RegisterPython=0 /S /D=%CONDA_ROOT_PREFIX%
del miniconda.exe
)

call "%CONDA_ROOT_PREFIX%\_conda.exe" create --no-shortcuts -y -k --prefix "%INSTALL_ENV_DIR%" python=3.9

echo Installing the dependencies...
call "%CONDA_ROOT_PREFIX%\condabin\conda.bat" activate "%INSTALL_ENV_DIR%"
pip install --upgrade setuptools
pip install -r "%principal%\requirements.txt"
pip uninstall torch torchvision torchaudio -y
pip install torch==2.1.1 torchvision==0.16.1 torchaudio==2.1.1 --index-url https://download.pytorch.org/whl/cu121
call "%CONDA_ROOT_PREFIX%\condabin\conda.bat" deactivate
echo.

echo RVC_CLI has been installed successfully!
pause
cls
39 changes: 0 additions & 39 deletions launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,44 +58,6 @@ def commit_hash():
return stored_commit_hash


def prepare_environment():
commit = commit_hash()
print(f"Python {sys.version}")
print(f"Commit hash: {commit}")

if "--skip-install" in sys.argv:
sys.argv.remove("--skip-install")
return

if (
"--reinstall-torch" in sys.argv
or not is_installed("torch")
or not is_installed("torchvision")
):
torch_command = os.environ.get(
"TORCH_COMMAND",
"pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu118",
)
run(
f'"{python}" -m {torch_command}',
"Installing torch and torchvision",
"Couldn't install torch",
)

if "--ngrok" in sys.argv and not is_installed("pyngrok"):
run(
f'"{python}" -m pip install pyngrok',
"Installing pyngrok",
"Couldn't install pyngrok",
)

run(
f'"{python}" -m pip install -r requirements.txt',
"Installing requirements",
"Couldn't install requirements",
)


def start():
os.environ["PATH"] = (
os.path.join(os.path.dirname(__file__), "bin")
Expand All @@ -108,5 +70,4 @@ def start():
if __name__ == "__main__":
commandline_args = os.environ.get("COMMANDLINE_ARGS", "")
sys.argv += shlex.split(commandline_args)
prepare_environment()
start()
1 change: 1 addition & 0 deletions modules/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def has_mps():

if not half_support:
print("WARNING: FP16 is not supported on this GPU")
print("Cuda GPU Name: ", torch.cuda.get_device_name())
is_half = False

device = "cuda:0"
Expand Down
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
gradio
gradio==4.14.0
tqdm==4.65.0
numpy==1.23.5
faiss-cpu==1.7.3
fairseq==0.12.2
git+https://github.com/IAHispano/fairseq; sys_platform == 'linux'
fairseq==0.12.2; sys_platform == 'win32'
matplotlib==3.7.1
scipy==1.9.3
librosa==0.9.2
Expand All @@ -15,5 +16,4 @@ transformers==4.28.1
flask
torchcrepe
tensorboard
tensorboardX
requests

0 comments on commit 141b1aa

Please sign in to comment.