Prepare CPU Parakeet Redux and interchangeable STT endpoint

This commit is contained in:
Mikei386 committed 2026-10-13 16:22:09 +02:00
1 parent d28dce4476
commit 81cc316ebe
15 files changed
+349 -14

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
"""Pinned, native CPU-only Redux runtime; no implicit download or inference."""
import hashlib,json,os,time
from pathlib import Path
REPO='mudler/parakeet-cpp-gguf'
REVISION='741158ae71e64ef5c89385862c18f777d07a97a1'
MODEL='redux-packed.gguf'
SHA256='574614b9a4d9f72ab202877a7ad6a1f4bf819dd1d27b9d42dfe8cd429fcebdd5'
VERSION='v0.6.1'
def supported(model):return bool(model and model.get('repo')==REPO and model.get('revision')==REVISION and model.get('file')==MODEL)
class ParakeetRuntime:
def __init__(self,root):self.root=Path(root)
def paths(self):
root=self.root/VERSION
binary=root/'runtime'/('parakeet-'+VERSION+'-bin-linux-cpu-x64')/'parakeet-server'
return binary,root/MODEL
def status(self):
binary,model=self.paths();manifest=self.root/VERSION/'manifest.json'
try:
data=json.loads(manifest.read_text());verified=data['version']==VERSION and data['model_revision']==REVISION and any(r['path']==MODEL and r['sha256']==SHA256 for r in data['files'])
except (OSError,ValueError,KeyError,TypeError):verified=False
return dict(installed=bool(verified and binary.is_file() and os.access(binary,os.X_OK) and model.is_file()),version=VERSION,repo=REPO,revision=REVISION,device='cpu')
def binary(self):
if not self.status()['installed']:raise ValueError('Parakeet-CPU-Laufzeit fehlt. Gepinntes Vorbereitungsrezept ausführen.')
return self.paths()[0]
def register(self,catalog):
if not self.status()['installed']:raise ValueError('Parakeet-Dateien fehlen.')
_,model=self.paths();ident=hashlib.sha256((REPO+REVISION+MODEL).encode()).hexdigest();target=catalog.root/ident
target.mkdir(parents=True,exist_ok=True,mode=0o700)
dest=target/'model.gguf'
if not dest.exists():dest.symlink_to(model.resolve())
entry=dict(repo=REPO,revision=REVISION,file=MODEL,kind='stt',size=model.stat().st_size,sha256=SHA256,upstream_hash_verified=True,downloaded_at=time.time(),state='downloaded',runtime_ready=True)
temp=target/'entry.tmp';temp.write_text(json.dumps(entry));temp.replace(target/'entry.json');return ident