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.

Manual placement: log the --fit verdict the launch actually carries (#10831)

jishnav639d27ee7e63
diff --git a/studio/backend/core/inference/llama_cpp.py b/studio/backend/core/inference/llama_cpp.py
index 4f6073318c9..d18a90f42e8 100644
--- a/studio/backend/core/inference/llama_cpp.py
+++ b/studio/backend/core/inference/llama_cpp.py
@@ -27078,6 +27078,10 @@ class LlamaCppBackend:
)
kv_cache_bytes = _kv_bytes(effective_ctx)
+ # The Manual launch branch below emits --fit off; decide it before the
+ # decision line so the log matches the argv (#10821).
+ if gpu_memory_mode == "manual" and gpu_layers >= 0:
+ use_fit = False
# Everything the spill planner needs, snapshotted as plain ints
# where it is already evaluated.
_spill_inputs = {
@@ -27171,7 +27175,10 @@ class LlamaCppBackend:
f"{_mtp_note}"
f"context: {effective_ctx}, "
# --fit flag state, not "does it fit": off means this subset provably fits.
- f"GPUs free: {gpus}, selected: {gpu_indices}, --fit: {'on' if use_fit else 'off'}"
+ # Manual modes empty gpus on purpose; say so, not a failed probe.
+ f"GPUs free: {gpus}"
+ f"{' (manual mode)' if not gpus and gpu_memory_mode == 'manual' else ''}, "
+ f"selected: {gpu_indices}, --fit: {'on' if use_fit else 'off'}"
)
_on = list(gpu_indices or [idx for idx, _ in gpus])
if _on:
diff --git a/studio/backend/tests/test_manual_mode_decision_log.py b/studio/backend/tests/test_manual_mode_decision_log.py
new file mode 100644
index 00000000000..4856c76b51f
--- /dev/null
+++ b/studio/backend/tests/test_manual_mode_decision_log.py
@@ -0,0 +1,57 @@
+# SPDX-License-Identifier: AGPL-3.0-only
+# Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+"""The GGUF decision line reports the --fit state the launch carries (#10821)."""
+
+from __future__ import annotations
+
+import sys
+from pathlib import Path
+
+import pytest
+
+sys.path.insert(0, str(Path(__file__).resolve().parent))
+
+from test_llama_cpp_placement import _backend, _launch # noqa: E402
+
+import core.inference.llama_cpp as llama_cpp # noqa: E402
+
+_GPU = [(0, 24 * 1024, 24 * 1024)]
+
+
+def _decision_line(tmp_path, monkeypatch, **load_kwargs):
+ lines = []
+ real_info = llama_cpp.logger.info
+
+ def info(msg, *a, **kw):
+ lines.append(str(msg))
+ return real_info(msg, *a, **kw)
+
+ monkeypatch.setattr(llama_cpp.logger, "info", info)
+ backend, gguf = _backend(tmp_path, vulkan = False, memory = _GPU)
+ cmd = _launch(backend, gguf, n_ctx = 4096, **load_kwargs)["cmd"]
+ (line,) = [l for l in lines if "GPUs free: " in l]
+ return line, cmd
+
+
[email protected]("gpu_layers", [0, 42])
+def test_manual_layers_log_matches_fit_off_argv(tmp_path, monkeypatch, gpu_layers):
+ line, cmd = _decision_line(
+ tmp_path, monkeypatch, gpu_memory_mode = "manual", gpu_layers = gpu_layers
+ )
+ assert cmd[cmd.index("--fit") + 1] == "off"
+ assert line.endswith("--fit: off")
+ assert "GPUs free: [] (manual mode)," in line
+
+
+def test_manual_auto_layers_keeps_fit_on(tmp_path, monkeypatch):
+ line, cmd = _decision_line(tmp_path, monkeypatch, gpu_memory_mode = "manual", gpu_layers = -1)
+ assert cmd[cmd.index("--fit") + 1] == "on"
+ assert line.endswith("--fit: on")
+ assert "GPUs free: [] (manual mode)," in line
+
+
+def test_auto_mode_line_unlabelled(tmp_path, monkeypatch):
+ line, _ = _decision_line(tmp_path, monkeypatch)
+ assert "manual mode" not in line
+ assert "GPUs free: [(0, " in line