-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.ps1
More file actions
47 lines (40 loc) · 2.76 KB
/
Copy pathsetup.ps1
File metadata and controls
47 lines (40 loc) · 2.76 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
<#
One-shot setup for the SHARP Image2Splat service on a fresh Windows + NVIDIA host.
Prerequisites (install these first): Python 3.13 (`py -3.13` on PATH), git, and a recent
NVIDIA driver. Then, from the repo root:
powershell -ExecutionPolicy Bypass -File setup.ps1 # install, then run in the foreground
powershell -ExecutionPolicy Bypass -File setup.ps1 -AutoStart # install, then register the boot Scheduled Task
powershell -ExecutionPolicy Bypass -File setup.ps1 -NoRun # install only
Older CUDA? point at a matching torch wheel index, e.g.:
powershell -ExecutionPolicy Bypass -File setup.ps1 -TorchIndex https://download.pytorch.org/whl/cu121
This wraps service\install.ps1 (clones ml-sharp @ the pin, builds the venv, forces the CUDA
torch build, installs OpenEXR, verifies) and then starts the service or registers auto-start.
#>
param(
[string]$TorchIndex = "https://download.pytorch.org/whl/cu128",
[string]$TorchSpec = "torch==2.8.0 torchvision==0.23.0",
[string]$PythonExe = "", # interpreter for the venv (default: auto-detect, prefers 3.13)
[switch]$AutoStart, # register the boot Scheduled Task (self-elevates; no password needed by default)
[ValidateSet("Auto", "S4U", "Password", "System")]
[string]$LogonType = "Auto", # how the boot task authenticates; see service\install-autostart.ps1
[switch]$NoRun # install only; don't start the service
)
$ErrorActionPreference = "Stop"
$Root = $PSScriptRoot
$Service = Join-Path $Root "service"
Write-Host "== SHARP Image2Splat one-shot setup ==" -ForegroundColor Cyan
# 1) Install: ml-sharp @ pin, venv, deps, CUDA torch, OpenEXR, verify.
& (Join-Path $Service "install.ps1") -TorchIndex $TorchIndex -TorchSpec $TorchSpec -PythonExe $PythonExe
# 2) Start it.
if ($AutoStart) {
Write-Host "`nRegistering boot auto-start (self-elevates via UAC; no password needed by default) ..." -ForegroundColor Cyan
& (Join-Path $Service "install-autostart.ps1") -LogonType $LogonType
$reg = Get-ScheduledTask -TaskName "SHARP Image2Splat" -ErrorAction SilentlyContinue
if ($reg) { Write-Host ("`nAuto-start registered (state: " + $reg.State + "). Starts at boot. Verify: Invoke-RestMethod http://localhost:8765/health") -ForegroundColor Green }
else { Write-Host "`nAuto-start task not found - the UAC prompt may have been declined. Re-run elevated: powershell -ExecutionPolicy Bypass -File service\install-autostart.ps1" -ForegroundColor Yellow }
} elseif ($NoRun) {
Write-Host "`nInstall complete. Start it with: powershell -ExecutionPolicy Bypass -File service\run.ps1" -ForegroundColor Green
} else {
Write-Host "`nStarting the service in this window (Ctrl+C to stop) ..." -ForegroundColor Cyan
& (Join-Path $Service "run.ps1")
}