File size: 3,925 Bytes
c8be32d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/bin/bash
#
# Launcher script for Ultimate RVC on Debian-based linux systems.
# Currently only supports Ubuntu 22.04 and Ubuntu 24.04.
DEPS_PATH="./dependencies"
VENV_PATH="$DEPS_PATH/.venv"
BIN_PATH="$VENV_PATH/bin"
main() {
    case $1 in
        install)
            echo "Installing Ultimate RVC"
            sudo apt install -y build-essential software-properties-common
            install_distro_specifics
            install_cuda_121
            sudo add-apt-repository -y ppa:deadsnakes/ppa
            sudo apt install -y python3.11 python3.11-dev python3.11-venv
            sudo apt install -y sox libsox-dev ffmpeg
            rm -rf $DEPS_PATH
            curl -LJ -o ./dependencies/fairseq-0.12.2-cp311-cp311-linux_x86_64.whl --create-dirs \
                https://huggingface.co/JackismyShephard/ultimate-rvc/resolve/main/fairseq-0.12.2-cp311-cp311-linux_x86_64.whl
            python3.11 -m venv $VENV_PATH --upgrade-deps
            . $BIN_PATH/activate
            pip cache purge
            pip install -r requirements.txt
            pip install faiss-cpu==1.7.3
            python ./src/init.py
            deactivate
            echo
            echo "Ultimate RVC has been installed successfully"
            exit 0
            ;;
        run)
            echo "Starting Ultimate RVC"
            $BIN_PATH/python ./src/app.py
            exit 0
            ;;
        update)
            echo "Updating Ultimate RVC"
            git pull
            rm -rf $VENV_PATH
            python3.11 -m venv $VENV_PATH --upgrade-deps
            . $BIN_PATH/activate
            pip cache purge
            pip install -r requirements.txt
            pip install faiss-cpu==1.7.3
            deactivate
            echo
            echo "Ultimate RVC has been updated successfully"
            exit 0
            ;;
        dev)
            echo "Starting Ultimate RVC in development mode"
            $BIN_PATH/gradio ./src/app.py --demo-name app
            exit 0
            ;;
        *)
            echo "Usage ./urvc.sh [install|run|update|dev]"
            exit 1
            ;;
    esac
}

install_distro_specifics() {
    . /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

                    # sed command removes leading whitespace from subsequent lines
                    TEXT=$(sed 's/^[[:space:]]*//' <<< "\
                    ##
                    ## 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"
                    )
                    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 add-apt-repository -y ppa:ubuntuhandbook1/ffmpeg6
                    ;;
                *)
                    echo "Unsupported Ubuntu version"
                    exit 1
                    ;;
            esac
            ;;
        *)
            echo "Unsupported debian distribution"
            exit 1
            ;;
    esac
}

install_cuda_121() {
    echo "Installing CUDA 12.1"
    wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.0-1_all.deb
    sudo dpkg -i cuda-keyring_1.0-1_all.deb
    sudo apt-get update
    sudo apt-get -y install cuda-toolkit-12-1
    rm -rf cuda-keyring_1.0-1_all.deb
    echo "CUDA 12.1 has been installed successfully"
}

main $@