quark-onnx-model-intake
Inspect a target ONNX model and prepare metadata for Quark ONNX PTQ planning.
Skill by amd
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-model-intake-65874d
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.
About
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions: not checked yet.
What's inside
- Skill name
quark-onnx-model-intake- Description
- Inspect a target ONNX model and prepare metadata for Quark ONNX PTQ planning. Use when the user needs `.onnx` path validation, opset / IR version detection, input/output shape and dtype discovery, op-type histogram, quantizable-op counting, deployment-target compatibility checks (CPU / CUDA / ROCm / AMD NPU CNN / AMD NPU Transformer), or risk assessment before planning PTQ. Trigger for "analyze my ONNX model", "check this onnx model", "what opset is this", "can Quark quantize this .onnx", "is my model NPU-compatible", "does my model already have QDQ", "is my model larger than 2 GB", or when any ONNX quantization step needs model facts that are missing.
- License
- MIT
- Instructions
- 338 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
# quark-onnx-model-intake
## Purpose
Validate the target `.onnx` model and extract the structural facts that an ONNX quant plan needs
to make correct quantization decisions. This step exists because different ONNX models have very
different quantization requirements — a CNN destined for AMD NPU CNN needs NHWC layout and PoF2
scales, an LLM exported to ONNX needs MatMulNBits or SmoothQuant + GPTQ, a >2 GB model needs
external-data handling, and a model that already contains QDQ nodes (or Quark's custom-op domains)
must not be silently re-quantized.
## Inputs
- Model path — a single `.onnx` file, or a directory containing `model.onnx` plus its
`model.onnx_data` / external-weight blobs
- `env_context.json` for Python and accelerator constraints (CUDA major / ROCm major / NPU
presence)
- `workspace_context.json` for the validated model path
- `onnx_install_result.json` (optional) — the installed `onnxruntime*` variant determines which
execution providers are realistic deployment targets
## Outputs: model_analysis.json
Captures the model's graph metadata, op-type coverage, quantizable-op count, deployment-target
compatibility, and risks. Schema is shared with the Torch intake; ONNX-specific fields live under
`model.onnx_specific` and `quantization_targets.onnx_specific`.
Schema: [`model_analysis.schema.json`](../../shared/contracts/model_analysis.schema.json)
```json
{
"analysis_status": "complete",
"model": {
"model_path": "/data/models/resnet50/model.onnx",
"model_type": "onnx",
"loading_class": "onnx.load",
"estimated_size_gb": 0.10,
"onnx_specific": {
"ir_version": 8,
"producer_name": "pytorch",
"producer_version": "2.5.1",
"opsets": [{"domain": "ai.onnx", "version": 17}],
"uses_external_data": false,
"external_data_files": [],
"input_layout_guess": "NCHW",
"inputs": [
{"name": "input", "dtype": "float32", "shape": [1, 3, 224, 224]}
],
"outputs": [
{"name": "output", "dtype": "float32", "shape": [1, 1000]}
],
"has_dynamic_dims": false,
"has_qdq_already": false,
"has_quark_custom_ops": false,
"architecture_guess": "cnn"
}
},
"quantization_targets": {
"linear_layer_count": 53,
"onnx_specific": {
"op_counts": {"Conv": 53, "BatchNormalization": 53, "Relu": 49, "MaxPool": 1, "GlobalAveragePool": 1, "Gemm": 1},
"quantizable_op_counts": {"Conv": 53, "Gemm": 1, "MatMul": 0, "Add": 16, "Mul": 0},
"preset_candidates": ["XINT8", "A8W8", "INT8_CNN_DEFAULT"],
"exclude_defaults": []
}
},
"risks": [
{
"severity": "low",
"message": "Inputs are NCHW. AMD NPU CNN target expects NHWC.",
"recovery_hint": "Run quark.onnx.tools.convert_nchw_to_nhwc before quantization."
}
]
}
```
## Supported Domains and Preset Families
Quark ONNX ships a large `DefaultConfigMapping` of named presets in
`quark/onnx/quantization/config/custom_config.py`. The intake should narrow the candidate set
based on what the model actually looks like:
| Category | Representative presets | When to suggest |
|----------|------------------------|-----------------|
| **AMD NPU CNN (XINT8 family)** | `XINT8`, `XINT8_ADAROUND`, `XINT8_ADAQUANT`, `XINT8_WEIGHTSONLY_ADAROUND` | Model is Conv-heavy (CNN), inputs are 4D, deployment target is `npu_cnn`; requires PoF2 scales and (usually) NHWC layout |
| **AMD NPU Transformer (INT16 transformer)** | `INT16_TRANSFORMER_DEFAULT`, `INT16_TRANSFORMER_ACCURATE` | Model is MatMul/Gemm-heavy, deployment target is `npu_transformer` |
| **General CPU/GPU INT8** | `A8W8`, `A8W8_ADAROUND`, `A8W8_ADAQUANT`, `INT8_CNN_DEFAULT`, `INT8_CNN_ACCURATE` | Generic INT8 deployment on CPU/CUDA/ROCm |
| **A16W8 / wide activations** | `A16W8`, `A16W8_ADAROUND`, `A16W8_ADAQUANT` | Activations need 16-bit headroom (outlier-heavy models) |
| **Block formats (custom-ops required)** | `BFP16`, `BFP16_ADAQUANT`, `MX4`, `MX6`, `MX9`, `MXFP4`, `MXFP6`, `MXFP8`, `BF16_MIXED_BFP16`, `BF16_MIXED_MXINT8` | Modern AMD accelerators with `quark.onnx.operators.custom_ops` available |
| **Float fallbacks** | `FP16`, `BF16`, `FP16_ADAQUANT`, `BF16_ADAQUANT` | Accuracy-first; no INT quant |
`preset_candidates` in `model_analysis.json` should list the 1–3 presets that are realistic given
architecture + deployment target; never list all of them.
## What to Extract
### From the ONNX model proto (without loading weights)
- **IR version**: `model.ir_version`
- **Producer**: `model.producer_name`, `model.producer_version`
- **Opsets**: `[(opset.domain or 'ai.onnx', opset.version) for opset in model.opset_import]` —
for QDQ insertion, `ai.onnx` opset must be ≥ 13 (≥ 19 recommended for full INT4/FP8 support)
- **Custom domains**: presence of `com.amd.quark` or `com.microsoft` indicates the model has
already been processed by Quark or ORT and should not be naively re-quantized
- **External data**: `os.path.exists(model_path + '_data')` or any tensor with
`tensor.data_location == TensorProto.EXTERNAL`; total file size > 2 GB without external data is
invalid
- **Inputs / outputs**: name, dtype (from `type.tensor_type.elem_type`), shape (dim_value or
symbolic `dim_param`)
- **Dynamic dims**: any `dim_param` or `dim_value == 0` in inputs → flag as risk for NPU targets
- **Input layout guess**: 4D float input with channel dim == 3 or small power-of-2 → likely NCHW
(channel-first) or NHWC (channel-last); use the convention of the producer
- **Architecture guess**: histogram of op types — Conv-dominated → CNN; MatMul/Gemm + softmax →
Transformer; LSTM / GRU / RNN → recurrent; mix of Conv + MatMul + Attention → hybrid
### Quantization Targets
- **Quantizable op counts**: count `Conv`, `Gemm`, `MatMul`, `ConvTranspose`, `Add`, `Mul`,
`BatchNormalization` (will be folded into Conv during pre-processing)From amd/Quark, MIT.
More from amd/Quark
- 0.684score
quark-skill-creator
amd
Author or restructure a Quark Agent Skill so it conforms to this project's template, contracts, and layer rules.
SkillAFreshness: A★ 186Claude Code +9 - 0.679score
quark-torch-llm-eval
amd
End-to-end LLM accuracy evaluation on AMD ROCm (ROCm-only) — container setup, vLLM/SGLang/ATOM serving, lm-eval / lighteval / evalscope benchmarks.
SkillAFreshness: A★ 186Claude Code +9 - 0.679score
quark-env-preflight
amd
Collect and normalize environment facts (OS, Python, GPU, CUDA/ROCm, container state) before Quark installation or PTQ planning.
SkillAFreshness: A★ 186Claude Code +9 - 0.679score
quark-torch-model-intake
amd
Inspect a target model and prepare metadata for Quark PTQ planning.
SkillAFreshness: A★ 186Claude Code +9 - 0.679score
quark-torch-export
amd
Prepare export and downstream evaluation handoff for a planned or completed Quark PTQ run.
SkillAFreshness: A★ 186Claude Code +9 - 0.679score
quark-torch-install
amd
Install or verify the correct PyTorch build for a user's accelerator backend before Quark installation.
SkillAFreshness: A★ 186Claude Code +9 - 0.679score
quark-install
amd
Install or verify the AMD Quark package and its dependencies.
SkillAFreshness: A★ 186Claude Code +9 - 0.679score
quark-onnx-install
amd
Install or verify the correct ONNX Runtime build (and the `onnx` package) for a user's accelerator backend before Quark's ONNX-to-ONNX flow.
SkillAFreshness: A★ 186Claude Code +9 - 0.679score
quark-onnx-model-intake
amd
Inspect a target ONNX model and prepare metadata for Quark ONNX PTQ planning.
SkillAFreshness: A★ 186Claude Code +9 - 0.679score
quark-onnx-router
amd
Route Quark ONNX user goals to the correct atomic skill.
SkillAFreshness: A★ 186Claude Code +9 - 0.679score
quark-torch-debug
amd
Diagnose failed Quark installation, PTQ execution, script generation, or export attempts.
SkillAFreshness: A★ 186Claude Code +9 - 0.679score
quark-torch-quant-plan
amd
Build a Quark Torch LLM PTQ quantization plan from model analysis and user intent.
SkillAFreshness: A★ 186Claude Code +9
Signals
- Stars
- 186
- Forks
- 36
- Open issues
- 3
- Last commit (this folder)
- Sep 28, 2026 (1 month ago)
- Last release
- Sep 28, 2026 (1 month ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/amd/Quark
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
Same skill elsewhere
Copies of this SKILL.md published by others; search shows only one of them.
More from amd
- 0.700score
quark-torch-llm-ptq
amd
Runs an end-to-end AMD Quark post-training quantization workflow for PyTorch / Hugging Face LLMs: inspect a Hub or local model, choose a quantization plan…
SkillAFreshness: A★ 465Claude Code +9 - 0.700score
rocprofiler-pc-sampling
amd
Profiles a target application using rocprofv3 with program counter sampling enabled and then analyzes the results.
SkillAFreshness: A★ 465Claude Code +9 - 0.700score
local-ai-use
amd
Makes this agent generate images, transcribe audio, and synthesize speech on the user's own machine through a local Lemonade Server instead of a paid cloud API.
SkillAFreshness: A★ 465Claude Code +9 - 0.700score
quark-install
amd
Installs or verifies AMD Quark and ensures the selected Python environment has an accelerator-matched PyTorch.
SkillAFreshness: A★ 465Claude Code +9 - 0.700score
lemonade-router-builder
amd
Turns a natural-language description of routing intent into a valid Lemonade `collection.router` policy JSON.
SkillAFreshness: A★ 465Claude Code +9 - 0.700score
serving-llms-on-epyc
amd
Serves an LLM on a supported AMD EPYC server CPU using vLLM with zentorch, in Docker, Podman, or conda.
SkillAFreshness: A★ 465Claude Code +9
Cite this page
quark-onnx-model-intake skill. Agent Mart. https://agentmart.dev/skills/amd-quark-onnx-model-intake-65874d (last updated 2026-10-24)