J6 Plugin Prepare logo

J6 Plugin Prepare

Organization
HorizonRobotics
j6-plugin-prepare

在适配 horizon_plugin_pytorch 的过程中对浮点模型执行 prepare(仅添加 prepare 调用;qconfig_setter 固定为全部双 int8 模板;不包含 dynamic_block 相关修改)。

Overview

PublisherHorizonRobotics
RepositoryOE-Skills
Skill namej6-plugin-prepare
Stars
28
Forks
4
Bundled files
1
LicenseApache-2.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 1 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by HorizonRobotics on GitHub. Read the source before you install it.

Installation

Install the J6 Plugin Prepare AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/HorizonRobotics/OE-Skills/tree/main/horizon/skills/plugin/j6-plugin-adaptation/j6-plugin-prepare
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/HorizonRobotics/OE-Skills.git /tmp/OE-Skills
mkdir -p .claude/skills
cp -r /tmp/OE-Skills/horizon/skills/plugin/j6-plugin-adaptation/j6-plugin-prepare .claude/skills/j6-plugin-prepare
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable J6 Plugin Prepare in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads J6 Plugin Prepare on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so J6 Plugin Prepare is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

给浮点模型添加 Horizon prepare(仅 prepare 调用版)

目标

把已有的 浮点 torch.nn.Module 接入 horizon_plugin_pytorch 的 QAT 工具链:在代码中对模型执行 prepare(...),得到可训练的 QAT 模型(含伪量化/qat 算子等变换)。

本 Skill 强约束:

  • 只加 prepare:仅新增/调整 prepare(...) 调用与必要 import,不做其它结构性改造。
  • 不处理 dynamic_block:不引入/不修改任何 dynamic_block / Tracer.dynamic_block 相关逻辑(动态控制流场景需要单独处理,不属于本 skill)。
  • qconfig_setter 固定:一律使用“全部双 int8”模板构造的 QconfigSetter,不叠加其它 setter,不做敏感算子表等策略。

prepare 会做什么(你需要知道的关键点)

基于图的 prepare(例如 PrepareMethod.JIT_STRIP)通常会:

  • 捕获并裁剪计算图(会根据 QuantStub/DeQuantStub 位置识别并跳过前后处理)
  • 替换部分 function 类算子为 module 形式(便于在 module 内插入伪量化等逻辑)
  • 进行可融合 pattern 的算子融合
  • 将浮点算子转换为 qat 算子,并按 qconfig 插入伪量化/伪转换节点
  • 执行 QAT 模型结构检查并生成检查结果文件

标准改法(通用模板)

1) 增加 import

python
from horizon_plugin_pytorch.dtype import qint8
from horizon_plugin_pytorch.quantization import get_qconfig
from horizon_plugin_pytorch.quantization.prepare import PrepareMethod, prepare
from horizon_plugin_pytorch.quantization.qconfig_setter import (
    ConvDtypeTemplate,
    MatmulDtypeTemplate,
    ModuleNameTemplate,
    QconfigSetter,
)

2) 选择 method,并准备 example_inputs

  • 推荐默认用 PrepareMethod.JIT_STRIP
  • 当 method 为 PrepareMethod.JIT_STRIP 或 PrepareMethod.JIT 时,必须提供 example_inputs
  • example_inputs 的目的:用于感知图结构,且应当能跑通目标 forward(通常用 eval/infer 路径)

3) 构造全双 int8 的 qconfig_setter,并调用 prepare

python
int8_qconfig_setter = QconfigSetter(
    reference_qconfig=get_qconfig(),
    templates=[
        ModuleNameTemplate({"": qint8}),
        ConvDtypeTemplate(input_dtype=qint8, weight_dtype=qint8),
        MatmulDtypeTemplate(input_dtypes=qint8),
    ],
)

qat_model = prepare(
    float_model,
    example_inputs=example_inputs,
    qconfig_setter=int8_qconfig_setter,
    method=PrepareMethod.JIT_STRIP,
)

4) 重要约束与注意事项(直接按这个执行)

  • prepare 之后不要再改模型结构:prepare 会替换/融合/转换算子,之后再改模型(例如把 BN 改成 SyncBN)可能导致 qat 算子被再次修改,出现不可预期行为。
  • prepare 之后不要改任何 hook:基于图的 function→module 替换依赖 hook 与特殊 wrapper tensor 机制;改动 hook 可能导致替换失效,进而报错或产生精度问题。
  • 尽量只对“部署逻辑”做 prepare:如果一个 forward 同时混入训练/评测分支、CPU/Numpy 后处理等,容易导致量化边界或图捕获不符合部署预期。建议把部署推理逻辑剥离到 forward_infer(或等价函数)并对其进行 prepare。

PrepareMethod 简要选择建议

method原理(高层)适用
PrepareMethod.JIT_STRIP(Graph Mode)感知图结构,在原 forward 上做算子替换/融合/qat 转换,并按 Quant/DeQuant 边界裁剪默认推荐,自动化程度高
PrepareMethod.EAGER(Eager Mode)不感知图结构,很多替换/融合需要手动处理特殊需求/过程强可控场景

注:本 Skill 只负责把 prepare(...) 正确接入;method 的更深层细节与动态图特殊处理不在本 skill 范围内。

快速自检清单

  • 代码中新增了 prepare(...) 调用,且产物是 qat_model(后续训练/保存/导出都基于它)。
  • qconfig_setter 仅为基于 QconfigSetter(...) 构造的“全部双 int8”模板。
  • 模板包含 ModuleNameTemplate({"": qint8})、ConvDtypeTemplate(input_dtype=qint8, weight_dtype=qint8)、MatmulDtypeTemplate(input_dtypes=qint8)。
  • PrepareMethod.JIT_STRIP/JIT 场景下提供了可跑通 forward 的 example_inputs。
  • prepare 之后没有再做结构性改动,也没有改动模型 hook。

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the J6 Plugin Prepare AI skill do?

在适配 horizon_plugin_pytorch 的过程中对浮点模型执行 prepare(仅添加 prepare 调用;qconfig_setter 固定为全部双 int8 模板;不包含 dynamic_block 相关修改)。

Why use J6 Plugin Prepare on TypingMind?

Because you install it once and use it with any model. J6 Plugin Prepare is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install J6 Plugin Prepare in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/HorizonRobotics/OE-Skills/tree/main/horizon/skills/plugin/j6-plugin-adaptation/j6-plugin-prepare. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use J6 Plugin Prepare?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with J6 Plugin Prepare?

As many as you like. As long as a model supports skills, you can use J6 Plugin Prepare with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the J6 Plugin Prepare AI skill free?

Yes. It is published on GitHub by HorizonRobotics under the Apache-2.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇