onwAMD / install.ps1
ryugyosoft's picture
onw AMD 0.1.0: LLMs on the AMD Ryzen AI NPU through FastFlowLM
d0bf6e2 verified
Raw History Blame Contribute Delete
2.79 kB
# onw AMD one-line installer for Windows. In PowerShell:
# irm https://huggingface.co/ryugyosoft/onwAMD/resolve/main/install.ps1 | iex
# Downloads onw AMD into %LOCALAPPDATA%\onw-amd (no git / hf needed) and runs setup.bat, which finds or installs Python,
# sets up the environment, adds "onw" to the Start menu and starts the tray app. Run it again to update onw.
$ErrorActionPreference = "Stop"
$ProgressPreference = "SilentlyContinue"
$repo = "ryugyosoft/onwAMD"
$dest = Join-Path $env:LOCALAPPDATA "onw-amd"
Write-Host ""
Write-Host "onw AMD - Ore no NPU ga konna ni ugoku wake nai (AMD Ryzen AI NPU)"
Write-Host "Installing into $dest ..."
function Get-WithRetry($uri, $out) {
for ($i = 1; $i -le 4; $i++) {
try {
if ($out) { Invoke-WebRequest -UseBasicParsing -Uri $uri -OutFile $out; return }
return Invoke-RestMethod $uri
} catch {
if ($i -eq 4) { throw }
Write-Host " retrying ($($_.Exception.Message)) ..."
Start-Sleep -Seconds (2 * $i)
}
}
}
if ($env:ONW_AMD_SOURCE) {
# a local copy instead of the hub (before onw AMD is published, or offline):
# $env:ONW_AMD_SOURCE = "D:\path\to\onw"; Get-Content "D:\path\to\onw\install.ps1" -Raw | iex
$src = (Resolve-Path $env:ONW_AMD_SOURCE).Path
Write-Host "Copying from $src ..."
$n = 0
Get-ChildItem -Path $src -Recurse -File | Where-Object {
$rel = $_.FullName.Substring($src.Length).TrimStart("\")
$rel -notmatch '^(\.git|\.venv|\.update)(\\|$)' -and $rel -notmatch '(^|\\)(__pycache__|[^\\]*\.egg-info)(\\|$)'
} | ForEach-Object {
$out = Join-Path $dest $_.FullName.Substring($src.Length).TrimStart("\")
New-Item -ItemType Directory -Force -Path (Split-Path $out) | Out-Null
Copy-Item $_.FullName $out -Force
$n++
}
Write-Host "Copied $n files. Starting setup (Python, packages, Start menu, tray) ..."
} else {
$info = Get-WithRetry "https://huggingface.co/api/models/$repo" $null
foreach ($s in $info.siblings) {
$f = $s.rfilename
if ($f -eq ".gitattributes") { continue }
$out = Join-Path $dest ($f -replace "/", "\")
New-Item -ItemType Directory -Force -Path (Split-Path $out) | Out-Null
Get-WithRetry "https://huggingface.co/$repo/resolve/main/$f" $out
}
Write-Host "Downloaded $($info.siblings.Count - 1) files. Starting setup (Python, packages, Start menu, tray) ..."
}
Set-Content -Path (Join-Path $dest ".onw-installed") -Value "installer" -Encoding ascii # onw may update itself here
Start-Process -FilePath (Join-Path $dest "setup.bat") -WorkingDirectory $dest
Write-Host "A setup window opened. When it finishes, onw AMD appears in the task tray and asks which model to download."