🧩

gptqmodel-tokenizer-normalization

gptqmodel-tokenizer-normalization · v
作者 ModelCloud 公开目录收录

简介

Diagnose and correct GPT-QModel tokenizer initialization, tokenization normalization, special-token handling, prompt rendering, and chat-template problems. Use when inference or evaluation quality suggests wrong token IDs or prompts, when a model needs tokenizer load kwargs or compatibility patches, or when tokenizer behavior is being changed in GPT-QModel; reusable corrective behavior must be imp

通过你的 Agent 添加

安装目录:gptqmodel-tokenizer-normalization/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。

点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。

或者手动安装

Claude Code~/.claude/skills/gptqmodel-tokenizer-normalization/
Codex CLI~/.codex/skills/gptqmodel-tokenizer-normalization/
DeepSeek Harness~/.agents/skills/gptqmodel-tokenizer-normalization/

包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可; 目录名不用换,也不要把包直接解压到 skills 根目录。 技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。

技能正文


SPDX-FileCopyrightText: 2026 ModelCloud.ai

SPDX-License-Identifier: Apache-2.0

name: gptqmodel-tokenizer-normalization description: Diagnose and correct GPT-QModel tokenizer initialization, tokenization normalization, special-token handling, prompt rendering, and chat-template problems. Use when inference or evaluation quality suggests wrong token IDs or prompts, when a model needs tokenizer load kwargs or compatibility patches, or when tokenizer behavior is being changed in GPT-QModel; reusable corrective behavior must be implemented, tested, versioned, pushed, and submitted upstream to github.com/ModelCloud/Tokenicer.

GPT-QModel tokenizer normalization

At a glance

For tokenizer, chat-template or generation-quality changes, compare the dense baseline, rendered prompts and input IDs first. Repair reusable normalization in Tokenicer; consume its release through Tokenicer.load() rather than patching individual GPT-QModel loaders.

Diagnose the boundary

  1. Reproduce with the non-quantized model before attributing low scores or malformed output to quantization.
  2. Capture the exact raw text, rendered chat-template text, input IDs, attention mask, special-token settings, tokenizer class, tokenizer config, and Transformers/Tokenicer versions.
  3. Compare direct AutoTokenizer behavior, current Tokenicer.load(), and the proposed normalization on the same prompts. Include strings that expose the suspected boundary or regex error.
  4. Run a small dense-model evaluation with the same task, generation settings, and evaluator used for the quantized model. If dense and quantized runs fail similarly, fix the tokenizer or template before changing quantization code.
  5. Separate reusable tokenizer behavior from evaluator-specific prompt construction. AutoTokenizer kwargs, tokenizer compatibility, special-token repair, and model chat-template normalization belong in Tokenicer. A benchmark task's own few-shot or answer-extraction format remains in the evaluation project.

Do not suppress a correctness warning or hard-code a GPT-QModel model-name check when Tokenicer can normalize the underlying behavior. Preserve explicit caller overrides with patterns such as setdefault unless the upstream API documents a mandatory correction.

Implement upstream first

  1. Use a task-specific clone of Tokenicer under the workspace and draft PR rules.
  2. Sync Tokenicer's default branch and create a focused branch. Preserve unrelated worktree files.
  3. Implement the smallest general normalization in Tokenicer and make every tokenizer load and fallback path apply it consistently.
  4. Add focused unit tests for the default correction, explicit override behavior, and fallback paths. Add a lightweight end-to-end tokenizer assertion when it materially strengthens the regression.
  5. Increment the Tokenicer version for the release-bound correction and document the change where that repository's conventions require it.
  6. Run the focused tests and the complete Tokenicer test suite. Resolve every failure before publishing; report genuine environment skips separately.
  7. Review and stage only intended files, commit them, push the branch, and open a pull request against ModelCloud/Tokenicer. Include the root cause, before/after tokenization evidence, tests, and downstream GPT-QModel impact.

Do not consider a reusable normalization fixed when it exists only as a GPT-QModel workaround. If temporary downstream code is unavoidable while an upstream release is pending, isolate and label it, link the Tokenicer pull request, and remove it as soon as the dependency can be raised.

Consume the correction in GPT-QModel

  1. Route all normal tokenizer construction through Tokenicer.load(); avoid new direct AutoTokenizer.from_pretrained() paths in model loaders.
  2. After the Tokenicer release is available, raise GPT-QModel's minimum Tokenicer version and remove duplicated compatibility code in the same change.
  3. Add a GPT-QModel regression that proves the public load path receives normalized behavior without reimplementing Tokenicer internals.
  4. Re-run the dense baseline, then quantized save/reload/inference and the affected evaluation tasks. Compare exact prompt rendering and input IDs before comparing scores.

In the final report, link the Tokenicer commit and pull request, state the Tokenicer version, list all Tokenicer and GPT-QModel checks, and distinguish passed tests from skips or unavailable hardware.

正文来自原始仓库, 版权归作者所有,许可:Apache-2.0。 权利人认为有不妥,可申请下架。

原始仓库

作者的项目地址:https://github.com/ModelCloud/GPTQModel

标签

没有标签

同类 Skill