From 08f687edf12e7699d31ef897c282e744e0d14a50 Mon Sep 17 00:00:00 2001 From: Mikei386 <44135113+Mikei386@users.noreply.github.com> Date: Tue, 13 Oct 2026 16:37:45 +0200 Subject: [PATCH] Activate and verify Redux STT switching; size CPU RAM admission by backend --- integrations/parakeet-redux/README.md | 48 +++++++- .../parakeet-redux/integration-check.py | 60 +++++++++ .../parakeet-redux/integration-results.json | 114 ++++++++++++++++++ stt.py | 6 +- 4 files changed, 221 insertions(+), 7 deletions(-) create mode 100644 integrations/parakeet-redux/integration-check.py create mode 100644 integrations/parakeet-redux/integration-results.json diff --git a/integrations/parakeet-redux/README.md b/integrations/parakeet-redux/README.md index d47515c..93d05ba 100644 --- a/integrations/parakeet-redux/README.md +++ b/integrations/parakeet-redux/README.md @@ -1,8 +1,7 @@ # Parakeet Redux — preparation on Athena, 2026-10-13 -**Deck update remains prepared/inactive. By subsequent explicit user request, the -isolated Redux CPU preview is now started. No transcription test, app activation/restart, -endpoint publication or change to running Qwen/Strata/audio policies.** +**Activated after user Go. The Redux profile is available in Deck; production STT +publication remains Qwen. The isolated preview has been stopped after integration.** ## Files and runtime @@ -82,8 +81,9 @@ Parakeet server accepts WAV and returns JSON text, which matches Deck's existing normalization and response. Its verbose_json language is an `en` placeholder and its language hint is not a forced language selector; Deck exposes only the existing text result. Word timestamps/live previews are NOT part of this initial adapter. -The same existing120-second upload and4-GiB admission limits are retained initially; -preparation does not claim a measured RAM minimum or change unrelated limits. +The existing120-second upload limit is retained. Qwen keeps its4-GiB RAM admission +check; Redux uses1GiB after its loaded preview measured369MiB. Short synthetic +requests were checked; this does not establish the peak for120-second recordings. ## Verification / restore @@ -123,3 +123,41 @@ recipe suppresses stdout/stderr so reference audio/transcripts cannot enter its It is not selectable in the currently running Deck app until the prepared app update is activated. After the regular integration is activated and ready, stop only this temporary preview with `systemctl stop athena-parakeet-redux-preview`. + +## Activated and API-tested after user Go + +Final active image: `athena-deck-standalone:parakeet-ready-20261013`. New profile +**Parakeet Redux CPU** registered, runnable; existing **QWEN3-ASR-STT** remains published. +The native CPU preview has been stopped; Deck launches its own CPU worker when used. +API URL, token, old model name and STT publication policy remain usable. + +An initial in-container duplicate-Qwen test was rejected by the existing4-GiB +admission check because Strata's mapped model pages filled most of the40-GiB +cgroup budget. This is a resource admission result, not an ASR accuracy result. +Redux's same inherited check was therefore adjusted to1GiB. A separate8-GiB, +2CPU, network-disabled test container then exercised the real STT and Endpoint +classes with an isolated profile/endpoint configuration; production publication +was never changed. The existing CUDA-linked Qwen binary needs libcuda.so.1 even +on CPU; the test mounted only that driver library, with no GPU devices and +CUDA_VISIBLE_DEVICES empty. Outputs are purely synthetic. + +Eight successful HTTP200 requests switched Qwen → Redux while keeping the old +Qwen model name in every request. The same pair of WAVs were each transcribed +twice by both backends. `integration-results.json` records synthetic text/metrics. + +| Synthetic recording | Qwen warm | Redux warm | Simple word errors | +|---|---:|---:|---| +| Piper German,5.956s |0.808s|0.407s|both1/14| +| Qwen clone German,4.640s |0.806s|0.406s|Qwen0/12,Redux2/12| + +First Piper request including load: Qwen3.028s,Redux0.807s. Endpoint's200-ms +job polling coarsens these latency measurements. These two short generated clips +suggest lower latency, not demonstrated superiority on real speech or noise. +Qwen was more accurate on the second clip. Tests do not alter production settings. +35 relevant non-inference unit tests passed after the RAM correction. + +`integration-check.py` must only be run on explicitly selected synthetic fixtures. +It starts a separate authenticated loopback endpoint with an ephemeral internally +held test key, drives the same publication logic and uses the actual native +backends. Its finally block stops only its own CPU workers. Test metadata and +public text are in Git; no credentials or private audio were captured. diff --git a/integrations/parakeet-redux/integration-check.py b/integrations/parakeet-redux/integration-check.py new file mode 100644 index 0000000..6d6acfe --- /dev/null +++ b/integrations/parakeet-redux/integration-check.py @@ -0,0 +1,60 @@ +"""Synthetic test of the real Deck endpoint classes; production settings untouched.""" +import hashlib,io,json,os,pathlib,secrets,socket,sys,tempfile,time,urllib.request,wave +from types import SimpleNamespace +sys.path.insert(0,'/app') +from endpoint import Endpoint +from stt import STT,normalize_transcription_audio +from parakeet_runtime import supported as redux_supported +root=pathlib.Path('/var/lib/deck');output=pathlib.Path(os.environ.get('REDUX_TEST_OUTPUT','/var/lib/deck/parakeet-comparison-prepared'))/'integration-results.json' +model_rows=[] +for path in (root/'models').glob('*/entry.json'): + d=json.loads(path.read_text());d['id']=path.parent.name + if d.get('repo') in ('ggml-org/Qwen3-ASR-0.6B-GGUF','mudler/parakeet-cpp-gguf'):model_rows.append(d) +entries={d['id']:d for d in model_rows} +selected=[] +for row in json.loads((root/'profiles.json').read_text()): + if row['kind']=='stt' and row['model_id'] in entries and entries[row['model_id']]['file'] in ('Qwen3-ASR-0.6B-Q8_0.gguf','redux-packed.gguf'): + selected.append(dict(row,model=entries[row['model_id']],runnable=True,blockers=[])) +qwen=next(p for p in selected if not redux_supported(p['model']));redux=next(p for p in selected if redux_supported(p['model'])) +catalog=SimpleNamespace(root=root/'models',entry=lambda ident:entries[ident],status=lambda:{'entries':model_rows}) +profiles=SimpleNamespace(status=lambda:{'profiles':selected}) +rt=json.loads((root/'runtime/state.json').read_text());runtime=SimpleNamespace(root=root/'runtime',status=lambda:{'active':rt['active']}) +stt=STT(profiles,catalog,runtime) +for p in selected: + blockers=stt.blockers(p) + if blockers:raise RuntimeError('STT preflight failed: '+' '.join(blockers)) +key=secrets.token_hex(32);credentials=SimpleNamespace(read=lambda:{'api_token_hash':hashlib.sha256(key.encode()).hexdigest()}) +worker=SimpleNamespace(status=lambda:{'state':'stopped'}) +scheduler=SimpleNamespace(status=lambda:{'active_requests':0},unload_idle=lambda:True,gpu_mode='llm') +images=SimpleNamespace(status=lambda:{'job':None}) +os.environ['DECK_API_PORTS']='';os.environ['DECK_API_BIND']='127.0.0.1' +results=[] +with tempfile.TemporaryDirectory(prefix='redux-api-check-') as directory: + ep=Endpoint(directory,profiles,worker,scheduler,images,credentials,0);ep.stt=stt + with socket.socket() as s:s.bind(('127.0.0.1',0));port=s.getsockname()[1] + ep.config['port']=port + cases=json.loads((root/'parakeet-comparison-prepared/cases/cases.json').read_text()) + try: + ep.enable({'id':qwen['id'],'enabled':True});ep.start() + for profile in (qwen,redux): + ep.enable({'id':profile['id'],'enabled':True}) + for case in cases: + audio=normalize_transcription_audio((root/'parakeet-comparison-prepared/cases'/case['file']).read_bytes()) + with wave.open(io.BytesIO(audio)) as w:duration=w.getnframes()/w.getframerate() + for repetition in (1,2): + boundary='synthetic-redux-integration' + # Deliberately keep the OLD Qwen name when switching to Redux. + body=(f'--{boundary}\r\nContent-Disposition: form-data; name="model"\r\n\r\n{qwen["name"]}\r\n--{boundary}\r\nContent-Disposition: form-data; name="language"\r\n\r\nde\r\n--{boundary}\r\nContent-Disposition: form-data; name="file"; filename="synthetic.wav"\r\nContent-Type: audio/wav\r\n\r\n').encode()+audio+f'\r\n--{boundary}--\r\n'.encode() + start=time.monotonic() + request=urllib.request.Request(f'http://127.0.0.1:{port}/v1/audio/transcriptions',data=body,headers={'Authorization':'Bearer '+key,'Content-Type':'multipart/form-data; boundary='+boundary}) + try: + with urllib.request.urlopen(request,timeout=300) as response:payload=json.load(response);status=response.status + except urllib.error.HTTPError as exc: + print(json.dumps({'synthetic_test_error':json.loads(exc.read()),'status':exc.code}),flush=True);raise + elapsed=time.monotonic()-start + row=dict(backend='redux' if redux_supported(profile['model']) else 'qwen',case=case['name'],repetition=repetition,status=status,seconds=round(elapsed,3),audio_seconds=round(duration,3),rtf=round(elapsed/duration,4),text=payload['text'],expected=case['expected'],actual_profile=stt.profile_id,legacy_name_preserved=True) + results.append(row);output.write_text(json.dumps(results,indent=2,ensure_ascii=False));print(json.dumps({k:v for k,v in row.items() if k not in ('text','expected')}),flush=True) + finally: + stt.stop() + if ep.http:ep.http.shutdown();ep.http.server_close() +(output.parent/'integration-complete').write_text('Synthetic endpoint switching verified\n') diff --git a/integrations/parakeet-redux/integration-results.json b/integrations/parakeet-redux/integration-results.json new file mode 100644 index 0000000..2d2e534 --- /dev/null +++ b/integrations/parakeet-redux/integration-results.json @@ -0,0 +1,114 @@ +[ + { + "backend": "qwen", + "case": "German synthetic Piper", + "repetition": 1, + "status": 200, + "seconds": 3.028, + "audio_seconds": 5.956, + "rtf": 0.5084, + "text": "Hallo Michael, die Sprachausgabe läuft jetzt auf dem separaten Rechner. Attna bleibt dabei unverändert.", + "expected": "Hallo Michael. Die Sprachausgabe läuft jetzt auf dem separaten Rechner. Athena bleibt dabei unverändert.", + "actual_profile": "22343368d75044feb49156be348b61b4", + "legacy_name_preserved": true, + "simple_wer": 0.0714 + }, + { + "backend": "qwen", + "case": "German synthetic Piper", + "repetition": 2, + "status": 200, + "seconds": 0.808, + "audio_seconds": 5.956, + "rtf": 0.1357, + "text": "Hallo Michael, die Sprachausgabe läuft jetzt auf dem separaten Rechner. Attna bleibt dabei unverändert.", + "expected": "Hallo Michael. Die Sprachausgabe läuft jetzt auf dem separaten Rechner. Athena bleibt dabei unverändert.", + "actual_profile": "22343368d75044feb49156be348b61b4", + "legacy_name_preserved": true, + "simple_wer": 0.0714 + }, + { + "backend": "qwen", + "case": "German synthetic Qwen clone", + "repetition": 1, + "status": 200, + "seconds": 1.407, + "audio_seconds": 4.64, + "rtf": 0.3033, + "text": "Dies ist der Test der geklonten Stimme. Die vorhandenen Modellgewichte werden wiederverwendet.", + "expected": "Dies ist der Test der geklonten Stimme. Die vorhandenen Modellgewichte werden wiederverwendet.", + "actual_profile": "22343368d75044feb49156be348b61b4", + "legacy_name_preserved": true, + "simple_wer": 0.0 + }, + { + "backend": "qwen", + "case": "German synthetic Qwen clone", + "repetition": 2, + "status": 200, + "seconds": 0.806, + "audio_seconds": 4.64, + "rtf": 0.1738, + "text": "Dies ist der Test der geklonten Stimme. Die vorhandenen Modellgewichte werden wiederverwendet.", + "expected": "Dies ist der Test der geklonten Stimme. Die vorhandenen Modellgewichte werden wiederverwendet.", + "actual_profile": "22343368d75044feb49156be348b61b4", + "legacy_name_preserved": true, + "simple_wer": 0.0 + }, + { + "backend": "redux", + "case": "German synthetic Piper", + "repetition": 1, + "status": 200, + "seconds": 0.807, + "audio_seconds": 5.956, + "rtf": 0.1354, + "text": "Hallo Michael, die Sprachausgabe läuft jetzt auf dem separaten Rechner, Atna bleibt dabei unverändert.", + "expected": "Hallo Michael. Die Sprachausgabe läuft jetzt auf dem separaten Rechner. Athena bleibt dabei unverändert.", + "actual_profile": "900ce9bc079e4202909eafc3a11c1d4f", + "legacy_name_preserved": true, + "simple_wer": 0.0714 + }, + { + "backend": "redux", + "case": "German synthetic Piper", + "repetition": 2, + "status": 200, + "seconds": 0.407, + "audio_seconds": 5.956, + "rtf": 0.0683, + "text": "Hallo Michael, die Sprachausgabe läuft jetzt auf dem separaten Rechner, Atna bleibt dabei unverändert.", + "expected": "Hallo Michael. Die Sprachausgabe läuft jetzt auf dem separaten Rechner. Athena bleibt dabei unverändert.", + "actual_profile": "900ce9bc079e4202909eafc3a11c1d4f", + "legacy_name_preserved": true, + "simple_wer": 0.0714 + }, + { + "backend": "redux", + "case": "German synthetic Qwen clone", + "repetition": 1, + "status": 200, + "seconds": 0.406, + "audio_seconds": 4.64, + "rtf": 0.0874, + "text": "Dies ist der Test der geklonten Stimme. Die vorhandenen Modellgewichte werden wieder verwendet.", + "expected": "Dies ist der Test der geklonten Stimme. Die vorhandenen Modellgewichte werden wiederverwendet.", + "actual_profile": "900ce9bc079e4202909eafc3a11c1d4f", + "legacy_name_preserved": true, + "simple_wer": 0.1667 + }, + { + "backend": "redux", + "case": "German synthetic Qwen clone", + "repetition": 2, + "status": 200, + "seconds": 0.406, + "audio_seconds": 4.64, + "rtf": 0.0874, + "text": "Dies ist der Test der geklonten Stimme. Die vorhandenen Modellgewichte werden wieder verwendet.", + "expected": "Dies ist der Test der geklonten Stimme. Die vorhandenen Modellgewichte werden wiederverwendet.", + "actual_profile": "900ce9bc079e4202909eafc3a11c1d4f", + "legacy_name_preserved": true, + "simple_wer": 0.1667 + } +] \ No newline at end of file diff --git a/stt.py b/stt.py index 15071d3..2d7e899 100644 --- a/stt.py +++ b/stt.py @@ -140,7 +140,8 @@ class STT: if not p or not p['runnable']:raise ValueError('STT-Profil nicht ausführbar. Zuerst Einrichten öffnen.') if not self.process or self.process.poll() is not None: headroom=cgroup_headroom() - if headroom is not None and headroom<4*1024**3:raise ValueError('Mindestens 4 GiB freier Deck-RAM werden benötigt.') + required=(1 if redux_supported(p['model']) else 4)*1024**3 + if headroom is not None and headroom