Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Studio: skip tensor-parallel for vision models; fix MTP drafter VRAM reserve on Windows (#6416)

Leo Borcherding5be8835de512
diff --git a/studio/backend/core/inference/llama_cpp.py b/studio/backend/core/inference/llama_cpp.py
index 340520d40d5..4826403bbc4 100644
--- a/studio/backend/core/inference/llama_cpp.py
+++ b/studio/backend/core/inference/llama_cpp.py
@@ -1810,6 +1810,7 @@ class LlamaCppBackend:
[bin_path, "--help"],
capture_output = True,
text = True,
+ errors = "replace",
timeout = 10,
check = False,
env = probe_env,
@@ -2959,7 +2960,7 @@ class LlamaCppBackend:
if model_footprint + kv + _mtp_at(requested_ctx) <= budget_bytes:
return requested_ctx
- # Weights alone exceed budget -- reducing ctx can't help; --fit handles it.
+ # Weights + compute buffer alone exceed budget -- reducing ctx can't help.
if model_footprint >= budget_bytes:
logger.debug(
"Model footprint exceeds GPU budget before KV cache",
@@ -4808,6 +4809,7 @@ class LlamaCppBackend:
or bool(mtp_draft_path)
)
_mtp_binary_ok = True
+ _mtp_probe_raised = False
if not _user_mtp_via_extras:
try:
_mtp_binary_ok = bool(
@@ -4815,17 +4817,24 @@ class LlamaCppBackend:
)
except Exception:
_mtp_binary_ok = False
+ _mtp_probe_raised = True
_mtp_will_engage = bool(
_user_mtp_via_extras
or _user_draft_via_extras
or (
not _extra_args_set_spec_type(extra_args)
- and _mtp_binary_ok
and _mtp_model_for_fit
and (
_mtp_effective in ("mtp", "mtp+ngram")
or (_mtp_effective == "auto" and not _mtp_sub_3b_for_fit)
)
+ and (
+ _mtp_binary_ok
+ # Reserve on a raised (uncached) probe too: it re-probes in
+ # _build_speculative_flags and may still engage MTP (embedded
+ # head or separate drafter -- _mtp_model_for_fit covers both).
+ or _mtp_probe_raised
+ )
)
)
@@ -4982,6 +4991,22 @@ class LlamaCppBackend:
)
_pin_fraction = self._GPU_PIN_VRAM_FRACTION - _flat_mtp_reserve
+ if tensor_parallel and effective_is_vision:
+ logger.info(
+ "Tensor parallelism skipped for vision model: "
+ "--split-mode tensor is incompatible with --mmproj "
+ "in the current llama.cpp build; using layer split."
+ )
+ tensor_parallel = False
+ if _tensor_dropped_cache_type_kv is not None:
+ cache_type_kv = _tensor_dropped_cache_type_kv
+ _cache_type_from_env = False
+ extra_args = strip_split_mode_only(
+ _tensor_dropped_extra_args
+ if _tensor_dropped_extra_args is not None
+ else extra_args
+ )
+
# Tensor mode replicates a compute buffer on every GPU, so drop
# GPUs below that reserve from the set up front (gpu_indices
# becomes the CUDA_VISIBLE_DEVICES mask, fully excluding them).
diff --git a/studio/backend/tests/test_mtp_vram_budget.py b/studio/backend/tests/test_mtp_vram_budget.py
index f61ffa3c21e..e7c6b022327 100644
--- a/studio/backend/tests/test_mtp_vram_budget.py
+++ b/studio/backend/tests/test_mtp_vram_budget.py
@@ -864,8 +864,8 @@ class TestExtraArgsMtpDetection:
# f16/f16 on the layer fallback) (#6312).
load = "".join(inspect.getsource(LlamaCppBackend.load_model).split())
assert "_tensor_dropped_extra_args=list(extra_args)" in load
- # Both tensor->layer downgrade points restore the saved originals.
- assert load.count("strip_split_mode_only(_tensor_dropped_extra_argsif") == 2
+ # All three tensor->layer downgrade points restore the saved originals.
+ assert load.count("strip_split_mode_only(_tensor_dropped_extra_argsif") == 3
def test_load_model_tensor_skips_reserve_for_cpu_drafter(self):
# A separate CPU-offloaded drafter (no embedded head) uses no GPU, so the