feat(docker): support a multimodal projector via --mmproj
Vision-capable GGUFs need a separate projector (mmproj) that maps image embeddings into the text model's space. Add `mmproj` and `mmproj_offload` as config keys and CLI overrides, and pass them through to llama-server. The projector path resolves under hf_home exactly like model_path, so it is covered by the existing read-only mount. validate_model_path() now also checks the projector, which means --change rejects a missing one *before* it removes the running container. --no-mmproj-offload is suppressed when no projector is configured, since llama.cpp rejects the flag on its own. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
489af21fd2
commit
218c3fc791
9 changed files with 199 additions and 9 deletions
|
|
@ -178,6 +178,41 @@ def test_build_run_command_relative_model_path():
|
|||
assert cmd[idx + 1] == "/hf_home/qwen3/default.gguf"
|
||||
|
||||
|
||||
def test_build_run_command_no_mmproj_by_default():
|
||||
cmd = build_run_command(make_cfg())
|
||||
assert "--mmproj" not in cmd
|
||||
assert "--no-mmproj-offload" not in cmd
|
||||
|
||||
|
||||
def test_build_run_command_mmproj_relative_path_resolves_under_hf_home():
|
||||
cfg = make_cfg(mmproj="qwen3/mmproj.gguf")
|
||||
cmd = build_run_command(cfg)
|
||||
idx = cmd.index("--mmproj")
|
||||
assert cmd[idx + 1] == "/hf_home/qwen3/mmproj.gguf"
|
||||
# offload is llama.cpp's default, so the opt-out flag must stay absent
|
||||
assert "--no-mmproj-offload" not in cmd
|
||||
|
||||
|
||||
def test_build_run_command_mmproj_absolute_path_passed_through():
|
||||
cfg = make_cfg(mmproj="/abs/mmproj.gguf")
|
||||
cmd = build_run_command(cfg)
|
||||
idx = cmd.index("--mmproj")
|
||||
assert cmd[idx + 1] == "/abs/mmproj.gguf"
|
||||
|
||||
|
||||
def test_build_run_command_mmproj_offload_disabled():
|
||||
cfg = make_cfg(mmproj="qwen3/mmproj.gguf", mmproj_offload=False)
|
||||
cmd = build_run_command(cfg)
|
||||
assert "--no-mmproj-offload" in cmd
|
||||
|
||||
|
||||
def test_build_run_command_no_mmproj_offload_needs_mmproj():
|
||||
# Without a projector the offload opt-out is meaningless and must not leak
|
||||
# into the command line (llama.cpp would reject it).
|
||||
cfg = make_cfg(mmproj="", mmproj_offload=False)
|
||||
assert "--no-mmproj-offload" not in build_run_command(cfg)
|
||||
|
||||
|
||||
def test_format_command_for_display_quotes_properly():
|
||||
cmd = ["docker", "run", "--name", "has space"]
|
||||
out = format_command_for_display(cmd)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue