feat(controller): pass staged model directory to vLLM/SGLang for multi-file models (#1157)#1159
Open
Defilan wants to merge 2 commits into
Open
feat(controller): pass staged model directory to vLLM/SGLang for multi-file models (#1157)#1159Defilan wants to merge 2 commits into
Defilan wants to merge 2 commits into
Conversation
…efilantech#1157) Add a stagedDir field to modelStorageConfig, populated in the two multi-file staging branches (cached: the cache directory; emptyDir: /models/<ns>-<name>) and left empty for single-file and GGUF paths. This exposes the staged directory that both builders already compute but previously discarded into the primary-file path. Signed-off-by: Christopher Maher <chris@mahercode.io>
…e models For a multi-file model on a directory-oriented runtime (vLLM/SGLang) whose format is not GGUF, hand the runtime the staged model directory (the full Hugging Face model tree) instead of the primary file, which Safetensors runtimes require. GGUF and llama.cpp keep the primary-file path; multi-file GGUF/MTP is unaffected. Selection happens once at the deployment_builder choke point via a new servedModelPath helper. Fixes defilantech#1157 Signed-off-by: Christopher Maher <chris@mahercode.io>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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
For a multi-file Hugging Face model served on a directory-oriented runtime (SGLang / vLLM), pass the staged model directory as the model path instead of the resolved primary file. GGUF and llama.cpp (including multi-file MTP) keep their primary-file behavior.
Why
Fixes #1157 (thanks @Tanguille). v0.9.7 downloads and caches all files of a revision-pinned multi-file HF source, but the controller still set
modelPathto/models/<cache-key>/<plan.Primary>. SGLang (--model-path) and vLLM (positional model arg) need the directory containing the full model tree (Safetensors shards + config/tokenizer/generation files), not one file.How
Approach A (centralized selection), no CRD change, runtime backends untouched:
modelStorageConfig.stagedDir— new field, populated only in the two multi-file storage branches (cached: the cache directory; emptyDir:/models/<ns>-<name>), empty for single-file / GGUF. Both builders already computed this directory and discarded it.directoryOrientedRuntime(runtime)— classifiesvllm/sglang(matchesresolveBackend's switch style).servedModelPath(isvc, model, sc)— selects dir-vs-file once at thedeployment_builderchoke point beforeBuildArgs. Gate:stagedDirset and directory-oriented runtime andFormat != gguf. Everything else keeps the primary-file path.The runtime gate alone already excludes multi-file GGUF/MTP (always llama.cpp); the
Format != ggufcheck is a safety belt (e.g. a hypotheticalruntime: vllm+ GGUF).safetensors/pytorch/mlxdirectories all work.Testing
buildCachedStorageConfigandbuildEmptyDirStorageConfigsetstagedDirfor multi-file (identically); single-file leaves it empty.TestServedModelPath(7 cases): SGLang/vLLM + safetensors/pytorch → directory; GGUF, unset format, llama.cpp, single-file → primary file.TestDirectoryOrientedRuntime: vllm/sglang true, others false.internal/controllerenvtest suite green;make lintclean.Checklist
make testpasses locally (controller envtest suite green)make lintpasses locally (0 issues)Fixes #1157AI-assisted (band-3): designed and implemented with Claude Code (brainstorm → spec → plan → TDD) under human review; commits authored clean. Human owns the review conversation. @Tanguille, happy to have you test this against your multi-file Safetensors + SGLang/vLLM setup.