j6-plugin-insert-quant-dequant

j6-plugin-insert-quant-dequant is a skill for Claude Code, Codex from HorizonRobotics/OE-Skills. It costs 63 tokens per session (3,806 once invoked), scanned A, original, Apache-2.0.

A code-editing guide for adding deployment-boundary markers to floating-point PyTorch models. It places separate QuantStub and DeQuantStub modules around the part of the model that will be quantized by Horizon's tools.

In plain words
What is it for?
Use it to mark the deployable subgraph of a torch.nn.Module before quantization. It helps place quantization at inputs and dequantization at outputs while leaving losses, metrics, NMS, and other non-deployment logic outside.
Why use it?
It prevents training-only and post-processing code from being included in the deployed quantized model, while handling each floating-point input and output separately.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to mark the deployable subgraph of a torch.nn.Module before quantization. It helps place quantization at inputs and dequantization at outputs while leaving losses, metrics, NMS, and other non-deployment logic outside.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/horizonrobotics/oe-skills/j6-plugin-insert-quant-dequant
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add HorizonRobotics/OE-Skills --skill j6-plugin-insert-quant-dequant
Clone the repo
git clone --depth 1 https://github.com/HorizonRobotics/OE-Skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for j6-plugin-insert-quant-dequant

README.md
[![agentmods](https://agentmods.dev/badge/skills/horizonrobotics/oe-skills/j6-plugin-insert-quant-dequant.svg)](https://agentmods.dev/skills/horizonrobotics/oe-skills/j6-plugin-insert-quant-dequant)
Your own site
<a href="https://agentmods.dev/skills/horizonrobotics/oe-skills/j6-plugin-insert-quant-dequant"><img src="https://agentmods.dev/badge/skills/horizonrobotics/oe-skills/j6-plugin-insert-quant-dequant.svg" alt="Measured on agentmods" height="20"></a>
Per session 63 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,806 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00063 $0.03806
Opus 5 $0.00032 $0.01903
Sonnet 5 $0.00013 $0.00761
Haiku 4.5 $0.00006 $0.00381

Measured 8d ago against content hash f84ccc7acaad, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

j6-plugin-insert-quant-dequant scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

horizon/skills/plugin/j6-plugin-adaptation/j6-plugin-insert-quant-dequant/SKILL.md · 332 lines

How it starts

The opening of the file, as written. The whole thing — 332 lines — stays where its author put it; the contents beside it link to each section on GitHub.

给任意浮点模型插入 Quant/DeQuant(Horizon 部署边界版)

目标

把任意 浮点 torch.nn.Module 改造成可被 horizon_plugin_pytorch 量化工具链处理的形式:在部署输入边界插入 QuantStub,在部署输出边界插入 DeQuantStub

这里必须先区分两类逻辑:

  • 部署模块 / 部署子图:推理落板时真正需要保留、需要进入量化图的部分,例如 backbone、neck、head、deploy module 等。
  • 非部署模块 / 非部署逻辑:只在训练、评估、可视化、日志或 CPU/浮点后处理中使用,不属于最终部署子图,例如 loss 计算、matcher、target assign、NMS 后处理、结果格式整理、metrics、debug print、可视化等。

QuantStub -> ... -> DeQuantStub 中间这段,应该只包含部署模块。凡是部署时不需要的逻辑,都不应该被夹在 quant 和 dequant 中间。

本 Skill 强约束:

  • quant/dequant 是部署边界:标记从哪里开始/结束部署(进入/离开量化图)。
  • 每个输入和输出都单独创建 quant/dequant:不要复用同一个 stub 处理多个输入或多个输出。
  • QuantStub 初始化不要设置 scale:不要传 scale=...,交给量化流程决定。
  • QuantStub 只针对浮点 tensor:只有浮点 tensor 输入/输出才需要按部署边界插入 quant/dequant。
  • scalar 或非浮点 tensor 不插入 QuantStub:标量(scalar),以及 bool、整数/索引、已是定点语义的 tensor,不要为了“形式统一”强行插 quant。
  • quant 和 dequant 之间只放部署逻辑:loss、训练标签处理、评价指标、前后处理、可视化等非部署逻辑必须放在边界之外。
  • train/eval 的边界定义必须一致:不要仅因 self.training 为真/假就改变“哪里需要 dequant”的位置;是否 dequant 取决于后续逻辑是否已经离开部署图,而不是取决于当前处于训练还是评估模式。
  • 区分“边界输入”和“图内常量输入”QuantStub/DeQuantStub 负责标注部署边界;但如果部署图内部存在参与算子计算的 tensor 常量输入(例如 x + const_tensor 里的 const_tensor),也必须把它纳入 quant 语义。标量(scalar)可按算子属性处理,不显式插 quant 节点;tensor 形式的常量输入应视为输入参与量化

第零步:先判断谁属于“部署边界内”

在插入 QuantStub/DeQuantStub 之前,先把目标代码拆成两段:

A. 可以放在 quant 与 dequant 之间的内容

这些通常属于部署模块:

  • 主干网络 / backbone
  • neck / encoder / decoder / detection head
  • 明确要参与板端推理的特征变换
  • 明确属于部署图一部分的张量级算子

B. 不能放在 quant 与 dequant 之间的内容

这些通常属于非部署逻辑:

  • loss 计算
  • matcher / assigner / target builder
  • 训练分支专用监督逻辑
  • 输入前处理(如果它不属于模型部署图,而是 dataloader / Python 侧处理)
  • 输出后处理(如 NMS、阈值过滤、格式整理、映射回原图)
  • COCO evaluator / metrics / logger / visualizer
  • .cpu() / .numpy() / Python list/dict 整理 / 画图 / dump 文件

如果某段逻辑在板端部署时不会保留,就不要把它塞进 quant/dequant 边界里。

补充说明:

  • “输入”不只指 forward(...) 的外部参数,也包括部署图内部某个算子的独立输入。
  • 因此,一个由模型内部构造出来的常量 Tensor,只要它作为 add/cat/matmul/attention 等算子的输入参与部署图计算,就不能把它当成“天然 float 附件”忽略量化。
  • 但这不意味着要把它误改成新的部署边界:边界 QuantStub 仍只负责模型 I/O 边界;图内常量 Tensor 的重点是“必须进入 quant 语义”,而不是“必须伪装成外部输入”。

Read the full file on GitHub · 332 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 332 lines · 63 tokens per session scan A f84ccc7acaad

Subscribe to this mod's changes

j6-plugin-insert-quant-dequant is a skill published in the GitHub repository HorizonRobotics/OE-Skills (19 stars, last pushed 2mo ago), licensed Apache-2.0. It adds 63 tokens to every session and 3,806 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

spark-environment-setup

Set up a working ML training/inference environment on NVIDIA DGX Spark (GB10, aarch64, CUDA 13). Use when installing PyTorch/Unsloth/TRL/vLLM on DGX Spark, hitting libcudart or wheel-ABI errors on aarch64, or choosing between NGC containers and bare pip installs.

wshobson/agents · 76 tokens

spark-memory-thermal-ops

Manage unified memory and thermals during long-running ML jobs on NVIDIA DGX Spark. Use when planning memory headroom for a training run on GB10, when a job OOMs on unified memory, or when monitoring temperature and power during multi-hour training.

wshobson/agents · 59 tokens

spark-training-gotchas

Preflight and diagnose the ten known failure modes for ML training on NVIDIA DGX Spark. Use when a training run on DGX Spark fails to start, OOMs below the 128GB limit, slows down mid-run, or before any multi-hour training job on GB10.

wshobson/agents · 63 tokens

llama-cpp

Runs LLM inference on CPU, Apple Silicon, and consumer GPUs without NVIDIA hardware. Use for edge deployment, M1/M2/M3 Macs, AMD/Intel GPUs, or when CUDA is unavailable. Supports GGUF quantization (1.5-8 bit) for reduced memory and 4-10× speedup vs PyTorch on CPU.

davila7/claude-code-templates · 76 tokens

amc-run-rtsp-calibration

Calibrate a new dataset from live RTSP camera streams via the AutoMagicCalib REST API. Use when the user provides RTSP URLs or asks to calibrate live cameras; VIOS records clips, AMC ingests them, then runs calibration.

NVIDIA/skills · 59 tokens

amc-run-video-calibration

Calibrates pre-recorded cam.mp4 datasets through the AutoMagicCalib REST API. Use for user-supplied local MP4s; route live RTSP streams to amc-run-rtsp-calibration.

NVIDIA/skills · 57 tokens