Skip to content
Agentmart
Submit a tool

quark-onnx-ptq-workflow

End-to-end ONNX PTQ workflow for AMD Quark — from a `.onnx` file (and calibration data) to a quantized `.onnx` output.

Skill by amd

IndexedMIT★ 186
Write a review

Chalk Labs

Need help deploying quark-onnx-ptq-workflow?

Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.

Book a call

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/amd-quark-onnx-ptq-workflow

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

End-to-end ONNX PTQ workflow for AMD Quark — from a `.onnx` file (and calibration data) to a quantized `.onnx` output. Use when the user wants a complete ONNX-to-ONNX PTQ pipeline: model intake, quantization planning, calibration-script generation, manifest, and confirmed execution. Trigger for "quantize my .onnx", "run ONNX PTQ end to end", "full ONNX quantization pipeline", "quantize yolov8/resnet50/yolo_nas with XINT8/A8W8/BFP16/MXFP*", "weights-only INT4 for my .onnx LLM", or any request that spans more than one ONNX PTQ step. When in doubt between routing to an atomic skill vs. the workflow, prefer this workflow if the user's request implies they want to go from a `.onnx` file to a quantized output.

Use cases: data, ml, productivity

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md and code. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/quark-onnx-ptq-workflow

What's inside

Skill name
quark-onnx-ptq-workflow
Description
End-to-end ONNX PTQ workflow for AMD Quark — from a `.onnx` file (and calibration data) to a quantized `.onnx` output. Use when the user wants a complete ONNX-to-ONNX PTQ pipeline: model intake, quantization planning, calibration-script generation, manifest, and confirmed execution. Trigger for "quantize my .onnx", "run ONNX PTQ end to end", "full ONNX quantization pipeline", "quantize yolov8/resnet50/yolo_nas with XINT8/A8W8/BFP16/MXFP*", "weights-only INT4 for my .onnx LLM", or any request that spans more than one ONNX PTQ step. When in doubt between routing to an atomic skill vs. the workflow, prefer this workflow if the user's request implies they want to go from a `.onnx` file to a quantized output.
License
MIT
Instructions
326 lines in SKILL.md · view on GitHub

Agent Skills spec issues

  • files: referenced but missing: examples/onnx/yolo_quantization/quantize_yolo.py

Files (2)

  • SKILL.md
  • example-xint8-yolov8n.md

SKILL.md (first lines)

# quark-onnx-ptq-workflow

> 📘 **Quick-start example — read this first.**
> A fully worked end-to-end walkthrough is available at **[`example-xint8-yolov8n.md`](example-xint8-yolov8n.md)** (XINT8 quantization of YOLOv8n for AMD NPU CNN deployment, calibrated on COCO val2017). It is the fastest way to see exactly what this workflow produces — open it alongside this SKILL.md before running anything.

## Purpose

Chain the ONNX PTQ path — model intake → quantization planning → script + manifest generation → confirmed execution — while keeping the user informed at each checkpoint. This workflow orchestrates the atomic ONNX skills so the user does not have to manually chain them. Unlike the Torch flow there is no single shipped `quantize_quark.py` for ONNX; the workflow generates a small standalone Python script in the user's working directory that imports from `quark.onnx`, then runs that script after the user confirms.

📂 **Worked example:** see [`example-xint8-yolov8n.md`](example-xint8-yolov8n.md) for the full YOLOv8n + XINT8 + NPU-CNN walkthrough referenced throughout the steps below.

## Inputs

- Input `.onnx` model path (with optional sibling `.onnx_data` external-weights file)
- Calibration data: folder of representative samples (or `CalibrationDataReader` Python class)
- Output `.onnx` path (and optional `.onnx_data` if `use_external_data_format=True`)
- User goal: scheme (XINT8 / A8W8 / A16W8 / BF16 / BFP16 / `MX*` / `MXFP*`), deployment target (CPU / CUDA / ROCm / AMD NPU CNN / AMD NPU Transformer), accuracy target
- `session_context.json` with `constraints.backend = "onnx"` for user goal and constraints
- `env_context.json` for hardware / execution-provider facts
- `workspace_context.json` for validated paths
- `onnx_install_result.json` and `quark_install_result.json` to confirm runtime is ready

## Outputs: run_manifest.yaml

Records the generated calibration/quantization script path, the exact `python3` invocation, and the resolved `QConfig`. Side artifacts: the generated script in the user's working directory, the quantized `.onnx` (and `.onnx_data` if external) in the user's output directory. The manifest is built in Step 3.

Schema: [`run_manifest.schema.json`](../../../shared/contracts/run_manifest.schema.json)

## Interaction Flow

1. **Intake** — call `quark-onnx-model-intake` to produce `model_analysis.json`
2. **Plan** — call `quark-onnx-quant-plan` to produce `quant_plan.json`
3. **Manifest** — generate a standalone quantization script in the user's working directory + `run_manifest.yaml`, then stop for user approval
4. **Execute** — run the confirmed script and report the artifact paths

## CRITICAL RULES

1. **NEVER call `ModelQuantizer.quantize_model(...)` directly from this workflow.** Always generate a standalone script the user reviews first.
2. **NEVER skip a step.** Even if the user provides all details upfront, execute each step in order.
3. **STOP at every checkpoint** and wait for user confirmation before continuing.
4. **Show concrete output** at each step — tables, JSON, the full script body, the exact command — not just prose descriptions.
5. **NEVER modify Quark's own source code, examples, or tutorials.** The Quark repo (`quark/`, `examples/`, `tutorials/`, `tools/`, `docs/`, `tests/`) is read-only from this workflow's perspective. See *Upstream Quark Code is Read-Only* below.
6. **NEVER silently fall back to CPU execution.** If the user requested CUDA/ROCm and the provider is unavailable, stop and surface the gap to `quark-onnx-install` / `quark-onnx-debug` — do not quietly degrade.

## Upstream Quark Code is Read-Only

The Quark repository is the upstream source of truth. This workflow may read it freely (config sources, example scripts, tutorial notebooks, custom-op headers) but must not write into it. That includes:

- No edits to `quark/` package source.
- No edits to anything under `examples/onnx/` — including `examples/onnx/yolo_quantization/quantize_yolo.py`. Even small "just to make the script accept my preprocessing" patches are forbidden, because they make the run irreproducible against a clean Quark install.
- No edits to anything under `tutorials/onnx/` — the Ryzen AI tutorials for YOLOv8 / ResNet-50 / image classification are reference material only.
- No edits to `tools/`, `docs/`, `tests/`, or `pyproject.toml` / `requirements.txt`.

**If a shipped example or tutorial as-is does not cover what the user needs** (different model, different preprocessing, different exclude list, different calibration source), write a fresh standalone script in the user's working directory (or `/tmp/`) that imports from `quark.onnx`. Pattern:

```python
# user_workspace/my_onnx_ptq.py — NOT inside the Quark repo
from quark.onnx import ModelQuantizer, QConfig, QLayerConfig, XInt8Spec, CLEConfig
from onnxruntime.quantization.calibrate import CalibrationDataReader
# ... user-specific data reader + QConfig the shipped example doesn't cover ...
```

Then reference *that* script in the `run_manifest.yaml` instead of a modified example. The shipped scripts stay untouched, the user's customization is local to their workspace, and the run remains reproducible against any Quark version.

If the user actually needs an upstream Quark change (a new preset, a new algorithm config), surface it as a Quark contribution — do not silently patch their local checkout.

## Required Artifact Flow

```text
Step 1 (Intake)   ──► model_analysis.json
Step 2 (Plan)     ──► quant_plan.json
Step 3 (Manifest) ──► run_manifest.yaml  +  user_workspace/<name>_ptq.py
Step 4 (Execute)  ──► quantized .onnx (+ .onnx_data if external)  (only after user says yes)
```

---

## Step 1: Model Intake

**Goal**: Analyze the `.onnx` graph and produce `model_analysis.json`. Hand off to `quark-onnx-model-intake`.

### Actions

1. **Confirm the input path.** It must end in `.onnx`. If a sibling `.onnx_data` exists, both must move together.
2. **Run `quark-onnx-model-intake`.** That skill produces:
   - opset / IR version
   - input / output names, shapes, dtypes
   - op-type histogram and quantizable-op count
   - whether QDQ nodes are already present (if yes — model is already quantized; warn and stop)
   - external-data status (model.onnx_data present? total bytes? >2 GB?)
   - deployment-target compatibility (CPU / CUDA / ROCm / NPU CNN / NPU Transformer)
3. **Surface risks:**
   - Already quantized → stop, do not re-quantize.
   - opset < 13 → recommend upgrading to opset 17+ for best support.
   - Dynamic input shapes → calibration data reader must produce matching shapes; warn if shapes vary.
   - >2 GB model → external data must be handled; set `use_external_data_format=True` later.
   - NPU CNN target → only XINT8 / A8W8 are gated as supported; warn early.

### Output to Show User

Present a summary table:

```text
Model Analysis:
  Model path:       ./models/yolov8n.onnx
  Opset / IR:       17 / 8
  Input:            images, [1, 3, 640, 640], float32
  Output:           output0, [1, 84, 8400], float32
  Total ops:        ~226 nodes (Conv, MatMul, Add, Mul, Sigmoid, Concat, …)
  Quantizable ops:  ~118 (Conv + MatMul + …)
  QDQ already?      No
  External data:    No (6.2 MB inline)
  Risks:            None
  NPU CNN target:   Compatible (Conv-heavy, no unsupported ops)
```

### >>> CHECKPOINT 1: Confirm model analysis is correct before continuing

---

From amd/Quark, MIT.

More from amd/Quark

Signals

Stars
186
Forks
36
Open issues
3
Last commit (this folder)
Jul 9, 2026 (3 months ago)
Last release
Sep 28, 2026 (1 month ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

Same skill elsewhere

Copies of this SKILL.md published by others; search shows only one of them.

More from amd

Done for you

Rather not set it up yourself?

Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.

See how we build AI agents →Read the case studies

Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.

launches shipped
50+
launches shipped
media placements
500+
media placements
founders on every account
2
founders on every account

Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block

Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.

Get quark-onnx-ptq-workflow running in your business

Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.

Goes to the Chalk Labs founders, not the newsletter. Privacy

Need help deploying quark-onnx-ptq-workflow?

CallGet help
Cite this page

quark-onnx-ptq-workflow skill. Agent Mart. https://agentmart.dev/skills/amd-quark-onnx-ptq-workflow (last updated 2026-10-24)