Spaces:
Runtime error
Runtime error
File size: 5,860 Bytes
1a942eb |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
#!/bin/bash
# shellcheck shell=bash
#
# Licensed under the MIT license
# <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
# option. This file may not be copied, modified, or distributed
# except according to those terms.
# Launcher script for Ultimate RVC on Debian-based linux systems.
# Currently only supports Ubuntu 22.04 and Ubuntu 24.04.
UV_PATH=$(pwd)/uv
VENV_PATH=$UV_PATH/.venv
export UV_UNMANAGED_INSTALL=$UV_PATH
export UV_PYTHON_INSTALL_DIR="$UV_PATH/python"
export UV_PYTHON_BIN_DIR="$UV_PATH/python/bin"
export VIRTUAL_ENV=$VENV_PATH
export UV_PROJECT_ENVIRONMENT=$VENV_PATH
export UV_TOOL_DIR="$UV_PATH/tools"
export UV_TOOL_BIN_DIR="$UV_PATH/tools/bin"
export GRADIO_NODE_PATH="$VENV_PATH/lib/python3.12/site-packages/nodejs_wheel/bin/node"
export PATH="$UV_PATH:$PATH"
main() {
command=$1
shift
case $command in
install)
sudo apt install -y python3-dev unzip
install_distro_specifics
install_cuda_124
curl -LsSf https://astral.sh/uv/0.5.0/install.sh | sh
uv run ./src/ultimate_rvc/core/main.py
;;
update)
git pull
;;
uninstall)
confirmation_msg=$(
cat <<- EOF
Are you sure you want to uninstall?
This will delete all dependencies and user-generated data [Y/n]:
EOF
)
read -r -p "$confirmation_msg" confirmation
if [[ "$confirmation" =~ ^([Yy]|)$ ]]; then
git clean -dfX
echo "Uninstallation complete."
else
echo "Uninstallation canceled."
fi
;;
run)
check_dependencies
uv run ./src/ultimate_rvc/web/main.py "$@"
;;
dev)
check_dependencies
uv run gradio ./src/ultimate_rvc/web/main.py --demo-name app
;;
cli)
check_dependencies
uv run ./src/ultimate_rvc/cli/main.py "$@"
;;
docs)
check_dependencies
if [ "$#" -ne 2 ]; then
echo "The 'docs' command requires two arguments."
exit 1
fi
uv run python -m typer "$1" utils docs --output "$2"
;;
uv)
check_dependencies
uv "$@"
;;
help)
show_help
;;
*)
cat <<- EOF
Invalid command.
Use './urvc help' to see available commands.
EOF
exit 1
;;
esac
}
install_distro_specifics() {
# shellcheck disable=SC1091
. /etc/lsb-release
case $DISTRIB_ID in
Ubuntu)
case $DISTRIB_RELEASE in
24.04)
# Add Ubuntu 23.10 repository to sources.list so that we can install cuda 12.1 toolkit
# first define the text to append to the file.
# For this we use a heredoc with removal of leading tabs
TEXT=$(
cat <<- EOF
## Added by Ultimate RVC installer
Types: deb
URIs: http://archive.ubuntu.com/ubuntu/
Suites: lunar
Components: universe
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
EOF
)
FILE=/etc/apt/sources.list.d/ubuntu.sources
# Append to file if not already present
grep -qxF "## Added by Ultimate RVC installer" $FILE || echo "$TEXT" | sudo tee -a $FILE
sudo apt update
;;
22.04)
sudo apt install clang -y
;;
*)
echo "Unsupported Ubuntu version"
exit 1
;;
esac
;;
*)
echo "Unsupported debian distribution"
exit 1
;;
esac
}
install_cuda_124() {
echo "Installing CUDA 12.4"
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb
sudo dpkg -i cuda-keyring_1.1-1_all.deb
sudo apt update
sudo apt -y install cuda-toolkit-12-4
rm -rf cuda-keyring_1.1-1_all.deb
echo "CUDA 12.4 has been installed successfully"
}
check_dependencies() {
if [ ! -d "$UV_PATH" ]; then
echo "Dependencies not found. Please run './urvc install' first."
exit 1
fi
}
show_help() {
cat <<- EOF
Usage: ./urvc.sh [OPTIONS] COMMAND [ARGS]...
Commands:
install Install dependencies and set up environment.
update Update Ultimate RVC to the latest version.
uninstall Uninstall dependencies and user generated data.
run Start Ultimate RVC.
options:
--help Show help message and exit.
[more information available, use --help to see all]
dev Start Ultimate RVC in development mode.
cli Start Ultimate RVC in CLI mode.
options:
--help Show help message and exit.
[more information available, use --help to see all]
docs Generate documentation using Typer.
arguments:
0 The module to generate documentation for.
1 The output directory.
uv Run an arbitary command using uv.
arguments:
0 The command to run.
[more information available, use --help to see all]
options:
--help Show help message and exit.
[more information available, use --help to see all]
help Show this message and exit.
EOF
}
main "$@"
|