diff --git a/README.md b/README.md index 65af2ee..2e5c6ce 100644 --- a/README.md +++ b/README.md @@ -57,9 +57,18 @@ python --version # 3.8 <= Python < 3.11 ### MacOS One-click Dependency Installation & Startup Script By executing `run.sh` in the project root directory, you can configure the `venv` virtual environment, automatically install the required dependencies, and start the main program with one click. + +#### Quick Start (without models) ```bash sh ./run.sh ``` +This will start the application. If models are missing, you'll need to download them first - see "Automatic Download" under the Assets section below. + +#### First-time Setup (with automatic model download) +```bash +sh ./run.sh --download-models +``` +This will download all required models before starting the application. This is recommended for first-time setup and may take several minutes depending on your internet connection. ### Manual Installation of Dependencies 1. Install `pytorch` and its core dependencies, skip if already installed. Refer to: https://pytorch.org/get-started/locally/ @@ -75,12 +84,27 @@ sh ./run.sh ## Preparation of Other Files ### 1. Assets > RVC requires some models located in the `assets` folder for inference and training. -#### Check/Download Automatically (Default) + +#### Automatic Download (Recommended) +The easiest way to download all required models is using the included download script: +```bash +python download_models.py +``` + +Or use the run.sh script with the --download-models flag: +```bash +sh ./run.sh --download-models +``` + +#### Check/Download via Web Interface > By default, RVC can automatically check the integrity of the required resources when the main program starts. > Even if the resources are not complete, the program will continue to start. -- If you want to download all resources, please add the `--update` parameter. +- If you want to download all resources when starting the web interface, please add the `--update` parameter: + ```bash + python web.py --update + ``` - If you want to skip the resource integrity check at startup, please add the `--nocheck` parameter. #### Download Manually @@ -121,14 +145,26 @@ If you want to use the latest RMVPE vocal pitch extraction algorithm, you need t ``` ## Getting Started +### MacOS (Recommended) +For first-time setup with automatic model download: +```bash +./run.sh --download-models +``` + +For subsequent runs: +```bash +./run.sh +``` + ### Direct Launch Use the following command to start the WebUI. ```bash python web.py ``` -### MacOS + +To download all required models before starting: ```bash -./run.sh +python web.py --update ``` ## Credits @@ -151,12 +187,12 @@ A macOS-optimized version of the Retrieval-based Voice Conversion WebUI, specifi ## Features - Voice conversion with high-quality results +- Easy automated setup with automatic model download - Optimized for Apple Silicon (M1/M2/M3) Macs - User-friendly web interface - Support for various audio formats - Real-time voice conversion - Training capabilities for custom voice models -- All required models included - no additional downloads needed! ## Requirements @@ -168,6 +204,27 @@ A macOS-optimized version of the Retrieval-based Voice Conversion WebUI, specifi ## Installation +### Option 1: Quick Setup with run.sh (Recommended) + +1. Clone this repository: +```bash +git clone https://github.com/audiohacking/RVC-WebUI-MacOS.git +cd RVC-WebUI-MacOS +``` + +2. Run the setup script with automatic model download: +```bash +sh ./run.sh --download-models +``` + +This will automatically: +- Create a virtual environment +- Install all dependencies +- Download all required models +- Start the web interface + +### Option 2: Manual Installation + 1. Clone this repository: ```bash git clone https://github.com/audiohacking/RVC-WebUI-MacOS.git @@ -185,16 +242,30 @@ source .venv/bin/activate pip install -r requirements/gui.txt ``` -> **Note**: This repository includes all necessary model files. You don't need to download any additional models. However, if you want to use different models, you can download them from the original repository. +4. Download models: +```bash +python web.py --update +``` ## Usage -1. Start the web interface: +### Using run.sh (Recommended) +```bash +./run.sh +``` + +### Manual Launch +1. Activate the virtual environment: +```bash +source .venv/bin/activate +``` + +2. Start the web interface: ```bash python web.py --port 7860 ``` -2. Open your web browser and navigate to: +3. Open your web browser and navigate to: ``` http://localhost:7860 ``` diff --git a/download_models.py b/download_models.py new file mode 100644 index 0000000..d3617d0 --- /dev/null +++ b/download_models.py @@ -0,0 +1,75 @@ +#!/usr/bin/env python3 +""" +Script to download all required models for RVC-WebUI-MacOS. +This script downloads models without starting the web interface. +""" +import os +import sys +import shutil +from dotenv import load_dotenv + +# Add current directory to path +now_dir = os.getcwd() +sys.path.append(now_dir) + +# Load environment variables +load_dotenv() +load_dotenv("sha256.env") + +# Create temp directory +tmp = os.path.join(now_dir, "TEMP") +shutil.rmtree(tmp, ignore_errors=True) +os.makedirs(tmp, exist_ok=True) + +# Import model checking and downloading functions +from infer.lib.rvcmd import check_all_assets, download_all_assets + +print("=" * 60) +print("RVC-WebUI-MacOS Model Downloader") +print("=" * 60) +print() + +# Check if models are already present +print("Checking for existing models...") +if check_all_assets(update=False): + print("✓ All required models are already present!") + print(" No download needed.") + sys.exit(0) + +print() +print("Some models are missing or outdated.") +print("Starting download process...") +print("This may take several minutes depending on your connection.") +print() + +try: + # Download all assets + download_all_assets(tmpdir=tmp) + + # Verify download was successful + print() + print("Verifying downloaded models...") + if check_all_assets(update=True): + print() + print("=" * 60) + print("✓ SUCCESS! All models downloaded successfully!") + print("=" * 60) + print() + print("You can now run: ./run.sh") + sys.exit(0) + else: + print() + print("⚠ Warning: Some models may not have downloaded correctly.") + print(" You may want to try running this script again.") + print(" The application may have limited functionality without all models.") + sys.exit(2) + +except Exception as e: + print() + print(f"✗ Error during download: {e}") + print(" You can try running this script again, or download models manually.") + print(" See README.md for manual download instructions.") + sys.exit(1) +finally: + # Cleanup + shutil.rmtree(tmp, ignore_errors=True) diff --git a/run.sh b/run.sh index f011baf..eef624b 100755 --- a/run.sh +++ b/run.sh @@ -11,6 +11,18 @@ fi requirements_file="requirements/main.txt" venv_path=".venv" +# Parse command line arguments +download_models=false +for arg in "$@"; do + case $arg in + --download-models) + download_models=true + ;; + *) + ;; + esac +done + if [[ ! -d "${venv_path}" ]]; then echo "Creating venv..." @@ -23,5 +35,32 @@ fi echo "Activating venv..." source "${venv_path}/bin/activate" +# Download models if requested +if [ "$download_models" = true ]; then + echo "" + echo "Running model downloader..." + python download_models.py + download_exit_code=$? + + if [ $download_exit_code -eq 0 ]; then + echo "" + echo "Models are ready!" + elif [ $download_exit_code -eq 2 ]; then + echo "" + echo "Note: Model download completed with warnings." + echo "Some models may not have downloaded correctly." + else + echo "" + echo "Error: Model download failed." + echo "Please check the error messages above and try again." + exit 1 + fi + + echo "" + read -p "Press Enter to continue and start the application..." + echo "" +fi + # Run the main script +echo "Starting RVC WebUI..." python web.py --pycmd python