forked from lshqqytiger/stable-diffusion-webui-amdgpu
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlaunch-sd.ps1
More file actions
41 lines (32 loc) · 1.49 KB
/
launch-sd.ps1
File metadata and controls
41 lines (32 loc) · 1.49 KB
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
# 🧠 Squad Launcher: AMD Ryzen 7 5700G + RX 6650 XT 8GB
$timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
$logPath = ".\logs\launch.log"
$resConfig = ".\configs\resolution.txt"
# 🔍 Detect VRAM
$gpuInfo = Get-CimInstance Win32_VideoController | Where-Object { $_.AdapterRAM -gt 0 }
$vramMB = [math]::Round($gpuInfo.AdapterRAM / 1MB)
# 📖 Read resolution
$resolution = if (Test-Path $resConfig) { Get-Content $resConfig | Select-Object -First 1 } else { "512x512" }
$resParts = $resolution -split "x"
$width = [int]$resParts[0]
$height = [int]$resParts[1]
# 🔘 Toggle VRAM mode
$vramMode = if ($width -ge 512 -or $height -ge 512) { "--medvram" } else { "--lowvram" }
# 🧠 Build flags
$flags = "--use-directml --precision full --no-half $vramMode --disable-nan-check --skip-torch-cuda-test --loglevel INFO"
# 🐦 Squawk if VRAM is low
$squawk = if ($vramMB -lt 8000) { "🔴 SQUAWK! VRAM below optimal threshold." } else { "🟢 VRAM OK." }
# 📊 Log launch
Add-Content $logPath "`n[$timestamp] VRAM: $vramMB MB"
Add-Content $logPath "Resolution: $resolution"
Add-Content $logPath "Mode: $vramMode"
Add-Content $logPath "Flags: $flags"
Add-Content $logPath "Status: $squawk"
Write-Host "🧠 VRAM: $vramMB MB"
Write-Host "📐 Resolution: $resolution"
Write-Host "🔘 Mode: $vramMode"
Write-Host "🚀 Launching with flags: $flags"
Write-Host "$squawk"
# 🚀 Inject flags and launch WebUI
[System.Environment]::SetEnvironmentVariable("COMMANDLINE_ARGS", $flags, "Process")
Start-Process ".\webui-user.bat"