File size: 4,963 Bytes
b86cad2 |
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 |
d@echo off
echo ========================================
echo Chatterbox TTS - Installation Setup
echo ========================================
echo.
echo This will install Chatterbox TTS in a virtual environment
echo to keep it isolated from other Python projects.
echo.
echo Requirements:
echo - Python 3.10 or higher
echo - NVIDIA GPU with CUDA support (recommended)
echo - Git (if you want to pull updates)
echo.
echo Current directory: %CD%
echo.
pause
echo.
echo [1/9] Checking Python installation...
python --version
if %errorlevel% neq 0 (
echo ERROR: Python is not installed or not in PATH
echo Please install Python 3.10+ from https://python.org
pause
exit /b 1
)
echo.
echo [2/9] Checking if we're in the correct directory...
if not exist "pyproject.toml" (
echo ERROR: pyproject.toml not found!
echo Please make sure you're running this from the chatterbox repository root.
echo Expected files: pyproject.toml, gradio_tts_app.py, src/chatterbox/
pause
exit /b 1
)
if not exist "src\chatterbox" (
echo ERROR: src\chatterbox directory not found!
echo Please make sure you're in the correct chatterbox repository.
pause
exit /b 1
)
echo Repository structure verified ✓
echo.
echo [3/9] Creating virtual environment...
if exist "venv" (
echo Virtual environment already exists. Removing old one...
rmdir /s /q venv
)
python -m venv venv
echo.
echo [4/9] Activating virtual environment...
call venv\Scripts\activate.bat
echo.
echo [5/9] Upgrading pip...
python -m pip install --upgrade pip
echo.
echo [6/9] Installing compatible PyTorch with CUDA support...
echo This may take a while (downloading ~2.5GB)...
echo Installing PyTorch 2.4.1 + torchvision 0.19.1 (compatible versions)...
pip install torch==2.4.1+cu121 torchvision==0.19.1+cu121 torchaudio==2.4.1+cu121 --index-url https://download.pytorch.org/whl/cu121
echo.
echo [7/9] Installing Chatterbox TTS and dependencies...
pip install -e .
pip install gradio
echo.
echo [8/9] Installing and configuring pydantic (tested version)...
echo Uninstalling any existing pydantic versions...
pip uninstall pydantic -y
echo Installing pydantic version 2.10.6 (tested and verified)...
pip install pydantic==2.10.6
echo Verifying pydantic installation...
pip show pydantic | findstr /C:"Version: 2.10.6"
if %errorlevel% neq 0 (
echo WARNING: Pydantic 2.10.6 installation may have issues.
echo Attempting alternative installation...
pip install pydantic==2.10.6 --force-reinstall
)
echo Installing numpy (compatible version)...
pip install numpy==1.26.0 --force-reinstall
echo.
echo [9/9] Testing installation...
echo Testing PyTorch and CUDA...
python -c "import torch; print('PyTorch version:', torch.__version__); print('CUDA available:', torch.cuda.is_available())"
if %errorlevel% neq 0 (
echo WARNING: PyTorch test failed. Trying to fix torchvision compatibility...
pip uninstall torchvision -y
pip install torchvision==0.19.1+cu121 --index-url https://download.pytorch.org/whl/cu121 --force-reinstall
echo Retesting...
python -c "import torch; print('PyTorch version:', torch.__version__); print('CUDA available:', torch.cuda.is_available())"
)
echo.
echo Testing Chatterbox import...
python -c "from chatterbox.tts import ChatterboxTTS; print('Chatterbox TTS imported successfully!')"
if %errorlevel% neq 0 (
echo WARNING: Chatterbox import failed. This might be a dependency issue.
echo The installation will continue, but you may need to troubleshoot.
echo Common fixes:
echo 1. Run install.bat again
echo 2. Check NVIDIA drivers are up to date
echo 3. Restart your computer
)
echo.
echo Testing pydantic compatibility...
python -c "import pydantic; print('Pydantic version:', pydantic.__version__)"
echo.
echo ========================================
echo Installation Complete!
echo ========================================
echo.
echo Virtual environment created at: %CD%\venv
echo.
echo Final system check...
python -c "import torch; print('GPU:', torch.cuda.get_device_name(0) if torch.cuda.is_available() else 'None')"
echo.
echo ========================================
echo Ready for Audiobooks!
echo ========================================
echo.
echo To start Chatterbox TTS:
echo 1. Run launch_audiobook.bat (recommended)
echo 2. Or manually: venv\Scripts\activate.bat then python gradio_tts_app_audiobook.py
echo.
echo Perfect for:
echo - Voice cloning for audiobook narration
echo - Multiple character voices
echo - Consistent voice quality across chapters
echo - Professional audiobook production
echo.
echo Note: If you encounter pydantic compatibility issues later,
echo you can run update.bat to specifically update pydantic.
echo.
echo Installation finished successfully!
pause |