Add and activate pinned native Qwen Q8 CPU TTS integration
This commit is contained in:
1 parent
bfd21c8548
commit
562c01ef37
19 files changed
+486
-42
No files matched your search
@@ -0,0 +1,50 @@
|
||||
"""Pinned native Qwen3-TTS Q8 CPU runtime; weights remain in the model library."""
|
||||
import json,os,shutil,sys
|
||||
from pathlib import Path
|
||||
from ltx_original_runtime import LTXOriginalRuntime
|
||||
|
||||
VERSION='0.4.2'
|
||||
REPO='Serveurperso/Qwen3-TTS-GGUF'
|
||||
REVISION='b7ee2e8c7459c3bea99da23e3d178125a7d1713c'
|
||||
MODEL_FILE='qwen-talker-0.6b-base-Q8_0.gguf'
|
||||
CODEC_FILE='qwen-tokenizer-12hz-Q8_0.gguf'
|
||||
COMPONENTS={'codec':dict(label='Qwen Sprach-Codec · Q8_0',revision=REVISION,files=[CODEC_FILE])}
|
||||
|
||||
def supported(model):
|
||||
return bool(model and model.get('kind')=='audio' and model.get('repo')==REPO and model.get('revision')==REVISION and model.get('file')==MODEL_FILE)
|
||||
|
||||
class QwenNativeRuntime(LTXOriginalRuntime):
|
||||
name='Qwen3-TTS 0.6B Q8 · CPU'
|
||||
def __init__(self,root):super().__init__(root,None)
|
||||
def paths(self):
|
||||
try:
|
||||
ident=json.loads((self.root/'active.json').read_text())['id']
|
||||
if len(ident)==32 and all(c in '0123456789abcdef' for c in ident):
|
||||
base=self.root/ident
|
||||
if (base/'ready').read_text().strip()==VERSION:return base/'python/bin/python',base
|
||||
except (OSError,ValueError,KeyError,TypeError):pass
|
||||
return self.root/'missing-python',self.root/'missing-runtime'
|
||||
def status(self):
|
||||
python,base=self.paths()
|
||||
return dict(installed=python.is_file() and (base/'ready').is_file(),version=VERSION,device='cpu',required_disk_gib=3,job=dict(self.job) if self.job else None,speakers=['default','Anna'],languages=['German'],origin='https://github.com/KoljaB/RealtimeTTS',generation_threads=4,codec_threads=4,stream_frames=2)
|
||||
def _run(self):
|
||||
base=self.root/self.job['id'];state='failed';phase='Native Qwen-CPU-Einrichtung fehlgeschlagen.'
|
||||
try:
|
||||
base.mkdir(mode=0o700)
|
||||
env={k:v for k,v in os.environ.items() if not k.startswith(('HF_','DECK_','LLAMA_','OPENAI_'))}
|
||||
env.update(PIP_NO_INPUT='1',PIP_DISABLE_PIP_VERSION_CHECK='1',CUDA_VISIBLE_DEVICES='',HF_HUB_DISABLE_IMPLICIT_TOKEN='1')
|
||||
self._phase('Eigene native CPU-Python-Umgebung erstellen');self._command([sys.executable,'-m','venv',base/'python'],env)
|
||||
python=base/'python/bin/python'
|
||||
self._phase('Gepinnte Qwen-CPU-Laufzeit installieren · ohne PyTorch oder CUDA')
|
||||
self._command([python,'-m','pip','install','--only-binary=:all:','-r',Path(__file__).parent/'deploy/qwen-native-requirements.lock'],env)
|
||||
self._command([python,'-m','pip','check'],env)
|
||||
self._command([python,'-c','import qwentts_cpp_cpu as q;assert q.CPU_ONLY is True;assert q.QT_ABI_VERSION==5'],env)
|
||||
if self.cancel.is_set():raise InterruptedError()
|
||||
(base/'ready').write_text(VERSION)
|
||||
temp=self.root/'active.tmp';temp.write_text(json.dumps({'id':base.name}));temp.replace(self.root/'active.json')
|
||||
state='complete';phase='Native Qwen-CPU-Laufzeit bereit · Q8-Modell und Sprach-Codec im Profil zuordnen'
|
||||
except InterruptedError:state='cancelled';phase='Einrichtung abgebrochen.'
|
||||
except Exception as exc:phase=str(exc)
|
||||
finally:
|
||||
if state!='complete':shutil.rmtree(base,ignore_errors=True)
|
||||
with self.lock:self.process=None;self.job.update(state=state,phase=phase);self._save()
|
||||
Reference in new issue
Block a user