mirror of
https://github.com/yusufipk/dikte.git
synced 2026-09-11 10:56:10 +00:00
Say what the local models are running on
"Use the graphics card" was a flag and nothing else: whisper got -ng when it was off, llama got -ngl 99 or 0, and nobody looked at what happened next. A build without a GPU backend runs on the processor while the box stays ticked, which is what the release archives for Linux do, every time. Nothing anywhere reported whether the local server was even up. Both servers already say where the model went, in the log Dikte captures. It is read back once the server reports ready and turned into a backend, a card and, for llama, the layers it offloaded. The verdict comes from what whisper committed to -- "using X backend" and the model buffer -- rather than from the devices it merely listed: a card that is found and then fails to initialise sends it back to the processor, and the listing alone would have called that a graphics card. A log that says nothing stays "could not tell" instead of being guessed at; a hand-built macOS whisper has Metal compiled in and prints no backend line at all. The state is then somewhere to be seen. Server.state() is a snapshot of the process and what it settled on, and it reaches `dikte status`, `dikte doctor` and a line under each local model box in the settings window. doctor reads the log from disk when no instance is running, so it still answers on a machine where Dikte is closed, and it says which of the three it is: what the last run used, that the last run said nothing, or that none ever ran here. Where the card was asked for and not obtained, the line says which of the two it is -- none was found, or this build carries none -- because only the second is worth replacing a download over. The tests grew a second isolation. They read ggml's own data directory, which is the real one on the machine running them, and program_path prefers a whisper-server on the PATH, so the suite answered from whatever the developer happened to have installed. Both are now the test's own. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_019zqCqhmeaNT6m1GPp8ZWPp
This commit is contained in:
@@ -24,6 +24,7 @@ from unittest import mock
|
||||
|
||||
from dikte import assistant
|
||||
from dikte import config as cfg
|
||||
from dikte import ggml
|
||||
from dikte import i18n
|
||||
from dikte import update
|
||||
|
||||
@@ -91,6 +92,22 @@ class DikteTest(unittest.TestCase):
|
||||
# down when it last ran.
|
||||
self.patch_attr(assistant, "SESSION_FILE", data_dir / "assistant.json")
|
||||
self.patch_attr(update, "STATE_FILE", data_dir / "update.json")
|
||||
# ggml resolves its own three from paths.DATA_DIR at import, the same
|
||||
# way cfg does. Left alone, a test asking what is installed or what the
|
||||
# last server ran on would be reading whatever this machine happens to
|
||||
# have downloaded, and passing or failing on somebody's home directory.
|
||||
# program_path prefers a whisper-server or llama-server on the PATH
|
||||
# over the copy Dikte downloaded, so on a machine with whisper.cpp
|
||||
# installed these tests would be answering from that copy instead of
|
||||
# from the install they set up. Every other tool still resolves; the
|
||||
# tests that are about the system build patch this again themselves.
|
||||
_which = shutil.which
|
||||
self.patch_attr(shutil, "which", lambda tool, *args, **rest: (
|
||||
None if tool in ("whisper-server", "llama-server")
|
||||
else _which(tool, *args, **rest)))
|
||||
self.patch_attr(ggml, "DATA_DIR", data_dir)
|
||||
self.patch_attr(ggml, "BIN_DIR", data_dir / "bin")
|
||||
self.patch_attr(ggml, "MODELS_DIR", data_dir / "models")
|
||||
|
||||
i18n.set_language("en")
|
||||
self.addCleanup(i18n.set_language, "en")
|
||||
|
||||
Reference in New Issue
Block a user