Repository navigation
model-types: move per-model_type fixes into catalogue/model-types - #60
Merged
Merged
Conversation
The gpt-oss tiktoken vocab and parsers and the Qwen3.5 chat template patch were Go code in internal/resolve and internal/hf. Changing or adding one meant editing internals. They are now catalogue files keyed on the HuggingFace model_type, read by internal/modeltype, and a machine owner can add or replace one in model-types.d without a rebuild. The template fix now applies only to qwen3_5 and qwen3_5_moe repos. gpt-oss profiles carry TIKTOKEN_ENCODINGS_BASE themselves, so setup no longer writes it to config.env and doctor drops the harmony_vocab check. Existing config.env lines keep working. Adds 'model-types list' and 'model-types show'.
There was a problem hiding this comment.
🟡 Changes recommended
Unquoted catalogue values can break saved-profile argument parsing, and non-vLLM engines silently ignore accepted file and environment rules.
3 open issues
What changed in this PR
Moves architecture-specific behavior from Go into catalogue/model-types/, continuing #59’s separation of catalogue data from runtime logic.
Changes:
- Adds validated model-type definitions and local overrides for file downloads, parser flags, and chat-template fixes.
- Integrates rules into profile preparation, moves tokenizer environment settings into profiles, and adds
model-types list/show. - Updates tests, doctor output, documentation, and contributor guidance.
| File | Description |
|---|---|
internal/vllm/validate.go |
Adds flag and parser-value acceptance checks. |
internal/resolve/tiktoken.go |
Removes hardcoded harmony preparation. |
internal/resolve/tiktoken_internal_test.go |
Removes tests replaced by catalogue-driven coverage. |
internal/resolve/resolve.go |
Applies model-type rules during profile preparation. |
internal/resolve/resolve_internal_test.go |
Tests profile environment and architecture-scoped patches. |
internal/resolve/modeltype.go |
Implements rule-driven arguments, downloads, and template fixes. |
internal/resolve/modeltype_internal_test.go |
Tests downloads and parser selection. |
internal/profile/profile.go |
Writes environment settings into profiles. |
internal/modeltype/modeltype.go |
Defines and validates the model-type registry. |
internal/modeltype/modeltype_internal_test.go |
Tests definitions, validation, overrides, and catalogue boundaries. |
internal/modeltype/local.go |
Loads local overrides and records errors. |
internal/hf/hf.go |
Separates template fetching from patch logic. |
internal/hf/hf_internal_test.go |
Updates coverage for template fetching. |
internal/cli/setup.go |
Removes global tokenizer directory setup and configuration. |
internal/cli/root.go |
Loads model types and registers their commands. |
internal/cli/root_internal_test.go |
Updates the expected command set. |
internal/cli/modeltypescmd.go |
Adds list/show commands with JSON output. |
internal/cli/detectcmds.go |
Reports local definition errors; removes harmony-vocab reporting. |
docs/reference/cli/model-types/show.md |
Adds generated show-command reference. |
docs/reference/cli/model-types/list.md |
Adds generated list-command reference. |
docs/reference/cli/model-types.md |
Adds generated model-types command reference. |
docs/reference/cli.md |
Links the new command group. |
docs/model-types.md |
Documents rules and local overrides. |
docs/manifest.json |
Routes the new documentation pages. |
docs/install.md |
Removes the global tokenizer setting from the configuration table. |
CHANGELOG.md |
Records new commands and behavior changes. |
catalogue/model-types/README.md |
Explains how to add model-type definitions. |
catalogue/model-types/qwen3_5.json |
Defines the Qwen3.5 template fix. |
catalogue/model-types/qwen3_5_moe.json |
Defines the Qwen3.5 MoE template fix. |
catalogue/model-types/gpt_oss.json |
Defines harmony vocabulary and parser requirements. |
catalogue/catalogue.go |
Embeds and exposes model-type definitions. |
AGENTS.md |
Documents the package layout and model-type guardrail. |
Review effort: Balanced
DeepSeek V4 Flash, Pro and Flash Vision all report model_type deepseek_v4 and ship no chat template; vLLM encodes their chats through its deepseek_v4 tokenizer mode. Their cards' vllm serve lines name neither that nor the deepseek_v4 parsers, so a profile from 'new' could not render a chat request.
DevelopmentCats
changed the base branch from
devcats/rename-internal-packages
to
main
November 5, 2026 19:44
…ests A catalogue value or a patched template path with a space in it split into two words when EXTRA_ARGS was read back, so both are quoted now. Model-type files applied only on engines with vllm_args, so a local definition giving mlx a file loaded and did nothing. Files now apply on every engine; args and chat_template_fixes are vLLM flag syntax and are refused at load for engines without vllm_args. Non-vLLM profiles still skip the Hub unless some model type has files for that engine. The bad-file fixtures had ids with spaces, so they all failed at the id check. They use valid ids now and each asserts its own error.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


What changes
The gpt-oss tiktoken vocab and parser flags and the Qwen3.5 chat template patch lived in Go (
internal/resolve/tiktoken.go,internal/hf/hf.go). They are now files incatalogue/model-types/, one per HuggingFacemodel_type:gpt_oss.json: fetcho200k_base.tiktokenandcl100k_base.tiktoken, setTIKTOKEN_ENCODINGS_BASE, add the tool-call and reasoning parsers (first value the installed vLLM registers).qwen3_5.json,qwen3_5_moe.json: the chat template fix for the system-message check.deepseek_v4.json(new, covers V4 Flash, Pro and Flash Vision):--tokenizer-mode deepseek_v4and thedeepseek_v4tool-call and reasoning parsers. The repos ship no chat template and their cards don't name these flags, so profiles fromnewcouldn't render chat requests.internal/modeltypeloads and validates them. A local file in~/.config/vllm-helper/model-types.d/adds a model type, or replaces a shipped one with the same id. Bad local files are skipped with a warning, and doctor lists them.New commands:
model-types listandmodel-types show <id>, both with--json.TestNoGoCodeRepeatsAShippedModelTypefails if Go code names a shipped model type id.Behaviour differences
qwen3_5andqwen3_5_moerepos. Before, any repo whose template matched the text was patched.TIKTOKEN_ENCODINGS_BASEin the profile. Setup no longer createstiktoken-encodingsor writes the variable toconfig.env. Existingconfig.envlines still work.harmony_vocab.Checks
go vet ./...(linux and darwin/arm64),go test -race ./...(skippingTestProbeReportsThisMachine, which fails in this VM on main too)go run ./scripts/gendocswith no diff,prettier --check .tools/recipediff: same 4 undeclared differences as mainmodel-types.d/gpt_oss.jsonreplaced the shipped entry, a broken file was skipped with a warning