Download install.sh from ryugyosoft/onw-image: direct link, hf CLI and curl.
- Browser
- Download file 2 kB
-
https://huggingface.co/ryugyosoft/onw-image/resolve/main/install.sh
- Command line
-
hf download hf://ryugyosoft/onw-image/install.sh
-
curl -L -o install.sh https://huggingface.co/ryugyosoft/onw-image/resolve/main/install.sh
2 kB
| # onw-Image one-line installer for Ubuntu (Intel Core Ultra with NPU). In a terminal: | |
| # curl -fsSL https://huggingface.co/ryugyosoft/onw-image/resolve/main/install.sh | bash | |
| # Downloads onw-Image into ~/onw-image (no git / hf needed) and runs setup.sh (system packages, Python environment, | |
| # the model, application list entry). Run it again to update. ONW_IMAGE_HOME=<dir> installs elsewhere. | |
| set -e | |
| repo="ryugyosoft/onw-image" | |
| dest="${ONW_IMAGE_HOME:-$HOME/onw-image}" | |
| echo | |
| echo "onw-Image - Z-Image-Turbo on the Intel 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" and not s["rfilename"].startswith("images/")] | |
| 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", ".txt", ".md", ".html", ".js", ".json", ".svg")): | |
| data = data.replace(b"\r\n", b"\n") # scripts must have Unix line endings | |
| with open(out, "wb") as fh: | |
| fh.write(data) | |
| print(f"Downloaded {len(files)} files.") | |
| PY | |
| cd "$dest" | |
| if { : </dev/tty; } 2>/dev/null; then # a real terminal: setup can ask for the sudo password | |
| bash setup.sh </dev/tty # piped from curl: setup's questions (sudo) read the terminal | |
| else | |
| bash setup.sh | |
| fi | |