Voice generator module #5

Merged
oleg.petruny merged 5 commits from VoiceGenerator into master 2024-12-13 16:41:19 +00:00
Showing only changes of commit b0d2231677 - Show all commits

View File

@ -1,19 +1,20 @@
$pythonVersion = "3.11.9"
$pythonInstallerUrl = "https://www.python.org/ftp/python/$pythonVersion/python-$pythonVersion-amd64.exe"
$pythonInstallerPath = "$env:TEMP\python-$pythonVersion-amd64.exe"
$pythonVersionShort = "3.11"
$pythonInstallerUrl = "https://www.python.org/ftp/python/${pythonVersion}/python-${pythonVersion}-amd64.exe"
$pythonInstallerPath = "$env:TEMP\python-${pythonVersion}.exe"
$pyActivate = Join-Path . "Scripts\Activate.ps1"
$espeakngVersion = "1.51"
$espeakngInstallerUrl = "https://github.com/espeak-ng/espeak-ng/releases/download/$espeakngVersion/espeak-ng-X64.msi"
$espeakngInstallerPath = "$env:TEMP\espeak-ng-X64.msi"
$espeakngInstallerUrl = "https://github.com/espeak-ng/espeak-ng/releases/download/${espeakngVersion}/espeak-ng-X64.msi"
$espeakngInstallerPath = "$env:TEMP\espeak-ng-${espeakngVersion}.msi"
$msBuildToolsVersion = "17"
$msBuildToolsInstallerUrl = "https://aka.ms/vs/$msBuildToolsVersion/release/vs_BuildTools.exe"
$msBuildToolsInstallerPath = "$env:TEMP\vs_BuildTools$msBuildToolsVersion.exe"
$msBuildToolsInstallerUrl = "https://aka.ms/vs/${msBuildToolsVersion}/release/vs_BuildTools.exe"
$msBuildToolsInstallerPath = "$env:TEMP\vs_BuildTools${msBuildToolsVersion}.exe"
$cudaToolkitVersion = "12.4.1_551.78"
$cudaToolkitInstallerUrl = "https://developer.download.nvidia.com/compute/cuda/12.4.1/local_installers/cuda_$cudaToolkitVersion_windows.exe"
$cudaToolkitInstallerPath = "$env:TEMP\cudaToolkit_$cudaToolkitVersion.exe"
$cudaToolkitInstallerUrl = "https://developer.download.nvidia.com/compute/cuda/12.4.1/local_installers/cuda_${cudaToolkitVersion}_windows.exe"
$cudaToolkitInstallerPath = "$env:TEMP\cudaToolkit_${cudaToolkitVersion}.exe"
$pytorchVersion = "CUDA 12.4"
$pytorchInstallCommand = "pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124"
@ -44,56 +45,58 @@ function Install-Python {
}
function Setup-Python-Environment {
python -m venv .
& $pyActivate
pip install --upgrade pip setuptools wheel
deactivate
py -$pythonVersionShort -m venv .
& $pyActivate
python -m pip install --upgrade pip setuptools wheel
deactivate
}
function Install-Espeakng {
Write-Output "Installing eSpeak-ng $espeakngVersion..."
Write-Output "Installing eSpeak-ng $espeakngVersion..."
Invoke-WebRequest -Uri $espeakngInstallerUrl -OutFile $espeakngInstallerPath
Start-Process -FilePath "msiexec.exe" -ArgumentList "/i `"$espeakngInstallerPath`" /quiet"
Start-Process -FilePath "msiexec.exe" -ArgumentList "/i `"$espeakngInstallerPath`" /passive" -Wait
Remove-Item $espeakngInstallerPath -Force
}
function Install-MsBuildTools {
Write-Output "Installing MS Build Tools $msBuildToolsVersion..."
Write-Output "Installing MS Build Tools $msBuildToolsVersion..."
Invoke-WebRequest -Uri $msBuildToolsInstallerUrl -OutFile $msBuildToolsInstallerPath
Start-Process -FilePath $msBuildToolsInstallerPath -ArgumentList `
"--quiet --wait --norestart --add Microsoft.VisualStudio.Workload.NativeDesktop" -Wait
"--passive --wait --norestart --add Microsoft.VisualStudio.Workload.VCTools --includeRecommended" -Wait
Remove-Item $msBuildToolsInstallerPath -Force
}
function Install-CUDA {
Write-Output "Installing CUDA Toolkit $cudaToolkitVersion..."
Write-Output "Installing CUDA Toolkit $cudaToolkitVersion..."
Invoke-WebRequest -Uri $cudaToolkitInstallerUrl -OutFile $cudaToolkitInstallerPath
Start-Process -FilePath $cudaToolkitInstallerPath -ArgumentList "--silent --toolkit" -Wait
Start-Process -FilePath $cudaToolkitInstallerPath -ArgumentList "-s -n" -Wait
Remove-Item $cudaToolkitInstallerPath -Force
}
function Install-PyTorch {
Write-Output "Installing PyTorch $pytorchVersion..."
Write-Output "Installing PyTorch $pytorchVersion..."
& $pyActivate
Invoke-Expression $pytorchInstallCommand
deactivate
Invoke-Expression "$pytorchInstallCommand --quiet"
deactivate
}
function Install-Coqui {
Write-Output "Installing Coqui $coquiVersion..."
Write-Output "Installing Coqui $coquiVersion..."
Invoke-WebRequest -Uri $coquiZipUrl -OutFile $coquiZipPath
Expand-Archive -Path $coquiZipPath -DestinationPath . -Force
Remove-Item $coquiZipPath -Force
& $pyActivate
cd coqui-ai-TTS-$coquiVersion
pip install -e .
deactivate
& $pyActivate
cd coqui-ai-TTS-$coquiVersion
pip install -e . --quiet
deactivate
cd ..
}
Write-Output "Starting voice environment installation."
Set-ExecutionPolicy Unrestricted
if (-not (Is-PythonInstalled)) {
Install-Python
}