Author SHA1 Message Date
admin f87a7d354c Merge domain model documentation 2026-10-12 15:22:34 +02:00
admin 63182ef32a Add Vulkan GPU deployment support for fertigungski 2026-10-12 15:18:54 +02:00
admin 31801729ed Refine chunked transcription strategy 2026-07-20 12:21:04 +02:00
13 changed files with 321 additions and 3 deletions

No files matched your search

+1
View File
@@ -6,6 +6,7 @@ MKA_OLLAMA_ENDPOINT=http://127.0.0.1:11434
MKA_DATA_ROOT=data/meetings MKA_DATA_ROOT=data/meetings
MKA_GLOSSARY_DATABASE=data/database/glossary.sqlite3 MKA_GLOSSARY_DATABASE=data/database/glossary.sqlite3
MKA_WHISPER_THREADS=auto MKA_WHISPER_THREADS=auto
MKA_WHISPER_BACKEND=auto
MKA_DIARIZATION_MODE=auto MKA_DIARIZATION_MODE=auto
MKA_DIARIZATION_RUNTIME=native MKA_DIARIZATION_RUNTIME=native
# MKA_DIARIZATION_CONTAINER_IMAGE= # MKA_DIARIZATION_CONTAINER_IMAGE=
+27
View File
@@ -184,3 +184,30 @@ Meeting Lab retains immutable generation records including prompt, transcript
input, model response/metadata, glossary configuration, mappings and Meeting input, model response/metadata, glossary configuration, mappings and Meeting
Context. Latest protocol/diagnostic/context paths resolve through an atomic Context. Latest protocol/diagnostic/context paths resolve through an atomic
`protocol/current` link. Copy whole runs with relative symlinks preserved. `protocol/current` link. Copy whole runs with relative symlinks preserved.
## Whisper backend configuration
`AppSettings.whisper_backend` loads `MKA_WHISPER_BACKEND` (`cpu`, `vulkan`, `auto`)
and the application service forwards it as `MvpMeetingConfig.whisper_backend`.
Meeting Lab owns execution policy, diagnostics, fallback and provenance. The
portable default remains Auto; the new fertigungski launcher remains CPU until
hardware validation passes. CPU preserves the original `/opt/whisper.cpp/build`
installation, while Vulkan/Auto select the separate `build-vulkan` binary.
Apply Assistant and Lab changes together. Historical artifacts, Ollama model files/GPU backend, ROCm packages and power
limits remain unchanged. An additive concurrency-only service drop-in is staged
separately.
## fertigungski independent GPU concurrency
The host launcher enforces qwen3.8:27b for Assistant; the application already
sends num_ctx=32768. The additive service drop-in configures
OLLAMA_MAX_LOADED_MODELS=1 and OLLAMA_NUM_PARALLEL=2. Deployment requires a service
reload/restart and is not performed by the launcher. Whisper and Ollama remain
independent; no shared GPU queue or global lock exists. Device OOM, host OOM and
allocation failures are classified and surfaced by Lab; Ollama is never retried.
The opt-in concurrency benchmark makes six LLM requests and two strict Vulkan
transcriptions, retaining per-case timings, overlap and read-only telemetry.
Mocked tests do not prove the 32 GB card can sustain two 32768-token contexts
plus Whisper. Live deployment and realistic resource measurements remain blocked
in the current sandbox.
+44
View File
@@ -262,3 +262,47 @@ Meeting Lab retains immutable generation records including prompt, transcript
input, model response/metadata, glossary configuration, mappings and Meeting input, model response/metadata, glossary configuration, mappings and Meeting
Context. Latest protocol/diagnostic/context paths resolve through an atomic Context. Latest protocol/diagnostic/context paths resolve through an atomic
`protocol/current` link. Copy whole runs with relative symlinks preserved. `protocol/current` link. Copy whole runs with relative symlinks preserved.
## Explicit Whisper backend
`MKA_WHISPER_BACKEND=cpu|vulkan|auto` is forwarded to Meeting Lab. The portable
default is `auto`. CPU explicitly disables GPU execution. Vulkan requires
selected hardware-backend diagnostics and successful inference; Auto emits a
warning and records any CPU fallback. Backend and executable/model provenance
are saved in the run's transcription metadata and diagnostic files. Transcript
formats, language, threads, flash attention and Ollama settings are unchanged.
Use the paired Meeting Lab change, including its `docs/whisper-vulkan.md`, before
running this Assistant revision. That document contains the pinned separate
build and controlled benchmark procedure. Keep the original executable/model.
On fertigungski, `./run_fertigungski.sh` defaults to the original CPU installation.
After successful R9700 validation, select the separate build explicitly:
```bash
MKA_WHISPER_BACKEND=vulkan ./run_fertigungski.sh
```
For reported fallback within the Vulkan binary, select `auto` instead. Both
modes select `/opt/whisper.cpp/build-vulkan/bin/whisper-cli` by default; an explicit
`MKA_WHISPER_EXECUTABLE` overrides the path. Changing the launcher's host default
to Vulkan is deferred until actual hardware validation and benchmarking pass.
The launcher does not change the existing local `start.sh` or Ollama service configuration.
Rollback selects the preserved CPU binary and same model:
```bash
MKA_WHISPER_BACKEND=cpu \
MKA_WHISPER_EXECUTABLE=/opt/whisper.cpp/build/bin/whisper-cli \
./run_fertigungski.sh
```
The fertigungski launcher permits only `qwen3.8:27b`. The additive Ollama service
policy sets one resident model and two parallel inference requests, while
Assistant keeps its explicit 32768-token context. Ollama and Vulkan Whisper run
independently; no global GPU lock or scheduler is introduced. Confirmed GPU OOM
is reported, and any Auto Whisper CPU fallback retains that diagnostic. See
[host concurrency deployment, benchmarking and rollback](docs/gpu-concurrency.md).
The service policy and Vulkan host default require live host validation before
being marked active.
@@ -0,0 +1,3 @@
[Service]
Environment="OLLAMA_MAX_LOADED_MODELS=1"
Environment="OLLAMA_NUM_PARALLEL=2"
+46 -2
View File
@@ -10,16 +10,60 @@ The project requires high-quality speech-to-text transcription for German and En
The transcription component should support local execution where practical and should remain replaceable in the future. The project should not depend on a meeting bot or on a proprietary meeting platform. The transcription component should support local execution where practical and should remain replaceable in the future. The project should not depend on a meeting bot or on a proprietary meeting platform.
Practical testing showed that long continuous recordings may suffer from error propagation when the decoder continuously conditions on previously generated text.
Independent transcription of smaller audio chunks produced significantly more stable results.
## Decision ## Decision
The project will use `faster-whisper` as the initial transcription engine. The project will use `faster-whisper` as the initial transcription engine.
The preferred first model is `large-v3-turbo`, with `large-v3` as quality-oriented fallback if required. The preferred first model is `large-v3-turbo`, with `large-v3` as a quality-oriented fallback if required.
The transcription pipeline shall process recordings as independent audio chunks rather than as a single continuous recording.
The default processing strategy is:
```text
Recording (WAV)
│
▼
Split into 5-minute chunks
│
▼
Independent Whisper transcription
(condition_on_previous_text = False)
│
▼
JSON transcript per chunk
│
▼
Merge chunk transcripts
│
▼
Canonical transcript
```
Chunk duration shall be configurable, with **5 minutes** as the default value.
Each chunk shall be processed independently.
The decoder shall not use text generated from previous chunks as context.
Each chunk shall produce its own intermediate JSON transcript before merging.
The merge step shall preserve timestamps and chunk ordering.
## Consequences ## Consequences
- Long recordings become more robust.
- Error propagation across chunk boundaries is prevented.
- Failed chunks can be retranscribed independently.
- Parallel processing of multiple chunks becomes possible.
- Intermediate JSON files simplify debugging and future reprocessing.
- Chunk size can be tuned later without changing the overall architecture.
- Transcription can run locally on suitable hardware. - Transcription can run locally on suitable hardware.
- NVIDIA CUDA acceleration can be used later on an office AI PC. - NVIDIA CUDA acceleration can be used later on an office AI PC.
- The transcription module must hide the concrete engine behind an internal interface. - The transcription module must hide the concrete engine behind an internal interface.
- Model name, language setting, timestamp and engine version should be stored with every transcript. - Model name, language setting, timestamp mode, engine version, chunk duration and relevant decoding parameters shall be stored with every transcript.
- The decision can be revisited if another engine provides clearly better quality, speed or deployment characteristics. - The decision can be revisited if another engine provides clearly better quality, speed or deployment characteristics.
+6 -1
View File
@@ -54,7 +54,12 @@ meeting/
├── transcript/ ├── transcript/
│ ├── canonical.json │ ├── canonical.json
│ ├── working_v1.json │ ├── working_v1.json
│ └── working_v2.json │
├── chunks/
│ ├── chunk_000.json
│ ├── chunk_001.json
│ ├── chunk_002.json
│ ├── ...
│ │
├── artifacts/ ├── artifacts/
│ ├── summary.md │ ├── summary.md
+99
View File
@@ -0,0 +1,99 @@
# fertigungski GPU concurrency policy
Meeting Assistant on this host uses `qwen3.8:27b` only. The host launcher rejects
an alternate `MKA_PROTOCOL_MODEL`; the reusable Meeting Lab engine remains
configurable for other projects. Assistant protocol requests retain explicit
`num_ctx=32768`, thinking disabled and the existing prompt budget. No model
files, model quantization, KV-cache settings or GPU backend are changed.
The additive systemd drop-in at
`deploy/fertigungski/20-meeting-concurrency.conf` contains exactly:
```ini
[Service]
Environment="OLLAMA_MAX_LOADED_MODELS=1"
Environment="OLLAMA_NUM_PARALLEL=2"
```
Deployment requires normal host access. Install it as
`/etc/systemd/system/ollama.service.d/20-meeting-concurrency.conf`, preserving
all existing drop-ins. Reload systemd and restart Ollama to activate these
startup settings; this interrupts active requests, so perform it when idle.
Check `systemctl show ollama.service --property=Environment`, service logs and
`ollama ps` afterwards. Merely exporting these variables in the Assistant
shell does not configure an already running Ollama service.
Ollama and whisper.cpp have independent execution and queueing. Two Ollama
requests and Vulkan transcription are permitted to overlap. There is no
shared GPU lock, scheduler, model unloading, admission controller or automatic
context reduction. The resident-model limit applies to Ollama; it neither
reserves VRAM for Whisper nor restricts which models other clients may request.
Two parallel 32768-token context slots can consume more VRAM than the validated
single-request workload. Measure the combined load rather than assuming it fits
32 GB. See [Ollama concurrency guidance](https://docs.ollama.com/faq#how-does-ollama-handle-concurrent-requests).
Whisper's original CPU binary remains available. Explicit Vulkan reports device
OOM and fails; Auto may retry once on CPU, reporting and retaining the OOM
classification even when the retry succeeds. Ollama memory errors are reported
without retries. Host OOM, unqualified memory errors and device allocation
failures are distinguished from confirmed GPU OOM. Pipeline failure metadata
and the existing Assistant failure display expose these errors. No additional
coordination should be added unless controlled measurements demonstrate need.
## Controlled concurrent validation
The paired Lab checkout supplies `scripts/benchmark_gpu_concurrency.py`. Supply
a representative, canonical audio clip (preferably long enough to overlap LLM
processing) and full realistic protocol prompts, including context. Existing
prompt files may be read without regenerating or altering historical meetings.
Use estimated prompt sizes up to 29000 tokens. Two distinct prompts are
preferable to measure realistic traffic rather than only prompt-cache reuse.
```bash
python3 scripts/benchmark_gpu_concurrency.py /path/to/canonical-test.wav \
--prompt-file /path/to/protocol-prompt-1.txt \
--second-prompt-file /path/to/protocol-prompt-2.txt \
--whisper-model /opt/whisper.cpp/models/ggml-large-v3-turbo.bin \
--whisper-executable /opt/whisper.cpp/build-vulkan/bin/whisper-cli \
--language de --threads auto \
--output-dir /tmp/meeting-gpu-concurrency-001
```
The benchmark makes **six qwen3.8:27b generation requests**, all with
`num_ctx=32768`, and two strict Vulkan transcriptions. Outputs go only to the
new specified directory, which must not already exist. Three cases compare:
1. Serial execution of both LLM requests and Whisper.
2. Both LLM requests in parallel, without Whisper.
3. Both LLM requests in parallel alongside Whisper.
The script never unloads the model: the serial baseline can retain the resident
LLM during Whisper execution. It records per-job latency, request-window overlap,
OOM/errors, inference outputs/provenance, sampled AMD sysfs VRAM/utilization,
power (microwatts), temperature (millidegrees Celsius), and `/api/ps` snapshots.
Unavailable telemetry is not invented. A failed case is recorded and stops later
cases; there are no LLM retries or automatic CPU fallbacks in this benchmark.
Request-window overlap alone does not establish concurrent server-side GPU
execution. Verify Ollama runner logs show two configured parallel slots, confirm
both requests actually used the Radeon, and correlate timings with Whisper
backend diagnostics and GPU monitoring. Repeat into fresh directories to
separate startup and caching effects. Compare transcription/protocol quality,
latency, peak VRAM and observed headroom before adopting the Vulkan host default.
## Rollback
Launch Assistant with `MKA_WHISPER_BACKEND=cpu` and the original
`/opt/whisper.cpp/build/bin/whisper-cli`; keep the same model. To undo the Ollama
policy, remove only the new concurrency drop-in, then reload systemd and restart
Ollama when idle. Existing overrides, model files, GPU backend and power limits
remain untouched.
## Validation status in this implementation environment
The Vulkan build compiled in an isolated `/tmp` source copy. CPU inference and
strict unavailability handling were validated. Deployment under `/opt`, systemd
configuration/restart, R9700 inference and realistic concurrent benchmarking are
blocked by sandbox write/device/service/network restrictions. The host Vulkan
default has therefore not been activated. Passing mocked concurrency tests does
not establish VRAM capacity or performance.
+28
View File
@@ -0,0 +1,28 @@
#!/usr/bin/env bash
set -euo pipefail
repo="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"
cd -- "$repo"
# This host uses exactly one Assistant protocol model.
if [[ "${MKA_PROTOCOL_MODEL:-qwen3.8:27b}" != qwen3.8:27b ]]; then
printf 'fertigungski requires MKA_PROTOCOL_MODEL=qwen3.8:27b.\n' >&2
exit 1
fi
export MKA_PROTOCOL_MODEL=qwen3.8:27b
# Keep this host on CPU until its Vulkan hardware validation is complete.
export MKA_WHISPER_BACKEND="${MKA_WHISPER_BACKEND:-cpu}"
case "$MKA_WHISPER_BACKEND" in
cpu) default_executable=/opt/whisper.cpp/build/bin/whisper-cli ;;
vulkan|auto) default_executable=/opt/whisper.cpp/build-vulkan/bin/whisper-cli ;;
*) printf 'Invalid MKA_WHISPER_BACKEND: %s\n' "$MKA_WHISPER_BACKEND" >&2; exit 1 ;;
esac
export MKA_WHISPER_EXECUTABLE="${MKA_WHISPER_EXECUTABLE:-$default_executable}"
export MKA_WHISPER_MODEL="${MKA_WHISPER_MODEL:-/opt/whisper.cpp/models/ggml-large-v3-turbo.bin}"
export PYTHONPATH="$repo/src:$repo/../meeting-lab"
export VIRTUAL_ENV="$repo/.venv"
export PATH="$VIRTUAL_ENV/bin:$PATH"
[[ -x "$repo/.venv/bin/streamlit" && -x "$MKA_WHISPER_EXECUTABLE" && -r "$MKA_WHISPER_MODEL" ]] || {
printf 'Required Streamlit/Whisper executable or model is missing.\n' >&2
exit 1
}
exec "$repo/.venv/bin/streamlit" run src/mka/ui/streamlit_app.py
+4
View File
@@ -31,6 +31,7 @@ class AppSettings:
diarization_runtime: str = "native" diarization_runtime: str = "native"
diarization_container_image: str | None = None diarization_container_image: str | None = None
diarization_container_args: tuple[str, ...] = () diarization_container_args: tuple[str, ...] = ()
whisper_backend: str = "auto"
@classmethod @classmethod
def from_environment(cls) -> AppSettings: def from_environment(cls) -> AppSettings:
@@ -44,6 +45,7 @@ class AppSettings:
glossary_database=Path( glossary_database=Path(
os.getenv("MKA_GLOSSARY_DATABASE", "data/database/glossary.sqlite3") os.getenv("MKA_GLOSSARY_DATABASE", "data/database/glossary.sqlite3")
), ),
whisper_backend=os.getenv("MKA_WHISPER_BACKEND", "auto"),
whisper_executable=os.getenv("MKA_WHISPER_EXECUTABLE", "whisper-cli"), whisper_executable=os.getenv("MKA_WHISPER_EXECUTABLE", "whisper-cli"),
ffmpeg_executable=os.getenv("MKA_FFMPEG_EXECUTABLE", "ffmpeg"), ffmpeg_executable=os.getenv("MKA_FFMPEG_EXECUTABLE", "ffmpeg"),
protocol_model=os.getenv("MKA_PROTOCOL_MODEL", "qwen3.8:27b"), protocol_model=os.getenv("MKA_PROTOCOL_MODEL", "qwen3.8:27b"),
@@ -60,6 +62,8 @@ class AppSettings:
def validate_for_processing(self) -> None: def validate_for_processing(self) -> None:
"""Validate settings needed before a Meeting Lab run starts.""" """Validate settings needed before a Meeting Lab run starts."""
if self.whisper_backend not in {"cpu", "vulkan", "auto"}:
raise ConfigurationError("MKA_WHISPER_BACKEND must be cpu, vulkan, or auto.")
if self.whisper_model is None: if self.whisper_model is None:
raise ConfigurationError("MKA_WHISPER_MODEL is not configured.") raise ConfigurationError("MKA_WHISPER_MODEL is not configured.")
if not self.whisper_model.is_file(): if not self.whisper_model.is_file():
+1
View File
@@ -346,6 +346,7 @@ class MeetingProcessingService:
"audio_file": audio_file, "audio_file": audio_file,
"whisper_model": self.settings.whisper_model, "whisper_model": self.settings.whisper_model,
"whisper_executable": self.settings.whisper_executable, "whisper_executable": self.settings.whisper_executable,
"whisper_backend": self.settings.whisper_backend,
"ffmpeg_executable": self.settings.ffmpeg_executable, "ffmpeg_executable": self.settings.ffmpeg_executable,
"audio_normalization": options.audio_normalization, "audio_normalization": options.audio_normalization,
"output_root": output_root, "output_root": output_root,
+14
View File
@@ -74,3 +74,17 @@ def test_environment_rejects_invalid_container_args(monkeypatch, value: str) ->
with pytest.raises(ConfigurationError, match="JSON array"): with pytest.raises(ConfigurationError, match="JSON array"):
AppSettings.from_environment() 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()
+46
View File
@@ -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"
+2
View File
@@ -162,6 +162,7 @@ def make_service(tmp_path: Path) -> tuple[MeetingProcessingService, FakeMeetingL
whisper_model=model, whisper_model=model,
glossary_database=tmp_path / "glossary.sqlite3", glossary_database=tmp_path / "glossary.sqlite3",
whisper_executable="/opt/whisper-cli", whisper_executable="/opt/whisper-cli",
whisper_backend="vulkan",
protocol_model="test:model", protocol_model="test:model",
diarization_mode="gpu", 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_num_ctx"] == 32_768
assert gateway.config_values["protocol_safe_input_token_budget"] == 29_000 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_executable"] == "/opt/whisper-cli"
assert gateway.config_values["whisper_backend"] == "vulkan"
assert gateway.config_values["ffmpeg_executable"] == "ffmpeg" assert gateway.config_values["ffmpeg_executable"] == "ffmpeg"
assert gateway.config_values["audio_normalization"] is True assert gateway.config_values["audio_normalization"] is True
assert gateway.config_values["diarization_runtime"] == "native" assert gateway.config_values["diarization_runtime"] == "native"