-
Notifications
You must be signed in to change notification settings - Fork 6
/
install.ps1
69 lines (58 loc) · 2.02 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
# Change Working Directory
Set-Location $PSScriptRoot
$Env:HF_HOME = "huggingface"
$Env:PIP_DISABLE_PIP_VERSION_CHECK = 1
$Env:PIP_NO_CACHE_DIR = 1
function InstallFail {
Write-Output "Install failed"
Read-Host | Out-Null ;
Exit
}
function Check {
param (
$ErrorInfo
)
if (!($?)) {
Write-Output $ErrorInfo
InstallFail
}
}
# # Check whether Pylauncher is installed
# $list = (py --list 2> $null)
# if(!$?){
# InstallFail
# }
# # Check minor version of Python
# $requiredMinorVersion = "3\.10"
# if(!($list -match $requiredMinorVersion)){
# Check "Python 3.10 is not found. Please install Python 3.10.x later than 3.10.8"
# }
# # Check micro version of Python
# $requiredMicroVersion = "3\.10\.(8|9|([1-7]\d))"
# $pyVersion = py -3.10 --version
# if(!($pyVersion -match $requiredMicroVersion)){
# Check "Installed Python 3.10 is too old to install layerdivider. Please upgrade your Python 3.10"
# }
if (!(Test-Path -Path "venv")) {
Write-Output "creating venv..."
python -m venv venv
Check "create venv failed"
}
.\venv\Scripts\activate
Check "activate venv failed"
Write-Output "Installing requirement"
pip install -e audiocraft/.
$install_torch = Read-Host "Need install Torch+xformers? [1] for 2.1.0+cu121+xformers0.0.23,[2] for 2.1.1+cu121+xformers0.0.23 [1/2/n] (first use/default [1])"
if ($install_torch -ieq "1" -or $install_torch -eq ""){
pip install torchaudio==2.1.1+cu121 torch==2.1.1+cu121 --extra-index-url https://download.pytorch.org/whl/cu121
Check "torch install failed,please delete venv dir and rerun"
pip install -U -I --no-deps xformers==0.0.23
Check "xformers install failed"
}elseif ($install_torch -ieq "2") {
pip install -U --pre torch==2.1.2+cu121 torchaudio==2.1.2+cu121 --index-url https://download.pytorch.org/whl/nightly/cu121
Check "torch install failed,please delete venv dir and rerun"
pip install -U -I --pre --no-deps xformers
Check "xformers install failed"
}
Write-Output "Install Finished"
Read-Host | Out-Null ;