-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.ps1
More file actions
66 lines (54 loc) · 2.87 KB
/
Copy pathstart.ps1
File metadata and controls
66 lines (54 loc) · 2.87 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
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
#Requires -Version 5.1
<#
.SYNOPSIS
ImageForge — Windows RTX launcher (CUDA), PowerShell edition.
.DESCRIPTION
Creates/reuses a .venv, installs imageforge[console], and launches the app.
Targets Windows 10/11 + RTX 2000 Ada (Ada Lovelace) or any CUDA GPU.
No arch -arm64, no MPS — pure CUDA path.
.NOTES
PyTorch + CUDA must be installed once before first run:
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
Check https://pytorch.org/get-started/locally/ for the right CUDA version.
Run from the repo root:
.\start.ps1
or from anywhere:
& "C:\path\to\imageforge\start.ps1"
#>
Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'
# ── locate repo root (directory containing this script) ─────────────────────
$RepoRoot = $PSScriptRoot
# ── venv path (override with $env:IMAGEFORGE_VENV) ──────────────────────────
if (-not $env:IMAGEFORGE_VENV) {
$VenvPath = Join-Path $RepoRoot '.venv'
} else {
$VenvPath = $env:IMAGEFORGE_VENV
}
Write-Host "[imageforge] Repo root : $RepoRoot"
Write-Host "[imageforge] Venv : $VenvPath"
# ── create venv if absent ────────────────────────────────────────────────────
$VenvPython = Join-Path $VenvPath 'Scripts\python.exe'
if (-not (Test-Path $VenvPython)) {
Write-Host "[imageforge] Creating venv ..."
& python -m venv $VenvPath
if ($LASTEXITCODE -ne 0) {
Write-Error "python -m venv failed. Is Python 3.11+ on PATH?"
exit 1
}
}
# ── activate ─────────────────────────────────────────────────────────────────
$ActivateScript = Join-Path $VenvPath 'Scripts\Activate.ps1'
. $ActivateScript
# ── install / update the console extras ──────────────────────────────────────
Write-Host "[imageforge] Installing/updating imageforge[console] ..."
& pip install -e "$RepoRoot\.[console]" --quiet
if ($LASTEXITCODE -ne 0) {
Write-Error "pip install failed."
exit 1
}
# ── set CUDA device ───────────────────────────────────────────────────────────
$env:DEVICE = 'cuda'
# ── launch ────────────────────────────────────────────────────────────────────
Write-Host "[imageforge] Launching console (DEVICE=cuda) ..."
& python -m imageforge.console.app @args