/loom:loom-port-imagefrom loom
Ports a diffusers text-to-image model (DiT, text encoder, VAE) to AMD Loom with same-noise oracle, per-stage kernel tests, quality metrics (PSNR/LPIPS/CLIPScore/PickScore), and timing against sd.cpp/thenoise/diffusers.
Ships in loom. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
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.
The goal is a package directory that loom-serve --model=PKG/model.json serves as an
OpenAI-style /v1/images/generations endpoint:
model.json.lock
and fetched from the publisher's repository, never re-uploaded;image_check passes: decoded images bit-exact against pinned digests, invalid requests
rejected, clean shutdown, plus the --lifecycle and bounded-workspace presets;Start from a pinned hand-written card in ROCm/hrx-loom-library. Each card's README describes its program composition. Reuse catalog motifs from the same revision.
To check out the same Z-Image catalog source used in DevLab, create a new catalog directory and
fetch the immutable revision. For Krea 2, use revision 279afe368b82e0d7acfe38c4f47e8e7e5cfb7bc8
and path model/krea/Krea-2-Turbo.
CATALOG="$PWD/hrx-image-catalog"
git init -q "$CATALOG"
git -C "$CATALOG" fetch --depth=1 https://github.com/ROCm/hrx-loom-library.git ccd62d6a49576f25efdb7deef7b6f81a7b76fd6c
git -C "$CATALOG" checkout --detach FETCH_HEAD
CATALOG_CARD="$CATALOG/model/Tongyi-MAI/Z-Image-Turbo"
hrx-loom 0.3.0 wheel with loom-setup. Keep the installer record
loom-install.json with the test evidence. On Linux x86-64 (glibc ≥ 2.39) the release wheel
SHA-256 is 6252bb0df262351175bdb2c4aaca22ffa63d80d791659aa4d2fa5c92a0af426f.diffusers, transformers, open_clip_torch and lpips
for the oracle and quality metrics. Keep it separate from the SDK venv. The Z-Image check uses
PyTorch 2.14.0+rocm10.1.0rc2, Diffusers 0.43.0, Transformers 5.24.0, NumPy 2.5.5,
scikit-image 0.26.0 and LPIPS 0.1.4.LOOM_IMAGE_SDK="$PWD/loom-image-sdk-0.3.0"
bash "${LOOM_SKILL_DIR}/../loom-setup/scripts/install_loom.sh" "$LOOM_IMAGE_SDK" 0.3.0
source "$LOOM_IMAGE_SDK/.venv/bin/activate"
loom-serve --version
Oracle with Loom's noise. Loom draws the initial latents with Philox4x32-10
(motif/tensor/random.loom). scripts/philox_noise.py reproduces that draw in NumPy for a
latent shape and seed; scripts/oracle_diffusers.py runs the diffusers pipeline from those
latents and saves the image plus per-stage tensors (prompt embeddings, each transformer step,
the final latent). Use --offload-text-encoder for the Z-Image Strix Halo reference.
This keeps the denoiser on ROCm and decodes on CPU in FP32 using the original VAE input
precision and scaling. Match the decode device and precision when comparing oracle runs.
Without shared noise, compare distributional scores.
Read the checkpoint, not the paper. List every tensor (safetensors header) and map it to a
command.parameter name before writing the card. Pin geometry rules from the pipeline code
(patch size, latent channels, allowed sizes) rather than from documentation.
Kernels by stage, smallest fixture first. Text encoder block, one transformer block, one VAE
tile. Each kernel gets a loom-test against a fixture cut from the oracle's stage tensors, with
errors reported relative to the output RMS so near-zero rows do not dominate. Reuse library
motifs (linear_tiled, linear_wide, attention_expanded, rmsnorm, rotary, modulation);
one kernel per contraction shape keeps shape scalars out of the device ABI.
Motif tests link their references and dependencies explicitly, for example
loom-test linear_wide_test.loom --library=bf16_reference_test.loom --library=linear_reference_test.loom --library=../linear_wide.loom --library=../linear_tiled.loom --device=rdna://0.
On Git Bash set MSYS_NO_PATHCONV=1 so --library=../x.loom is not rewritten.
Card. model.json (variants, presets such as image, image-bounded-workspace, lifecycle)
and model.json.lock via loom-fetch --update-lock. scripts/loom_deps.py program/ prints the
BUILD dependency list per program file. Follow the directory convention in
docs/model-authoring.md.
Gates. Copy test/image_check.py from the closest card, generate test/reference.json
digests from a run you have checked against the oracle, then run image_check, --lifecycle
and the bounded preset. Pinned digests are only meaningful after step 6 passes on the same build.
Quality against the oracle. scripts/metrics.py scores a directory of cases
(<prompt>_s<seed>_<WxH>/image.png): PSNR and LPIPS against diffusers fp32 and bf16 on the same
noise (pass parity TEST REF --same-noise after checking the initial latent), CLIPScore
(open_clip ViT-L-14/openai) and PickScore (yuvalkirstain/PickScore_v1), and a
bootstrap (10,000 resamples) of the mean paired per-case PickScore difference against diffusers
bf16. A confidence interval that spans 0 is "no measurable difference".
Time it locally. scripts/bench_images.py times request in, PNG out over HTTP for Loom, Lemonade
(stable-diffusion.cpp ROCm and Vulkan, thenoise) and a hand-started sd-server, on the fixed
prompt set in reference/prompts.json (8 prompts × seeds 0, 42, 1234). Use --alternate
(below). Keep every run in your log; the card publishes the final build's timings.
Optimize with loom-optimize and the profile from loom-serve --device_profiling_mode=dispatch-events,executable-metadata.
Re-run steps 5 to 7 after every build you keep; keep each build's timing and quality in your own log.
Card. scripts/stage_hf.py turns the hrx-loom-library card into a self-contained
package (motifs copied under library/motif/, Bazel archive program set dropped, checkpoint
origins kept). Write README.md and REPORT.md from reference/card-template.md
(performance and accuracy, best value per column in bold). Stage and qualify in new directories:
STAGED="$PWD/staged-z-image"
MATERIALIZED="$PWD/materialized-z-image"
python3 "${LOOM_SKILL_DIR}/scripts/stage_hf.py" "$CATALOG_CARD" "$STAGED"
loom-fetch "$STAGED/model.json" --preset=image --materialize=share --output="$MATERIALIZED" --no-input
loom-serve --device=amdgpu --model="$MATERIALIZED/model.json" --listen=127.0.0.1:8211
From a second terminal, wait for the model's registration to become ready at /v1/status
before sending the seed-0 Z-Image request.
curl -fsS http://127.0.0.1:8211/v1/status
curl -fsS http://127.0.0.1:8211/v1/images/generations \
-H 'Content-Type: application/json' \
-d '{"model":"Tongyi-MAI/Z-Image-Turbo","prompt":"a red fox in the snow","seed":0,"size":"384x384","response_format":"b64_json"}' \
-o z-image-response.json
Run the source card's
image_check.py on the materialized document, including the lifecycle and bounded-workspace
presets when present. After uploading to staging, repeat fetch and qualification against
the immutable staged revision.
These rules keep timings comparable from build to build and backend to backend, and they are what the card's Methodology list reports.
steps
and cfg_scale to Lemonade. Its stable-diffusion.cpp wrapper translates them to
sd_cpp_extra_args.sample_params for the actual backend. Direct sd-server requires the nested tag.
For Loom, verify denoising_steps in the served card and supply
--loom-guidance LABEL=G from the pinned program when guidance is absent from its interface.
Supply --loom-card LABEL=PATH when timing an existing Loom process.
For a TheNoise checkpoint whose guidance 1.0 disables CFG, use --thenoise-cfg-free LABEL
to translate a comparison value of zero to 1.0 on that target. Record both values.sd-server or loom-url target in its own block with other image
backends stopped. The script rotates and unloads multiple targets only when it manages their
residency.sd-server (--diffusion-fa, a GGUF quant). Report configurations
Lemonade does not ship (thenoise torch.compile, INT8) as separate rows.python3 "${LOOM_SKILL_DIR}/../loom-kb/kb.py" route --arch z-image --device strix-halo --topic image-porting,kernels-ir
prints the diffusion architecture and device facts alongside the shared kernel guidance.
Use --arch flux2 or --arch krea2 for those pipelines.
/v1/images/generations with the input as base64 raw RGB in prompt and the output size in size:
check the prompt length and alphabet on the host in @image_prepare_request_v1 and decode on the
device, ship a tokenizer whose vocabulary is the base64 alphabet (the image service requires one),
and expect an RGBA reply.Declare the scope first, work inside it, opt in by scope, run fleet/scope_lint.py before a PR, stop on
out-of-mandate needs: the rules are in loom-kb/SKILL.md ("Mandate rules").
reference/card-template.md (opens in a new tab)reference/prompts.json (opens in a new tab)scripts/bench_images.py (opens in a new tab)scripts/loom_deps.py (opens in a new tab)scripts/metrics.py (opens in a new tab)scripts/oracle_diffusers.py (opens in a new tab)scripts/philox_noise.py (opens in a new tab)scripts/stage_hf.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub loom-fun/loom-skills --plugin loom11 skills in this plugin
/loomEntry point for AMD Loom work (hrx-loom SDK, loom-serve, loom-fetch, Loom IR kernels) on AMD GPUs/NPUs such as Strix Halo — installing, serving catalog models, the demo web UI, porting a new LLM to Loom, optimizing it while preserving correctness, and benchmarking against llama.cpp. Use whenever the user mentions Loom, loom-serve, loom-fetch, hrx-loom, .loom files, or evaluating/porting models for Loom./loom-benchmarkCorrectness and performance methodology for Loom models vs llama.cpp ROCm — golden token-by-token comparison with log-prob near-tie analysis, a multi-turn tool-calling (agent) gate, a native-context admission check, batching consistency, decode/prefill/long-context/concurrency throughput on real-text workloads, and how to report results honestly (tables, executive artifact). Use for "benchmark", "compare with llama.cpp", "is the port correct", "performance report"./loom-demo-uiStart and use the Loom Playground web UI (chat with streaming reasoning and tok/s, ASR with mic recording, TTS, image generation, embedding similarity) that proxies to one or more running loom-serve instances and discovers their models automatically. Use when the user wants a browser demo/UI for Loom models./loom-fleetRuns loom-skills fleet work - a targeted fix to one model, family, GPU or quant (scoped change, sampled DevLab A/B, promotion), a campaign (new GPU, many models, a refactor, regenerating cards), populating or extending a Hugging Face org with new models (pick the top models, port and publish each, sweep gates on DevLab), publishing, staging and promoting regenerated cards, and improving the loom skills themselves against the KPIs with fresh-agent trials. Use for "improve the loom skill", "make the loom skill faster or more reliable", "targeted fix", "campaign", "populate the org", "polish the HF org", "which models still need cards", "regenerate cards", "publish to staging", "fresh-agent trial", or any change to the skills in this repo./loom-kbRouter for the Loom knowledge base - which facts to read for a given model, GPU and task. Run `kb.py route` with a model slug or config, GGUF or arch name plus device and topic, then read exactly the files it prints (device, quant, arch family, facets, topic). Use before porting, optimizing, benchmarking or rooflining any model, when asking "what is special about gemma4 / qwen35moe / flint", "which tricks apply to this model on the R9700", or when adding a model family, facet, device or scope rule to the knowledge base./loom-migrateMigrates the loom-skills kit, fleet of model cards and skills to a new hrx-loom SDK release - research the release, apply the version entry's mechanical steps (IR renames, program ABI, card schema, install/pin), prove the fleet parses and links under the new SDK, A/B the old cards against the new packages on DevLab, publish qualifying cards directly and stage regressions, and record simplifications and optimization opportunities. Holds one entry per adjacent SDK pair (v0.1.0 to v0.2.0 first) and sweep and rewrite scripts. Use for "new Loom SDK", "migrate to hrx-loom X", "SDK upgrade", "port the fleet to a new SDK", "my package fails to parse or load on the new SDK", or "what changed between hrx-loom versions".Other plugins' skills for the same job