Files
Mikei386 c0bc5d3a1b Integrate Basalt telemetry and shared GPU speech runtimes
Publish the reviewed accumulated runtime, scheduler, profile, UI, native recipes and historical maintenance evidence. Includes Qwen GPU ASR correction and shared Anna/atelier ownership. Validated with 784 local tests, Python/JSON parsing and eight JavaScript syntax checks. Live GPU acceptance and full fresh-host restore limits remain documented.
2026-11-03 21:16:41 +01:00

29 lines
2.8 KiB
Python

#!/usr/bin/env python3
"""NAS Hermes: bounded Basalt restoration, Anna WAV, real GPU-ASR transcript."""
import importlib.util,io,json,time,urllib.request,wave
from pathlib import Path
ROOT=Path(__file__).resolve().parent
s=importlib.util.spec_from_file_location('managed_transport',ROOT/'basalt-candidate-2026-11-01/paired_transport.py');assert s and s.loader
m=importlib.util.module_from_spec(s);s.loader.exec_module(m);KEY=m.key();BASE='http://192.168.1.212:8120';START=time.monotonic()
OUT=Path('/opt/data/profiles/athena-deck/cache/scratch/qwen-asr-gpu-acceptance.json')
def call(path,data=None,content_type='application/json',binary=False):
assert time.monotonic()-START<900,'15-minute acceptance budget exceeded'
if isinstance(data,dict):data=json.dumps(data).encode()
req=urllib.request.Request(BASE+path,data=data,headers={'Authorization':'Bearer '+KEY,'Content-Type':content_type})
with urllib.request.urlopen(req,timeout=180) as r:return r.read() if binary else json.load(r)
def main():
result={}
d=call('/v1/chat/completions',dict(model='flash-next-basalt',messages=[dict(role='user',content='Antworte nur mit BEREIT.')],max_tokens=16,temperature=0,chat_template_kwargs={'enable_thinking':False}))
assert 'BEREIT' in (d['choices'][0]['message'].get('content') or '').upper();result['basalt_restored']=True;print('Basalt restored and actual answer verified',flush=True)
phrase='Der blaue Schlüssel liegt auf dem Tisch.'
audio=call('/v1/audio/speech',dict(model='qwen-anna-gpu-3060',voice='default',input=phrase,response_format='wav'),binary=True)
with wave.open(io.BytesIO(audio),'rb') as w:result['anna']=dict(rate=w.getframerate(),channels=w.getnchannels(),seconds=w.getnframes()/w.getframerate())
assert result['anna']['rate']==24000 and result['anna']['channels']==1;print('Anna real speech API passed',flush=True)
boundary='asr-acceptance-fixture';body=f'--{boundary}\r\nContent-Disposition: form-data; name="file"; filename="synthetic-reference.wav"\r\nContent-Type: audio/wav\r\n\r\n'.encode()+audio+b'\r\n'
for name,value in [('model','qwen3-asr-3060'),('language','de')]:body+=f'--{boundary}\r\nContent-Disposition: form-data; name="{name}"\r\n\r\n{value}\r\n'.encode()
body+=f'--{boundary}--\r\n'.encode();t=time.monotonic();d=call('/v1/audio/transcriptions',body,'multipart/form-data; boundary='+boundary)
text=d.get('text','');assert isinstance(text,str) and 'blau' in text.lower() and 'tisch' in text.lower() and 'Transcribe audio' not in text,text
result.update(asr_text=text,asr_seconds=time.monotonic()-t,total_seconds=time.monotonic()-START,scope='One short synthetic speech/transcription, not a benchmark; GPU process placement must be checked separately')
OUT.write_text(json.dumps(result,indent=2));assert json.loads(OUT.read_text())==result;print(json.dumps(result),flush=True)
if __name__=='__main__':main()