Repository navigation
Conversation
- HfTextDirectoryLoader supports kimi_k31 as a host reference family, loading KimiK31TextModel on the backend the request names (CUDA or Vulkan when asked, CPU otherwise). No CPU fallback. - KimiK31TextModel and KimiK31GenerationModel adapt KimiK31Checkpoint to the shared pipeline. KimiK31Model splits ForwardToken into ForwardTokenHidden and ProjectHidden. - Image input and multi-GPU placement are refused by name (KimiK31Refusals). - The vision tower is not loaded; the checkpoint loads text-only. - kimi-k3.1-pro catalog row: Structural, not CLI-drivable, pinned to d9e99b07. - CPU-lane tests cover the route, logits, replay, refusals and the catalog row.
This was referenced Nov 12, 2026
This branch has not been deployed
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.
Summary
Wires Kimi K3.1 (
model_typekimi_k31) into the engine's Text path as a host reference family, so a Kimi checkpoint directory loads throughHfTextDirectoryLoader.LoadHostReferencethe way ERNIE-5.5 and DeepSeek-V4.1 do.HfTextDirectoryLoader:kimi_k31is a supported host reference family, loaded asKimiK31TextModelon the backend the caller passes.RequireSupportedrefuses, by name, a Kimi directory with no shard index, nochat_template.jinja, or notokenizer.json(the Moonshot repo shipstiktoken.modelandtokenization_kimi.pyinstead).TextService.LoadHfDirectory: the Kimi branch picks its backend from the requested device (CUDA or Vulkan when asked, CPU otherwise). A device that cannot be created throws; the load never falls back to the CPU. The DeepSeek and ERNIE paths are unchanged, and they still force the CPU.KimiK31TextModelandKimiK31GenerationModel(new,src/HartsyInference.LLM/Kimi/) adaptKimiK31Checkpointto the shared pipeline. They reuseHostReplaySequenceStateand do not batch decode, so Kimi requests take the pipeline route, which gates the device they name.KimiK31Model:ForwardTokenis split intoForwardTokenHiddenandProjectHidden. The decoder's math is unchanged, and the existing Kimi tests pass.KimiK31Refusals(new): image input on a Kimi slot is refused by name (NotSupportedException). Otherwise the image would reachRunTextand be dropped silently. Multi-GPU placement (+composite keys, two or more shard devices, tensor-parallel degree above 1) is refused by name. This is the placement hook for the sharding work still in progress.mm_projector.*are never read. Image requests are refused.kimi-k3.1-pro(moonshotai/Kimi-K3.1-Pro): Structural,CliDrivable = false, noAssets. Revision pinned tod9e99b0792a5e93b78ea9bea62a68167e36ddd9e(read from the HF APIsha). License text summarized in the row's notes from the repo'sLICENSEfile ("Kimi K3.1-Pro License").Tests (CPU lane)
dotnet testonHartsyInference.Engine.Tests, CPU filter: 314 passed, 0 failed, 1 skipped (FfmpegFrameSourceTests, resource-guarded).dotnet testonHartsyInference.LLM.Tests, CPU filter: 178 passed, 0 failed.KimiK31TextPathTests(route load on CPU, finite logits from prefill andProjectLogits, deterministic pipeline generation, rollback and replay, vision checkpoint loads text-only and refuses image input by name, multi-GPU refusals by name, single-device requests pass, missing template and missingtokenizer.jsonrefused by name) andKimiK31CatalogTests.KimiSyntheticCheckpoint(Engine test helper) reuses the ERNIE tokenizer and template files; vocab is 259 to cover the merged id 258.Not run
KimiK31ModelGpuTests(GpuIntegration) was not run. The CUDA and Vulkan paths throughKimiK31TextModelare wired but unverified: host-resident weights on a device backend, the device gate, and the output tensors are untested.tokenizer.json, so the real checkpoint cannot load through the route until one is supplied. The loader widens dense weights to F32 at load (about 114 GB of bf16 in the research doc), and there is no host memory guard yet.TextServicelogs a warning about this.TextService, which needs the whole engine. The refusals are unit tested throughKimiK31Refusals.sha. The HF tree was not checked for file-level hashes.Notes for reviewers
KimiK31Model.csandTextService.csare shared with other work. TheKimiK31Modelchange is additive, in theForwardTokenregion.TextServicealso gets a small refactor: the slot-disposal code moves fromReplaceWithHostBackendintoDisposeSlotBackends, with no behavior change for the existing paths.## Unreleasedheading, per the author's instruction.VersionSuffixis untouched.