Add Vulkan GPU deployment support for fertigungski
This commit is contained in:
1 parent
9ce4af69be
commit
63182ef32a
11 files changed
+269
No files matched your search
@@ -74,3 +74,17 @@ def test_environment_rejects_invalid_container_args(monkeypatch, value: str) ->
|
||||
|
||||
with pytest.raises(ConfigurationError, match="JSON array"):
|
||||
AppSettings.from_environment()
|
||||
|
||||
|
||||
@pytest.mark.parametrize("backend", ["cpu", "vulkan", "auto"])
|
||||
def test_whisper_backend_from_environment(monkeypatch, backend):
|
||||
monkeypatch.setenv("MKA_WHISPER_BACKEND", backend)
|
||||
assert AppSettings.from_environment().whisper_backend == backend
|
||||
|
||||
|
||||
def test_invalid_whisper_backend_is_rejected(tmp_path):
|
||||
model = tmp_path / "model.bin"
|
||||
model.write_bytes(b"model")
|
||||
settings = AppSettings(data_root=tmp_path, whisper_model=model, whisper_backend="hip")
|
||||
with pytest.raises(ConfigurationError, match="MKA_WHISPER_BACKEND"):
|
||||
settings.validate_for_processing()
|
||||
@@ -0,0 +1,46 @@
|
||||
"""The host launcher selects one model while retaining the CPU default."""
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
LAUNCHER = Path(__file__).resolve().parents[1] / "run_fertigungski.sh"
|
||||
|
||||
|
||||
def test_fertigungski_rejects_alternate_protocol_model():
|
||||
result = subprocess.run(
|
||||
["bash", str(LAUNCHER)],
|
||||
env={**os.environ, "MKA_PROTOCOL_MODEL": "other:model"},
|
||||
capture_output=True,
|
||||
text=True,
|
||||
check=False,
|
||||
)
|
||||
assert result.returncode == 1
|
||||
assert "requires MKA_PROTOCOL_MODEL=qwen3.8:27b" in result.stderr
|
||||
|
||||
|
||||
def test_fertigungski_exports_fixed_model_and_cpu_default(tmp_path):
|
||||
launcher = tmp_path / "run_fertigungski.sh"
|
||||
launcher.write_bytes(LAUNCHER.read_bytes())
|
||||
streamlit = tmp_path / ".venv/bin/streamlit"
|
||||
streamlit.parent.mkdir(parents=True)
|
||||
streamlit.write_text(
|
||||
'#!/bin/bash\nprintf "%s %s\\n" "$MKA_PROTOCOL_MODEL" "$MKA_WHISPER_BACKEND"\n'
|
||||
)
|
||||
streamlit.chmod(0o755)
|
||||
executable = tmp_path / "whisper-cli"
|
||||
executable.write_text("#!/bin/bash\nexit 0\n")
|
||||
executable.chmod(0o755)
|
||||
model = tmp_path / "model.bin"
|
||||
model.write_bytes(b"model")
|
||||
environment = {key: value for key, value in os.environ.items() if not key.startswith("MKA_")}
|
||||
environment.update(MKA_WHISPER_EXECUTABLE=str(executable), MKA_WHISPER_MODEL=str(model))
|
||||
result = subprocess.run(
|
||||
["bash", str(launcher)],
|
||||
env=environment,
|
||||
capture_output=True,
|
||||
text=True,
|
||||
check=False,
|
||||
)
|
||||
assert result.returncode == 0
|
||||
assert result.stdout.strip() == "qwen3.8:27b cpu"
|
||||
@@ -162,6 +162,7 @@ def make_service(tmp_path: Path) -> tuple[MeetingProcessingService, FakeMeetingL
|
||||
whisper_model=model,
|
||||
glossary_database=tmp_path / "glossary.sqlite3",
|
||||
whisper_executable="/opt/whisper-cli",
|
||||
whisper_backend="vulkan",
|
||||
protocol_model="test:model",
|
||||
diarization_mode="gpu",
|
||||
)
|
||||
@@ -382,6 +383,7 @@ def test_process_translates_configuration_and_disables_diarization(
|
||||
assert gateway.config_values["protocol_num_ctx"] == 32_768
|
||||
assert gateway.config_values["protocol_safe_input_token_budget"] == 29_000
|
||||
assert gateway.config_values["whisper_executable"] == "/opt/whisper-cli"
|
||||
assert gateway.config_values["whisper_backend"] == "vulkan"
|
||||
assert gateway.config_values["ffmpeg_executable"] == "ffmpeg"
|
||||
assert gateway.config_values["audio_normalization"] is True
|
||||
assert gateway.config_values["diarization_runtime"] == "native"
|
||||
|
||||
Reference in new issue
Block a user