Loom setup: install → fetch → serve
Bundled paths ? first shell action. Before running commands, set LOOM_SKILL_DIR in the shell to the
absolute directory containing this SKILL.md, using its path from the skill listing or read tool.
In Claude Code, run export LOOM_SKILL_DIR="${CLAUDE_SKILL_DIR}" (the host substitutes the path).
In Codex, Pi or another host, export LOOM_SKILL_DIR to the loaded file's directory. Use a
shell-compatible absolute path (Git Bash on Windows). Rebind before using another skill's commands
and in every new shell; it is not the working directory or SDK root. On Windows, use native C:/...
paths for file tools; /c/... paths belong to Git Bash. Never run an unresolved placeholder. Run bundled commands by quoted absolute path; do not run scripts/... from the working directory
or change into the installed skill tree. Install the complete Loom suite: sibling paths are required.
Read the loom umbrella skill's hard rules first (memory limits, --pool_backing=fixed / --memory_bytes,
binary approval).
1. Install (≈30 s with a warm pip cache, a few minutes cold)
bash "${LOOM_SKILL_DIR}/scripts/install_loom.sh" ~/loom # hrx-loom 0.2.0 from PyPI (wheel sha256 recorded)
bash "${LOOM_SKILL_DIR}/scripts/install_loom.sh" ~/loom 0.1.0 # hrx-loom 0.1.0 from PyPI (packages without an SDK pin)
bash "${LOOM_SKILL_DIR}/scripts/install_loom.sh" ~/loom 0.2.0rc1 # a GitHub pre-release (sha256-verified against its SHA256SUMS)
bash "${LOOM_SKILL_DIR}/scripts/install_loom.sh" ~/loom latest # newest PyPI release
bash "${LOOM_SKILL_DIR}/scripts/install_loom.sh" ~/loom ci-latest # newest main CI wheel (needs gh)The script:
- creates
~/loom/.venvwith the pinned wheel (hrx-loom[hf]0.2.0 from PyPI; the wheel's sha256 is recorded, and withghthe release commit; a pre-release comes from its GitHub release asset, checked againstSHA256SUMS, no gh or token needed), which provides loom-serve, loom-fetch, loom-test, loom-run, loom-compile, loom-benchmark, loom-opt, loom-format, etc. (Linux x86-64 glibc ≥ 2.39 and Windows 11 x86-64 wheels; no ROCm SDK needed); - clones
ROCm/hrx-loom-libraryto~/loom/libraryand checks out the catalog revision the SDK names inhrx_loom-*.dist-info/loom.json, so catalog cards and SDK agree; - creates
~/loom/.tools, a venv with gguf, numpy, tokenizers, requests, jinja2, fastapi, uvicorn and httpx for the port, benchmark and UI scripts.
Facts:
- Pin the version. The
loom-port-llmtemplates target one text ABI (text_*_v1exports). A newer release can change it; then registration fails with a "root symbol … was not found" error and the templates need the diff of the upstream tiny-text fixture between the two tags (seeloom-port-llm). loom-fetch --listshows the release's compatible catalog.- Windows: run the script from Git Bash; venvs use
Scripts/. See theloomskill's Windows section. ci-latest/ci:ARTIFACT_IDinstall development wheels from ROCm/hrx-system GitHub Actions artifacts (needsgh auth status; artifacts expire after about 90 days;gh run downloadfails on these zips, so the script usesgh api .../artifacts/<id>/zip).- NPU: the Qwen3-Embedding NPU program compiled only with the wheel from hrx-system PR
2259's CI (artifact 12623044407 at the time):
VENV_NAME=.venv-npu install_loom.sh ~/loom ci:12623044407. If that artifact has expired, look for a newer build whose NPU path compiles.
SDK pins (a package that needs another hrx-loom than the default)
A package carries "sdk": {hrx_loom, source (release|pypi|ci), branch, artifact_id, hrx_system_sha, wheel_sha256, expires} in its llm_config.json; a package without a pin means hrx-loom 0.1.0 (PyPI), explicitly, so
the published v0.1.0 cards keep running on it while the installer default is 0.2.0. (A catalog package takes it from its catalog.json.) Every script that installs
Loom for a package calls scripts/ensure_sdk.sh ROOT llm_config.json, which prints the root to use: ROOT when it already is
that wheel, else ROOT-<artifact id | version> (installed from the pinned wheel), so pinned and default SDKs coexist.
LOOM_VERSION set explicitly overrides the pin. A pypi or release pin never expires; CI artifacts expire (~90 days; sdk.expires), and an expired CI pin makes
ensure_sdk.sh fail. Refresh it before then: install_loom.sh ROOT-new ci-latest (or ci:ID), rerun the gates on that SDK, then
python3 scripts/sdk_pin.py stamp ROOT-new FILE for the kit's catalog.json and the published card's llm_config.json
(republish the card; the nightly reads the pin from the card). A PyPI release, once one has the features, replaces the pin.
2. Fetch a catalog model
cd ~/loom && . .venv/bin/activate
loom-fetch --list # the catalog of this SDK (its pinned revision: no checkout needed)
loom-fetch --model moonshine-ai/moonshine-streaming-tiny --preset=streaming --output=models/moonshine --no-input
loom-fetch --model Qwen/Qwen3.8-27B --preset=vision --output=models/qwen27b-vision --no-input --dry-run # size check first--model ID reads the catalog the installed SDK names (dist-info/loom.json), so a model and its programs always match the
SDK; with --preset omitted a multi-preset card answers preset: select explicitly (N choices).
Notes:
--dry-runprints what would be downloaded. Use it to check sizes against the memory budget.Weights come from Hugging Face; the HF cache (
~/.cache/huggingface/hub) is reused. Gated repos need the user to accept the license on the HF page first.To use your own library checkout instead of the SDK's catalog:
loom-fetch library/model/<org>/<name>/model.json ..., and if fetch complains about a card/lock mismatch add--origin=library=$PWD/libraryso program sources resolve against it.A published card fetches by repo:
loom-fetch huggingface:loom-fun/REPO[:PRESET] --output=NAME(the revision is resolved and pinned for you; the[hf]extra, installed byinstall_loom.sh, provides the Hugging Face client).Catalog models seen working on Strix Halo:
Model Kind Preset Qwen3.8-27B text + vision visionmoonshine-streaming-tiny ASR ( recognition)streamingkyutai/pocket-tts TTS ( speech)streamingkrea/Krea-2-Turbo image imageorimage-int8Qwen3-Embedding-0.6B embedding (NPU) embedding
3. Serve
S="${LOOM_SKILL_DIR}/scripts"
VENV=~/loom/.venv "$S/serve.sh" asr 8100 amdgpu 16000000000 ~/loom/models/moonshine/model.json
VENV=~/loom/.venv "$S/serve.sh" gpu 8100 amdgpu 53687091200 models/a/model.json models/b/model.json -- --parameter_idle_ms=60000
VENV=~/loom/.venv-npu "$S/serve.sh" npu 8101 'xdna://0?columns=8' 4000000000 models/qwen3-embedding/model.json -- --pool_backing=fixed
"$S/stop.sh" asrserve.sh waits until /v1/status reports every model registration: ready and
checks that its PID owns the port. If it reports failed, it prints the compile
diagnostics and stops the server. Logs, PIDs and ports go in ~/.cache/loom-serve/NAME.{log,pid,port}.
Use unique NAMEs. stop.sh refuses to kill a PID that is not a loom-serve.
Raw form: loom-serve '--device=amdgpu://?completion_spin_ns=4294967295' --listen=127.0.0.1:PORT --model=pkg/model.json --workers=8 --pool_backing=fixed [--preset=NAME] (the card's serving on Strix Halo and the R9700: the preset's context_capacity
KV and the weights are committed up front). The elastic option, for several models sharing one budget: --memory_bytes=N [--parameter_idle_ms=60000] instead of
--pool_backing=fixed (hrx-loom 0.2.0's elastic backing is 5-8 % slower on Strix prefill).
Active wait (the default on amdgpu). serve.sh turns amdgpu into
amdgpu://?completion_spin_ns=4294967295: while GPU work is in flight, Loom's amd-gpu-retire thread spins on the
completion signal instead of parking on the KFD interrupt (one core while busy, 0% CPU when idle). Strix Halo firmware
that ties the data-fabric and memory clocks to CPU activity (SMU 0x0a640600, BIOS 1.12, as on AMD DevLab) otherwise
holds FCLK/UCLK about 20% low while Loom's CPU sleeps, and Loom measures 10-45% slower (memory-bound kernels most).
llama.cpp is never affected: HIP keeps a core busy launching and waiting. With the active wait, energy per token
drops. The value is the SDK's maximum (uint32 nanoseconds, 4.29 s): the spin window restarts at each completion,
so a shorter one parks during multi-second long-prefill submissions. LOOM_ACTIVE_WAIT=0 serve.sh ... is the A/B arm
without it: on 0.2.x it passes --wait_mode=blocking (0.2's own default is an active 1 s window); on 0.1.x the SDK's default
(parked).
4. Use / inspect
curl -s localhost:8100/v1/status | python3 -m json.tool # per model: id, loom.kind, registration, compilation, parameters, status
curl -s localhost:8100/v1/chat/completions -H 'Content-Type: application/json' \
-d '{"model":"<id from status>","messages":[{"role":"user","content":"hi"}],"max_tokens":64}'Endpoints by loom.kind:
| Kind | Endpoint | Request |
|---|---|---|
text |
/v1/chat/completions |
Supports streaming and stream_options.include_usage. Reasoning arrives in reasoning_content. |
recognition |
/v1/audio/transcriptions |
Multipart, audio/pcm;rate=16000;channels=1. |
speech |
/v1/audio/speech |
Needs input and voice. {"response_format":"pcm"} gives 24 kHz s16le. |
image |
/v1/images/generations |
{"response_format":"b64_json","size":"512x512"}. |
embedding |
/v1/embeddings |
Transcription example. The server takes raw 16 kHz mono s16le PCM:
ffmpeg -loglevel error -i in.wav -ar 16000 -ac 1 -f s16le /tmp/x.pcm
curl -s localhost:8100/v1/audio/transcriptions -F model=moonshine-ai/moonshine-streaming-tiny \
-F "file=@/tmp/x.pcm;type=audio/pcm;rate=16000;channels=1" # -> {"text": "..."}TTS: curl -s localhost:8100/v1/audio/speech -H 'Content-Type: application/json' -d '{"model":"kyutai/pocket-tts","input":"Hello.","voice":"alba","response_format":"pcm"}' > out.pcm
returns 24 kHz s16le mono. voice is required. Voices are the card's voice/*.wav names
(alba, marius, anna, …). seed is optional.
The model field is the card's model.id, not a file name. Unknown models return
404, and unsupported fields are rejected rather than ignored.
Server behavior:
- Startup compiles the program, typically 10–60 s on a first run (cached afterwards).
- The first request loads weights lazily, so exclude it from timing.
- Special tokens are stripped from decoded output text. A control program that must
see structural tokens in the output needs them marked non-special in the
package's
tokenizer.json; seeloom-port-llm. - Upstream docs:
loom/docs/src/serving/workflows/{fetch-and-serve,serve-models,operate-model-server,observe-model-server}.mdin hrx-system.