Download install.sh from ryugyosoft/onwAMD: direct link, hf CLI and curl.
- Browser
- Download file 1.98 kB
-
https://huggingface.co/ryugyosoft/onwAMD/resolve/main/install.sh
- Command line
-
hf download hf://ryugyosoft/onwAMD/install.sh
-
curl -L -o install.sh https://huggingface.co/ryugyosoft/onwAMD/resolve/main/install.sh
1.98 kB
| # onw AMD one-line installer for Ubuntu. In a terminal: | |
| # curl -fsSL https://huggingface.co/ryugyosoft/onwAMD/resolve/main/install.sh | bash | |
| # Downloads onw AMD into ~/onw-amd (no git / hf needed) and runs setup.sh (system packages, Python environment, | |
| # application list entry, top-bar app). Run it again to update onw. | |
| set -e | |
| repo="ryugyosoft/onwAMD" | |
| dest="$HOME/onw-amd" | |
| echo | |
| echo "onw AMD - Ore no NPU ga konna ni ugoku wake nai (AMD Ryzen AI NPU)" | |
| echo "Installing into $dest ..." | |
| python3 - "$repo" "$dest" <<'PY' | |
| import json, os, sys, time, urllib.request | |
| repo, dest = sys.argv[1], sys.argv[2] | |
| def fetch(url, tries=4): # the hub redirects to a CDN; a reset connection is retried | |
| for i in range(tries): | |
| try: | |
| with urllib.request.urlopen(url, timeout=60) as r: | |
| return r.read() | |
| except Exception as e: | |
| if i == tries - 1: | |
| raise | |
| print(f" retrying ({e}) ...", flush=True) | |
| time.sleep(2 * (i + 1)) | |
| info = json.loads(fetch(f"https://huggingface.co/api/models/{repo}")) | |
| files = [s["rfilename"] for s in info["siblings"] if s["rfilename"] != ".gitattributes"] | |
| for f in files: | |
| out = os.path.join(dest, f) | |
| os.makedirs(os.path.dirname(out), exist_ok=True) | |
| data = fetch(f"https://huggingface.co/{repo}/resolve/main/{f}") | |
| if f.endswith((".sh", ".py", ".toml", ".txt", ".md", ".html")): | |
| data = data.replace(b"\r\n", b"\n") # scripts must have Unix line endings | |
| with open(out, "wb") as fh: | |
| fh.write(data) | |
| open(os.path.join(dest, ".onw-installed"), "w").write("installer\n") # onw may update itself here | |
| print(f"Downloaded {len(files)} files.") | |
| PY | |
| cd "$dest" | |
| if [ -r /dev/tty ] && [ -w /dev/tty ]; then | |
| bash setup.sh </dev/tty # piped from curl: setup's questions (sudo) read the terminal | |
| else | |
| bash setup.sh # no terminal (a script, CI): run as is | |
| fi | |