Ethan0927 commited on
Commit
e4f48e9
·
1 Parent(s): 33684da

Upload 12 files

Browse files
INSTRUCTIONS.TXT ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Thank you for downloading oobabooga/text-generation-webui.
2
+
3
+ # Installation
4
+
5
+ Simply run the "start" script.
6
+
7
+ # Updating
8
+
9
+ Run the "update" script. This will only install the updates, so it should
10
+ be much faster than the initial installation.
11
+
12
+ May need to delete the 'text-generation-webui\repositories\GPTQ-for-LLaMa'
13
+ folder if GPTQ-for-LLaMa needs to be updated.
14
+
15
+ # Adding flags like --chat, --notebook, etc
16
+
17
+ Edit the "webui.py" script using a text editor and add the desired flags
18
+ to the line that says
19
+
20
+ run_cmd("python server.py --chat --model-menu")
21
+
22
+ For instance, to add the --notebook flag, change it to
23
+
24
+ run_cmd("python server.py --notebook --model-menu")
25
+
26
+ # Running an interactive shell
27
+
28
+ In order to run an interactive shell in the miniconda environment, run
29
+ the "cmd" script. This is useful for installing additional requirements
30
+ manually.
cmd_linux.sh ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ cd "$(dirname "${BASH_SOURCE[0]}")"
4
+
5
+ if [[ "$(pwd)" =~ " " ]]; then echo This script relies on Miniconda which can not be silently installed under a path with spaces. && exit; fi
6
+
7
+ # config
8
+ CONDA_ROOT_PREFIX="$(pwd)/installer_files/conda"
9
+ INSTALL_ENV_DIR="$(pwd)/installer_files/env"
10
+
11
+ # activate env
12
+ bash --init-file <(echo "source \"$CONDA_ROOT_PREFIX/etc/profile.d/conda.sh\" && conda activate \"$INSTALL_ENV_DIR\"")
cmd_macos.sh ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ cd "$(dirname "${BASH_SOURCE[0]}")"
4
+
5
+ if [[ "$(pwd)" =~ " " ]]; then echo This script relies on Miniconda which can not be silently installed under a path with spaces. && exit; fi
6
+
7
+ # config
8
+ CONDA_ROOT_PREFIX="$(pwd)/installer_files/conda"
9
+ INSTALL_ENV_DIR="$(pwd)/installer_files/env"
10
+
11
+ # activate env
12
+ bash --init-file <(echo "source \"$CONDA_ROOT_PREFIX/etc/profile.d/conda.sh\" && conda activate \"$INSTALL_ENV_DIR\"")
cmd_windows.bat ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @echo off
2
+
3
+ cd /D "%~dp0"
4
+
5
+ echo "%CD%"| findstr /C:" " >nul && echo This script relies on Miniconda which can not be silently installed under a path with spaces. && goto end
6
+
7
+ set PATH=%PATH%;%SystemRoot%\system32
8
+
9
+ @rem config
10
+ set CONDA_ROOT_PREFIX=%cd%\installer_files\conda
11
+ set INSTALL_ENV_DIR=%cd%\installer_files\env
12
+
13
+ @rem activate installer env
14
+ call "%CONDA_ROOT_PREFIX%\condabin\conda.bat" activate "%INSTALL_ENV_DIR%" || ( echo. && echo Miniconda hook not found. && goto end )
15
+
16
+ @rem enter commands
17
+ cmd /k "%*"
18
+
19
+ :end
20
+ pause
generate_zips.sh ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ mkdir oobabooga_{windows,linux,macos}
2
+ for p in windows macos linux; do
3
+ cp {*$p*\.*,webui.py,INSTRUCTIONS.TXT} oobabooga_$p;
4
+ zip -r oobabooga_$p.zip oobabooga_$p;
5
+ done
start_linux.sh ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ cd "$(dirname "${BASH_SOURCE[0]}")"
4
+
5
+ if [[ "$(pwd)" =~ " " ]]; then echo This script relies on Miniconda which can not be silently installed under a path with spaces. && exit; fi
6
+
7
+ OS_ARCH=$(uname -m)
8
+ case "${OS_ARCH}" in
9
+ x86_64*) OS_ARCH="x86_64";;
10
+ arm64*) OS_ARCH="aarch64";;
11
+ *) echo "Unknown system architecture: $OS_ARCH! This script runs only on x86_64 or arm64" && exit
12
+ esac
13
+
14
+ # config
15
+ INSTALL_DIR="$(pwd)/installer_files"
16
+ CONDA_ROOT_PREFIX="$(pwd)/installer_files/conda"
17
+ INSTALL_ENV_DIR="$(pwd)/installer_files/env"
18
+ MINICONDA_DOWNLOAD_URL="https://repo.anaconda.com/miniconda/Miniconda3-py310_23.1.0-1-Linux-${OS_ARCH}.sh"
19
+ conda_exists="F"
20
+
21
+ # figure out whether git and conda needs to be installed
22
+ if "$CONDA_ROOT_PREFIX/bin/conda" --version &>/dev/null; then conda_exists="T"; fi
23
+
24
+ # (if necessary) install git and conda into a contained environment
25
+ # download miniconda
26
+ if [ "$conda_exists" == "F" ]; then
27
+ echo "Downloading Miniconda from $MINICONDA_DOWNLOAD_URL to $INSTALL_DIR/miniconda_installer.sh"
28
+
29
+ mkdir -p "$INSTALL_DIR"
30
+ curl -Lk "$MINICONDA_DOWNLOAD_URL" > "$INSTALL_DIR/miniconda_installer.sh"
31
+
32
+ chmod u+x "$INSTALL_DIR/miniconda_installer.sh"
33
+ bash "$INSTALL_DIR/miniconda_installer.sh" -b -p $CONDA_ROOT_PREFIX
34
+
35
+ # test the conda binary
36
+ echo "Miniconda version:"
37
+ "$CONDA_ROOT_PREFIX/bin/conda" --version
38
+ fi
39
+
40
+ # create the installer env
41
+ if [ ! -e "$INSTALL_ENV_DIR" ]; then
42
+ "$CONDA_ROOT_PREFIX/bin/conda" create -y -k --prefix "$INSTALL_ENV_DIR" python=3.10
43
+ fi
44
+
45
+ # check if conda environment was actually created
46
+ if [ ! -e "$INSTALL_ENV_DIR/bin/python" ]; then
47
+ echo "Conda environment is empty."
48
+ exit
49
+ fi
50
+
51
+ # activate installer env
52
+ source "$CONDA_ROOT_PREFIX/etc/profile.d/conda.sh" # otherwise conda complains about 'shell not initialized' (needed when running in a script)
53
+ conda activate "$INSTALL_ENV_DIR"
54
+
55
+ # setup installer env
56
+ python webui.py
57
+
58
+ echo
59
+ echo "Done!"
start_macos.sh ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ cd "$(dirname "${BASH_SOURCE[0]}")"
4
+
5
+ if [[ "$(pwd)" =~ " " ]]; then echo This script relies on Miniconda which can not be silently installed under a path with spaces. && exit; fi
6
+
7
+ # M Series or Intel
8
+ OS_ARCH=$(uname -m)
9
+ case "${OS_ARCH}" in
10
+ x86_64*) OS_ARCH="x86_64";;
11
+ arm64*) OS_ARCH="arm64";;
12
+ *) echo "Unknown system architecture: $OS_ARCH! This script runs only on x86_64 or arm64" && exit
13
+ esac
14
+
15
+ # config
16
+ INSTALL_DIR="$(pwd)/installer_files"
17
+ CONDA_ROOT_PREFIX="$(pwd)/installer_files/conda"
18
+ INSTALL_ENV_DIR="$(pwd)/installer_files/env"
19
+ MINICONDA_DOWNLOAD_URL="https://repo.anaconda.com/miniconda/Miniconda3-py310_23.1.0-1-MacOSX-${OS_ARCH}.sh"
20
+ conda_exists="F"
21
+
22
+ # figure out whether git and conda needs to be installed
23
+ if "$CONDA_ROOT_PREFIX/bin/conda" --version &>/dev/null; then conda_exists="T"; fi
24
+
25
+ # (if necessary) install git and conda into a contained environment
26
+ # download miniconda
27
+ if [ "$conda_exists" == "F" ]; then
28
+ echo "Downloading Miniconda from $MINICONDA_DOWNLOAD_URL to $INSTALL_DIR/miniconda_installer.sh"
29
+
30
+ mkdir -p "$INSTALL_DIR"
31
+ curl -Lk "$MINICONDA_DOWNLOAD_URL" > "$INSTALL_DIR/miniconda_installer.sh"
32
+
33
+ chmod u+x "$INSTALL_DIR/miniconda_installer.sh"
34
+ bash "$INSTALL_DIR/miniconda_installer.sh" -b -p $CONDA_ROOT_PREFIX
35
+
36
+ # test the conda binary
37
+ echo "Miniconda version:"
38
+ "$CONDA_ROOT_PREFIX/bin/conda" --version
39
+ fi
40
+
41
+ # create the installer env
42
+ if [ ! -e "$INSTALL_ENV_DIR" ]; then
43
+ "$CONDA_ROOT_PREFIX/bin/conda" create -y -k --prefix "$INSTALL_ENV_DIR" python=3.10
44
+ fi
45
+
46
+ # check if conda environment was actually created
47
+ if [ ! -e "$INSTALL_ENV_DIR/bin/python" ]; then
48
+ echo "Conda environment is empty."
49
+ exit
50
+ fi
51
+
52
+ # activate installer env
53
+ source "$CONDA_ROOT_PREFIX/etc/profile.d/conda.sh" # otherwise conda complains about 'shell not initialized' (needed when running in a script)
54
+ conda activate "$INSTALL_ENV_DIR"
55
+
56
+ # setup installer env
57
+ python webui.py
58
+
59
+ echo
60
+ echo "Done!"
start_windows.bat ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @echo off
2
+
3
+ cd /D "%~dp0"
4
+
5
+ echo "%CD%"| findstr /C:" " >nul && echo This script relies on Miniconda which can not be silently installed under a path with spaces. && goto end
6
+
7
+ set PATH=%PATH%;%SystemRoot%\system32
8
+
9
+ @rem config
10
+ set INSTALL_DIR=%cd%\installer_files
11
+ set CONDA_ROOT_PREFIX=%cd%\installer_files\conda
12
+ set INSTALL_ENV_DIR=%cd%\installer_files\env
13
+ set MINICONDA_DOWNLOAD_URL=https://repo.anaconda.com/miniconda/Miniconda3-py310_23.1.0-1-Windows-x86_64.exe
14
+ set conda_exists=F
15
+
16
+ @rem figure out whether git and conda needs to be installed
17
+ call "%CONDA_ROOT_PREFIX%\_conda.exe" --version >nul 2>&1
18
+ if "%ERRORLEVEL%" EQU "0" set conda_exists=T
19
+
20
+ @rem (if necessary) install git and conda into a contained environment
21
+ @rem download conda
22
+ if "%conda_exists%" == "F" (
23
+ echo Downloading Miniconda from %MINICONDA_DOWNLOAD_URL% to %INSTALL_DIR%\miniconda_installer.exe
24
+
25
+ mkdir "%INSTALL_DIR%"
26
+ call curl -Lk "%MINICONDA_DOWNLOAD_URL%" > "%INSTALL_DIR%\miniconda_installer.exe" || ( echo. && echo Miniconda failed to download. && goto end )
27
+
28
+ echo Installing Miniconda to %CONDA_ROOT_PREFIX%
29
+ start /wait "" "%INSTALL_DIR%\miniconda_installer.exe" /InstallationType=JustMe /NoShortcuts=1 /AddToPath=0 /RegisterPython=0 /NoRegistry=1 /S /D=%CONDA_ROOT_PREFIX%
30
+
31
+ @rem test the conda binary
32
+ echo Miniconda version:
33
+ call "%CONDA_ROOT_PREFIX%\_conda.exe" --version || ( echo. && echo Miniconda not found. && goto end )
34
+ )
35
+
36
+ @rem create the installer env
37
+ if not exist "%INSTALL_ENV_DIR%" (
38
+ echo Packages to install: %PACKAGES_TO_INSTALL%
39
+ call "%CONDA_ROOT_PREFIX%\_conda.exe" create --no-shortcuts -y -k --prefix "%INSTALL_ENV_DIR%" python=3.10 || ( echo. && echo Conda environment creation failed. && goto end )
40
+ )
41
+
42
+ @rem check if conda environment was actually created
43
+ if not exist "%INSTALL_ENV_DIR%\python.exe" ( echo. && echo Conda environment is empty. && goto end )
44
+
45
+ @rem activate installer env
46
+ call "%CONDA_ROOT_PREFIX%\condabin\conda.bat" activate "%INSTALL_ENV_DIR%" || ( echo. && echo Miniconda hook not found. && goto end )
47
+
48
+ @rem setup installer env
49
+ call python webui.py
50
+
51
+ echo.
52
+ echo Done!
53
+
54
+ :end
55
+ pause
update_linux.sh ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ cd "$(dirname "${BASH_SOURCE[0]}")"
4
+
5
+ if [[ "$(pwd)" =~ " " ]]; then echo This script relies on Miniconda which can not be silently installed under a path with spaces. && exit; fi
6
+
7
+ # config
8
+ CONDA_ROOT_PREFIX="$(pwd)/installer_files/conda"
9
+ INSTALL_ENV_DIR="$(pwd)/installer_files/env"
10
+
11
+ # activate installer env
12
+ source "$CONDA_ROOT_PREFIX/etc/profile.d/conda.sh" # otherwise conda complains about 'shell not initialized' (needed when running in a script)
13
+ conda activate "$INSTALL_ENV_DIR"
14
+
15
+ # update installer env
16
+ python webui.py --update
17
+
18
+ echo
19
+ echo "Done!"
update_macos.sh ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ cd "$(dirname "${BASH_SOURCE[0]}")"
4
+
5
+ if [[ "$(pwd)" =~ " " ]]; then echo This script relies on Miniconda which can not be silently installed under a path with spaces. && exit; fi
6
+
7
+ # config
8
+ CONDA_ROOT_PREFIX="$(pwd)/installer_files/conda"
9
+ INSTALL_ENV_DIR="$(pwd)/installer_files/env"
10
+
11
+ # activate installer env
12
+ source "$CONDA_ROOT_PREFIX/etc/profile.d/conda.sh" # otherwise conda complains about 'shell not initialized' (needed when running in a script)
13
+ conda activate "$INSTALL_ENV_DIR"
14
+
15
+ # update installer env
16
+ python webui.py --update
17
+
18
+ echo
19
+ echo "Done!"
update_windows.bat ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @echo off
2
+
3
+ cd /D "%~dp0"
4
+
5
+ echo "%CD%"| findstr /C:" " >nul && echo This script relies on Miniconda which can not be silently installed under a path with spaces. && goto end
6
+
7
+ set PATH=%PATH%;%SystemRoot%\system32
8
+
9
+ @rem config
10
+ set CONDA_ROOT_PREFIX=%cd%\installer_files\conda
11
+ set INSTALL_ENV_DIR=%cd%\installer_files\env
12
+
13
+ @rem activate installer env
14
+ call "%CONDA_ROOT_PREFIX%\condabin\conda.bat" activate "%INSTALL_ENV_DIR%" || ( echo. && echo Miniconda hook not found. && goto end )
15
+
16
+ @rem update installer env
17
+ call python webui.py --update
18
+
19
+ echo.
20
+ echo Done!
21
+
22
+ :end
23
+ pause
webui.py ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import argparse
2
+ import os
3
+ import subprocess
4
+ import sys
5
+
6
+ script_dir = os.getcwd()
7
+
8
+
9
+ def run_cmd(cmd, capture_output=False, env=None):
10
+ # Run shell commands
11
+ return subprocess.run(cmd, shell=True, capture_output=capture_output, env=env)
12
+
13
+
14
+ def check_env():
15
+ # If we have access to conda, we are probably in an environment
16
+ conda_not_exist = run_cmd("conda", capture_output=True).returncode
17
+ if conda_not_exist:
18
+ print("Conda is not installed. Exiting...")
19
+ sys.exit()
20
+
21
+ # Ensure this is a new environment and not the base environment
22
+ if os.environ["CONDA_DEFAULT_ENV"] == "base":
23
+ print("Create an environment for this project and activate it. Exiting...")
24
+ sys.exit()
25
+
26
+
27
+ def install_dependencies():
28
+ # Select your GPU or, choose to run in CPU mode
29
+ print("What is your GPU")
30
+ print()
31
+ print("A) NVIDIA")
32
+ print("B) AMD")
33
+ print("C) Apple M Series")
34
+ print("D) None (I want to run in CPU mode)")
35
+ print()
36
+ gpuchoice = input("Input> ").lower()
37
+
38
+ # Install the version of PyTorch needed
39
+ if gpuchoice == "a":
40
+ run_cmd(
41
+ "conda install -y -k pytorch[version=2,build=py3.10_cuda11.7*] torchvision torchaudio pytorch-cuda=11.7 cuda-toolkit ninja git -c pytorch -c nvidia/label/cuda-11.7.0 -c nvidia"
42
+ )
43
+ elif gpuchoice == "b":
44
+ print("AMD GPUs are not supported. Exiting...")
45
+ sys.exit()
46
+ elif gpuchoice == "c" or gpuchoice == "d":
47
+ run_cmd(
48
+ "conda install -y -k pytorch torchvision torchaudio cpuonly git -c pytorch"
49
+ )
50
+ else:
51
+ print("Invalid choice. Exiting...")
52
+ sys.exit()
53
+
54
+ # Clone webui to our computer
55
+ run_cmd("conda install -y -c pytorch ffmpeg") # LGPL
56
+ run_cmd("conda install -y -c conda-forge nodejs=18.16.1")
57
+ run_cmd("git clone https://github.com/rsxdalv/tts-generation-webui.git")
58
+
59
+ # Install the webui dependencies
60
+ update_dependencies()
61
+
62
+ def update_conda():
63
+ # Update conda
64
+ run_cmd("conda update -y -n base -c defaults conda")
65
+
66
+ def update_dependencies():
67
+ # Update the webui dependencies
68
+ os.chdir("tts-generation-webui")
69
+ run_cmd("git pull")
70
+ run_cmd("pip install -r requirements.txt")
71
+ run_cmd("python update.py")
72
+ os.chdir(script_dir)
73
+
74
+ # For tortoise tts, rvc
75
+ # run_cmd("conda install -y --channel=numba llvmlite")
76
+
77
+ def run_model():
78
+ os.chdir("tts-generation-webui")
79
+ run_cmd("python server.py") # put your flags here!
80
+
81
+
82
+ if __name__ == "__main__":
83
+ # Verifies we are in a conda environment
84
+ check_env()
85
+ # update_conda()
86
+
87
+ parser = argparse.ArgumentParser()
88
+ parser.add_argument("--update", action="store_true", help="Update the web UI.")
89
+ args = parser.parse_args()
90
+
91
+ if args.update:
92
+ update_dependencies()
93
+ else:
94
+ # If webui has already been installed, skip and run
95
+ if not os.path.exists("tts-generation-webui/"):
96
+ install_dependencies()
97
+ os.chdir(script_dir)
98
+
99
+ # Run the model with webui
100
+ run_model()