-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathInstall.ps1
99 lines (81 loc) · 3.39 KB
/
Install.ps1
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
$ErrorActionPreference = "Stop"
# Check for 64-bit Windows installation
if (-not [Environment]::Is64BitOperatingSystem) {
Write-Error "chiaSWARM requires a 64-bit Windows installation"
Exit 1
}
# Check for Visual C++ Runtime DLLs
$vcRuntime = Get-Item -ErrorAction SilentlyContinue "$env:windir\System32\msvcp140.dll"
if (-not $vcRuntime.Exists) {
$vcRuntimeUrl = "https://visualstudio.microsoft.com/downloads/#microsoft-visual-c-redistributable-for-visual-studio-2019"
Write-Error "Unable to find Visual C++ Runtime DLLs"
Write-Output "Download and install the Visual C++ Redistributable for Visual Studio 2019 package from: $vcRuntimeUrl"
Exit 1
}
# Check for Python
try {
$pythonVersion = (python --version).split(" ")[1]
}
catch {
Write-Error "Unable to find python"
$pythonUrl = "https://docs.python.org/3/using/windows.html#installation-steps"
Write-Output "Note the check box during installation of Python to install the Python Launcher for Windows."
Write-Output "Install Python from: $pythonUrl"
Exit 1
}
# Check for supported Python version
$supportedPythonVersions = "3.11", "3.10", "3.9", "3.8", "3.7"
if ($env:INSTALL_PYTHON_VERSION) {
$pythonVersion = $env:INSTALL_PYTHON_VERSION
}
else {
$pythonVersion = $null
foreach ($version in $supportedPythonVersions) {
try {
$pver = (python --version).split(" ")[1]
$result = $pver.StartsWith($version)
}
catch {
$result = $false
}
if ($result) {
$pythonVersion = $version
break
}
}
}
if (-not $pythonVersion) {
$supportedPythonVersions = ($supportedPythonVersions | ForEach-Object { "Python $_" }) -join ", "
Write-Error "No usable Python version found, supported versions are: $supportedPythonVersions"
Exit 1
}
# Print Python version
Write-Output "Python version is: $pythonVersion"
# remove the venv if it exists
if (Test-Path -Path ".\venv" -PathType Container) {
Remove-Item -LiteralPath ".\venv" -Recurse -Force
}
python -m venv venv
.\venv\scripts\activate
python.exe -m pip install --upgrade pip
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
python -m pip install wheel setuptools
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
python -m pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu118
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
python -m pip install diffusers[torch] transformers accelerate scipy ftfy safetensors moviepy opencv-python sentencepiece peft
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
python -m pip install aiohttp concurrent-log-handler pydub controlnet_aux qrcode matplotlib PyWavelets
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
pip install --no-deps invisible-watermark
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
python -m pip install git+https://github.com/suno-ai/bark.git@main
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
Write-Output ""
Write-Output "Audio conversion to mp3 requires ffmpeg"
Write-Output "Install ffmpeg from an elevated command prompt with the following command:"
Write-Output "choco install ffmpeg"
Write-Output ""
Write-Output "chiaSWARM worker installation is now complete."
Write-Output ""
Write-Output "Type '.\venv\scripts\activate' and then 'python -m swarm.initialize' to begin."