File size: 1,870 Bytes
c46db52
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a7730a4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c46db52
 
a7730a4
c46db52
a7730a4
c46db52
a7730a4
 
c46db52
a7730a4
c46db52
 
 
a7730a4
c46db52
 
 
a7730a4
c46db52
 
 
 
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
$Env:HF_HOME = "huggingface"
$Env:PIP_DISABLE_PIP_VERSION_CHECK = 1
$Env:PIP_NO_CACHE_DIR = 1
$Env:PIP_INDEX_URL = "https://pypi.tuna.tsinghua.edu.cn/simple"
function InstallFail {
    Write-Output "��װʧ�ܡ�"
    Read-Host | Out-Null ;
    Exit
}

function Check {
    param (
        $ErrorInfo
    )
    if (!($?)) {
        Write-Output $ErrorInfo
        InstallFail
    }
}
if (Test-Path -Path "python\python.exe") {
    Write-Output "ʹ�� python �ļ����ڵ� python..."
    $py_path = (Get-Item "python").FullName
    $env:PATH = "$py_path;$env:PATH"
}
else {
    if (!(Test-Path -Path "venv")) {
        Write-Output "���ڴ������⻷��..."
        python -m venv venv
        Check "�������⻷��ʧ�ܣ����� python �Ƿ�װ����Լ� python �汾�Ƿ�Ϊ64λ�汾��python 3.10����python��Ŀ¼�Ƿ��ڻ�������PATH�ڡ�"
    }
    
    Write-Output "��⵽���⻷�������Լ���..."
    .\venv\Scripts\activate
    Check "�������⻷��ʧ�ܡ�"
}

Set-Location .\scripts
Write-Output "��װ������������ (�ѽ��й��ڼ��٣����ڹ�����޷�ʹ�ü���Դ�뻻�� install.ps1 �ű�)"
Write-Output "�����ڹ��ڼ��پ���torch ��װ�޷�ʹ�þ���Դ����װ��Ϊ������"
$install_torch = Read-Host "�Ƿ���Ҫ��װ Torch+xformers? [y/n] (Ĭ��Ϊ y)"
if ($install_torch -eq "y" -or $install_torch -eq "Y" -or $install_torch -eq "") {
    python -m pip install torch==2.4.1+cu124 torchvision==0.19.1+cu124 --extra-index-url https://download.pytorch.org/whl/cu124
    Check "torch ��װʧ�ܣ���ɾ�� venv �ļ��к��������С�"
    python -m pip install -U -I --no-deps xformers===0.0.28.post1 --extra-index-url https://download.pytorch.org/whl/cu124
    Check "xformers ��װʧ�ܡ�"
}

python -m pip install --upgrade -r requirements.txt
Check "sd-scripts ������װʧ�ܡ�"

Set-Location ..
python -m pip install --upgrade -r requirements.txt
Check "ѵ������������װʧ�ܡ�"

Write-Output "��װ���"
Read-Host | Out-Null ;