Skip to content

feat(controller): pass staged model directory to vLLM/SGLang for multi-file models (#1157)#1159

Open
Defilan wants to merge 2 commits into
defilantech:mainfrom
Defilan:feat/1157-multifile-dir
Open

feat(controller): pass staged model directory to vLLM/SGLang for multi-file models (#1157)#1159
Defilan wants to merge 2 commits into
defilantech:mainfrom
Defilan:feat/1157-multifile-dir

Conversation

@Defilan

@Defilan Defilan commented Jul 18, 2026

Copy link
Copy Markdown
Member

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 modelPath to /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:

  1. 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.
  2. directoryOrientedRuntime(runtime) — classifies vllm / sglang (matches resolveBackend's switch style).
  3. servedModelPath(isvc, model, sc) — selects dir-vs-file once at the deployment_builder choke point before BuildArgs. Gate: stagedDir set and directory-oriented runtime and Format != gguf. Everything else keeps the primary-file path.

The runtime gate alone already excludes multi-file GGUF/MTP (always llama.cpp); the Format != gguf check is a safety belt (e.g. a hypothetical runtime: vllm + GGUF). safetensors / pytorch / mlx directories all work.

Testing

  • buildCachedStorageConfig and buildEmptyDirStorageConfig set stagedDir for 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.
  • Full internal/controller envtest suite green; make lint clean.

Checklist

  • Tests added/updated
  • make test passes locally (controller envtest suite green)
  • make lint passes locally (0 issues)
  • Conventional commits, DCO signed
  • AI assistance disclosed below
  • Fixes #1157

AI-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.

Defilan added 2 commits July 18, 2026 11:50
…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

codecov Bot commented Jul 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Pass multi-file model directories to directory-based runtimes

1 participant