Restore old router Base TTS with identical preset voice embeddings
This commit is contained in:
1 parent
08e9d69424
commit
0d2f441dae
10 files changed
+110
-8
No files matched your search
@@ -0,0 +1,7 @@
|
|||||||
|
Preset embeddings copied unchanged from the retained old Athena Qwen TTS container.
|
||||||
|
Source: https://huggingface.co/datasets/malaiwah/qwen3-tts-preset-voices
|
||||||
|
These rows originate from Qwen/Qwen3-TTS-12Hz-1.7B-CustomVoice (Apache-2.0).
|
||||||
|
The accompanying bundle.json records speaker IDs and tensor provenance.
|
||||||
|
Used with Qwen3-TTS-12Hz-1.7B-Base as VoiceClonePromptItem, x_vector_only_mode=True,
|
||||||
|
icl_mode=False, ref_code=None, ref_text=None, matching the old router's preset path.
|
||||||
|
No personal reference recordings or credentials are included.
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
{
|
||||||
|
"source_repo": "Qwen/Qwen3-TTS-12Hz-1.7B-CustomVoice",
|
||||||
|
"source_tensor": "talker.model.codec_embedding.weight",
|
||||||
|
"dim": 2048,
|
||||||
|
"dtype": "bfloat16",
|
||||||
|
"speakers": {
|
||||||
|
"aiden": {
|
||||||
|
"id": 2861,
|
||||||
|
"gender": "m",
|
||||||
|
"lang": "en,zh"
|
||||||
|
},
|
||||||
|
"dylan": {
|
||||||
|
"id": 2878,
|
||||||
|
"gender": "m",
|
||||||
|
"lang": "en,zh"
|
||||||
|
},
|
||||||
|
"eric": {
|
||||||
|
"id": 2875,
|
||||||
|
"gender": "m",
|
||||||
|
"lang": "en,zh"
|
||||||
|
},
|
||||||
|
"ono_anna": {
|
||||||
|
"id": 2873,
|
||||||
|
"gender": "f",
|
||||||
|
"lang": "ja,en,zh"
|
||||||
|
},
|
||||||
|
"ryan": {
|
||||||
|
"id": 3061,
|
||||||
|
"gender": "m",
|
||||||
|
"lang": "en,zh"
|
||||||
|
},
|
||||||
|
"serena": {
|
||||||
|
"id": 3066,
|
||||||
|
"gender": "f",
|
||||||
|
"lang": "en,zh"
|
||||||
|
},
|
||||||
|
"sohee": {
|
||||||
|
"id": 2864,
|
||||||
|
"gender": "f",
|
||||||
|
"lang": "ko,en,zh"
|
||||||
|
},
|
||||||
|
"uncle_fu": {
|
||||||
|
"id": 3010,
|
||||||
|
"gender": "m",
|
||||||
|
"lang": "zh"
|
||||||
|
},
|
||||||
|
"vivian": {
|
||||||
|
"id": 3065,
|
||||||
|
"gender": "f",
|
||||||
|
"lang": "en,zh"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notes": "Lifted rows from CustomVoice codec_embedding. Consumed as VoiceClonePromptItem(ref_spk_embedding=row, x_vector_only_mode=True)."
|
||||||
|
}
|
||||||
Binary file not shown.
+1
-1
@@ -15,7 +15,7 @@ import urllib.request
|
|||||||
|
|
||||||
ROOT = Path(__file__).resolve().parent.parent
|
ROOT = Path(__file__).resolve().parent.parent
|
||||||
LABEL = 'de.casaderoll.athena-deck.standalone'
|
LABEL = 'de.casaderoll.athena-deck.standalone'
|
||||||
FILES = ['deploy/applio-requirements.lock','deploy/activate_applio.py','deploy/import_applio.py','deploy/backup_applio_data.py','applio.py','applio_runtime.py','applio_worker.py','applio-ui.js','deploy/activate_acestep.py','acestep_models.py','deploy/import_acestep.py','deploy/acestep-web/Dockerfile','deploy/acestep-web/app.py','deploy/acestep-web/index.html','acestep.py','acestep_worker.py','acestep_runtime.py','acestep-ui.js','deploy/acestep-requirements.lock','deploy/omnivoice-requirements.lock','omnivoice_runtime.py','omnivoice_worker.py','deploy/voice-web/Dockerfile','deploy/voice-web/base.Dockerfile','deploy/voice-web/bridge.py','deploy/patch_yue2_residency.py','embeddings.py','voxcpm_test.py','voxcpm_worker.py','voice-ui.js','voxcpm_runtime.py','voxcpm-ui.js','deploy/voxcpm-requirements.lock','network/native.py','deploy/setup_network_helper.py','separator_sources.json','deploy/separator-web/Dockerfile','deploy/separator-web/app.py','deploy/separator-web/index.html','separator.py','separator_runtime.py','separator_worker.py','separator-ui.js','deploy/ladypoly/Dockerfile','deploy/ladypoly/bridge.py','music.py','music-ui.js','audio_cpp_runtime.py','audio-cpp-ui.js','ltx_original_runtime.py','ltx_original_entry.py','video_original.py','ltx-original-ui.js','deploy/ltx-original-requirements.lock','backup.py','backup_codec.py','backup-ui.js','deploy/docker_backup.py','deploy/swarm-ui/Dockerfile','deploy/swarm-ui/patch-source.py','deploy/swarm-ui/proxy.py','deploy/swarm-ui/entrypoint.py','deploy/Dockerfile.app-update','video_comfy.py','video_comfy_node.py','video_comfy_proxy.py','prompt_enhancer.py','prompt_enhancer_worker.py','image_upload.py','audio_policy.py','deploy/tts-requirements.lock','stt.py','stt-ui.js','api_compat.py','responses_compat.py','execution_setup.py','tts_runtime.py','tts_test.py','tts_worker.py','tts-ui.js','auto_test.py','auto-test-ui.js','chat_test.py','chat-test-ui.js','endpoint.py','inference.py','endpoint-ui.js','docker_support.py','docker-ui.js','deploy/docker_helper.py','deploy/setup_docker_helper.py','image_encoder_node.py','image_runtime.py','image_test.py','image-test-ui.js','profiles.py','profiles-ui.js','capacity.py','runtime.py','runtime-ui.js','video.py','video_proxy.py','video-ui.js','catalog.py','hub_auth.py','catalog-ui.js','server.py','auth.py','collect_hardware.py','dashboard_data.py','dashboard_history.py','dashboard-ui.js','dashboard.css','themes.css','deploy/import_dashboard_history.py','index.html','app.js','studio.js','style.css','login.html','login.js','access-ui.js','network-ui.js','network/__init__.py','network/client.py','network/config.py','network/rpc.py','deploy/Dockerfile','deploy/image-requirements.lock']
|
FILES = ['assets/tts-presets/bundle.safetensors','assets/tts-presets/bundle.json','deploy/applio-requirements.lock','deploy/activate_applio.py','deploy/import_applio.py','deploy/backup_applio_data.py','applio.py','applio_runtime.py','applio_worker.py','applio-ui.js','deploy/activate_acestep.py','acestep_models.py','deploy/import_acestep.py','deploy/acestep-web/Dockerfile','deploy/acestep-web/app.py','deploy/acestep-web/index.html','acestep.py','acestep_worker.py','acestep_runtime.py','acestep-ui.js','deploy/acestep-requirements.lock','deploy/omnivoice-requirements.lock','omnivoice_runtime.py','omnivoice_worker.py','deploy/voice-web/Dockerfile','deploy/voice-web/base.Dockerfile','deploy/voice-web/bridge.py','deploy/patch_yue2_residency.py','embeddings.py','voxcpm_test.py','voxcpm_worker.py','voice-ui.js','voxcpm_runtime.py','voxcpm-ui.js','deploy/voxcpm-requirements.lock','network/native.py','deploy/setup_network_helper.py','separator_sources.json','deploy/separator-web/Dockerfile','deploy/separator-web/app.py','deploy/separator-web/index.html','separator.py','separator_runtime.py','separator_worker.py','separator-ui.js','deploy/ladypoly/Dockerfile','deploy/ladypoly/bridge.py','music.py','music-ui.js','audio_cpp_runtime.py','audio-cpp-ui.js','ltx_original_runtime.py','ltx_original_entry.py','video_original.py','ltx-original-ui.js','deploy/ltx-original-requirements.lock','backup.py','backup_codec.py','backup-ui.js','deploy/docker_backup.py','deploy/swarm-ui/Dockerfile','deploy/swarm-ui/patch-source.py','deploy/swarm-ui/proxy.py','deploy/swarm-ui/entrypoint.py','deploy/Dockerfile.app-update','video_comfy.py','video_comfy_node.py','video_comfy_proxy.py','prompt_enhancer.py','prompt_enhancer_worker.py','image_upload.py','audio_policy.py','deploy/tts-requirements.lock','stt.py','stt-ui.js','api_compat.py','responses_compat.py','execution_setup.py','tts_runtime.py','tts_test.py','tts_worker.py','tts-ui.js','auto_test.py','auto-test-ui.js','chat_test.py','chat-test-ui.js','endpoint.py','inference.py','endpoint-ui.js','docker_support.py','docker-ui.js','deploy/docker_helper.py','deploy/setup_docker_helper.py','image_encoder_node.py','image_runtime.py','image_test.py','image-test-ui.js','profiles.py','profiles-ui.js','capacity.py','runtime.py','runtime-ui.js','video.py','video_proxy.py','video-ui.js','catalog.py','hub_auth.py','catalog-ui.js','server.py','auth.py','collect_hardware.py','dashboard_data.py','dashboard_history.py','dashboard-ui.js','dashboard.css','themes.css','deploy/import_dashboard_history.py','index.html','app.js','studio.js','style.css','login.html','login.js','access-ui.js','network-ui.js','network/__init__.py','network/client.py','network/config.py','network/rpc.py','deploy/Dockerfile','deploy/image-requirements.lock']
|
||||||
|
|
||||||
|
|
||||||
FILES += ['xvc.py','xvc_runtime.py','xvc_sources.json','xvc-ui.js','deploy/xvc-requirements.lock','deploy/prepare_xvc.py']
|
FILES += ['xvc.py','xvc_runtime.py','xvc_sources.json','xvc-ui.js','deploy/xvc-requirements.lock','deploy/prepare_xvc.py']
|
||||||
|
|||||||
@@ -204,3 +204,15 @@ Im OpenWebUI-Container ausführen und OpenWebUI danach neu starten. Die Änderun
|
|||||||
ist idempotent und prüft den erwarteten Funktionsaufbau. Nach einem Austausch
|
ist idempotent und prüft den erwarteten Funktionsaufbau. Nach einem Austausch
|
||||||
des OpenWebUI-Images muss sie erneut angewendet werden; kein globaler Fork.
|
des OpenWebUI-Images muss sie erneut angewendet werden; kein globaler Fork.
|
||||||
Zugangsdaten und Konfiguration bleiben unverändert.
|
Zugangsdaten und Konfiguration bleiben unverändert.
|
||||||
|
|
||||||
|
## Wiederherstellung der bisherigen Serena-Stimme (2026-10-06)
|
||||||
|
|
||||||
|
Deck verwendet Qwen3-TTS-12Hz-1.7B-Base, Revision
|
||||||
|
`fd4b254389122332181a7c3db7f27e918eec64e3`, mit den unverändert übernommenen
|
||||||
|
Preset-Embeddings aus dem alten Router. Die Ausgabe läuft über
|
||||||
|
`generate_voice_clone` mit `x_vector_only_mode=True`; PCM nutzt den entsprechenden
|
||||||
|
Clone-Streaming-Pfad. Sprache German und Stimme Serena bleiben in OpenWebUI.
|
||||||
|
Das ist eine Änderung des eigenen Deck-Workers, kein OpenWebUI-Patch.
|
||||||
|
CustomVoice-Gewichte bleiben für Rückkehr oder Vergleich erhalten.
|
||||||
|
Eine bestehende CustomVoice-Laufzeit wird nicht fälschlich als installierte
|
||||||
|
Base-Laufzeit ausgewiesen: Der Ready-Marker muss zur gepinnten Revision passen.
|
||||||
+10
@@ -68,6 +68,16 @@ class TTSTestsValidation(unittest.TestCase):
|
|||||||
self.assertEqual([json.loads(line) for line in stdout.getvalue().splitlines()],[{'ready':True}])
|
self.assertEqual([json.loads(line) for line in stdout.getvalue().splitlines()],[{'ready':True}])
|
||||||
self.assertIn('Graph capture notice',stderr.getvalue());self.assertIn('startup notice',stderr.getvalue());self.assertIn('generation notice',stderr.getvalue())
|
self.assertIn('Graph capture notice',stderr.getvalue());self.assertIn('startup notice',stderr.getvalue());self.assertIn('generation notice',stderr.getvalue())
|
||||||
self.assertTrue(json.loads(Path(d,'result.json').read_text())['ok'])
|
self.assertTrue(json.loads(Path(d,'result.json').read_text())['ok'])
|
||||||
|
def test_base_presets_use_clone_path_and_same_embedding(self):
|
||||||
|
from tts_worker import PresetBaseModel
|
||||||
|
calls=[];preset=object()
|
||||||
|
model=SimpleNamespace(generate_voice_clone=lambda **kw:calls.append(kw),generate_voice_clone_streaming=lambda **kw:calls.append(kw))
|
||||||
|
base=PresetBaseModel(model,{'serena':preset})
|
||||||
|
base.generate_custom_voice(text='Hallo',language='German',speaker='Serena',max_new_tokens=1024)
|
||||||
|
base.generate_custom_voice_streaming(text='Hallo',language='German',speaker='Serena',chunk_size=4)
|
||||||
|
self.assertIs(calls[0]['voice_clone_prompt'][0],preset)
|
||||||
|
self.assertEqual(calls[0]['language'],'German');self.assertNotIn('speaker',calls[0])
|
||||||
|
self.assertEqual(calls[1]['chunk_size'],4)
|
||||||
def test_existing_environment_gets_pinned_accelerator_once(self):
|
def test_existing_environment_gets_pinned_accelerator_once(self):
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
from tts_runtime import FAST_VERSION
|
from tts_runtime import FAST_VERSION
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
window.TTSUI=(()=>{
|
window.TTSUI=(()=>{
|
||||||
const e=v=>String(v??'').replace(/[&<>"']/g,c=>({'&':'&','<':'<','>':'>','"':'"',"'":'''}[c]));
|
const e=v=>String(v??'').replace(/[&<>"']/g,c=>({'&':'&','<':'<','>':'>','"':'"',"'":'''}[c]));
|
||||||
async function api(path='',data){const r=await fetch('/api/v1/'+path,(data===undefined)?{}:{method:'POST',headers:{'Content-Type':'application/json','X-Athena-Deck':'1'},body:JSON.stringify(data)});const x=await r.json();if(!r.ok)throw Error(x.error||'TTS-Anfrage fehlgeschlagen');return x;}
|
async function api(path='',data){const r=await fetch('/api/v1/'+path,(data===undefined)?{}:{method:'POST',headers:{'Content-Type':'application/json','X-Athena-Deck':'1'},body:JSON.stringify(data)});const x=await r.json();if(!r.ok)throw Error(x.error||'TTS-Anfrage fehlgeschlagen');return x;}
|
||||||
function html(setup=false){return `<section id="tts-panel" class="card"><h2>${setup?'Qwen3-TTS einrichten':'Sprache ausprobieren'}</h2><p id="tts-status" role="status"></p><p id="tts-error" role="alert"></p>${setup?'<p>Die Einrichtung installiert eine eigene CUDA-Laufzeit und das offizielle Qwen3-TTS 1.7B CustomVoice mit eingebauten Stimmen. Dafür werden mehrere GB heruntergeladen. MLX-Dateien sind für Apple-Geräte; vorhandene Dateien werden nicht gelöscht.</p><button id="tts-install">TTS-Laufzeit und Modell einrichten</button><button class="secondary" id="tts-install-cancel">Einrichtung abbrechen</button><h3>Vorhandenes TTS-Profil verbinden</h3><p>Ersetzt im ausgewählten Profil die Modellzuordnung durch die eingerichtete CUDA-Variante. Der Profilname bleibt erhalten.</p><select id="tts-profile"></select><button id="tts-assign">CUDA-Modell diesem Profil zuordnen</button><h3>Speicherverhalten</h3><p>Automatisch lädt das einzige am Endpunkt freigegebene TTS-Profil im LLM-Betrieb vor und hält es auf der RTX 3060 bereit. Immer bereit lädt das gewählte Profil im LLM-Betrieb vor, soweit Ressourcen frei sind. Nach jeder Anfrage entladen gibt Speicher sofort frei.</p><label>Verhalten<select id="tts-policy"><option value="auto">Automatisch · TTS vom Endpunkt</option><option value="warm">Immer bereit</option><option value="per_request">Nach jeder Anfrage entladen</option></select></label><label>Profil für „Immer bereit“<select id="tts-warm-profile"></select></label><button id="tts-policy-save">Speicherverhalten speichern</button><p id="tts-policy-state" role="status"></p>':'<form id="tts-form"><label>Profil<select id="tts-profile" required></select></label><div class="form-grid"><label>Stimme<select id="tts-speaker"></select></label><label>Sprache<select id="tts-language"></select></label></div><label>Text<textarea id="tts-text" rows="5" maxlength="1000" required placeholder="Was soll vorgelesen werden?"></textarea></label><button id="tts-generate">Sprache erzeugen</button><button type="button" id="tts-cancel" class="secondary">Abbrechen</button></form><div id="tts-result"></div><p>Ausführung auf der RTX 3060. Andere Deck-Modellaufträge werden koordiniert; fremde Dienste werden nicht gestoppt. Text wird nicht dauerhaft gespeichert. Ergebnisdateien bleiben auf Athena.</p>'}</section>`;}
|
function html(setup=false){return `<section id="tts-panel" class="card"><h2>${setup?'Qwen3-TTS einrichten':'Sprache ausprobieren'}</h2><p id="tts-status" role="status"></p><p id="tts-error" role="alert"></p>${setup?'<p>Die Einrichtung installiert eine eigene CUDA-Laufzeit und das offizielle Qwen3-TTS 1.7B Base mit den Preset-Stimmen des bisherigen Routers. Dafür werden mehrere GB heruntergeladen. MLX-Dateien sind für Apple-Geräte; vorhandene Dateien werden nicht gelöscht.</p><button id="tts-install">TTS-Laufzeit und Modell einrichten</button><button class="secondary" id="tts-install-cancel">Einrichtung abbrechen</button><h3>Vorhandenes TTS-Profil verbinden</h3><p>Ersetzt im ausgewählten Profil die Modellzuordnung durch die eingerichtete CUDA-Variante. Der Profilname bleibt erhalten.</p><select id="tts-profile"></select><button id="tts-assign">CUDA-Modell diesem Profil zuordnen</button><h3>Speicherverhalten</h3><p>Automatisch lädt das einzige am Endpunkt freigegebene TTS-Profil im LLM-Betrieb vor und hält es auf der RTX 3060 bereit. Immer bereit lädt das gewählte Profil im LLM-Betrieb vor, soweit Ressourcen frei sind. Nach jeder Anfrage entladen gibt Speicher sofort frei.</p><label>Verhalten<select id="tts-policy"><option value="auto">Automatisch · TTS vom Endpunkt</option><option value="warm">Immer bereit</option><option value="per_request">Nach jeder Anfrage entladen</option></select></label><label>Profil für „Immer bereit“<select id="tts-warm-profile"></select></label><button id="tts-policy-save">Speicherverhalten speichern</button><p id="tts-policy-state" role="status"></p>':'<form id="tts-form"><label>Profil<select id="tts-profile" required></select></label><div class="form-grid"><label>Stimme<select id="tts-speaker"></select></label><label>Sprache<select id="tts-language"></select></label></div><label>Text<textarea id="tts-text" rows="5" maxlength="1000" required placeholder="Was soll vorgelesen werden?"></textarea></label><button id="tts-generate">Sprache erzeugen</button><button type="button" id="tts-cancel" class="secondary">Abbrechen</button></form><div id="tts-result"></div><p>Ausführung auf der RTX 3060. Andere Deck-Modellaufträge werden koordiniert; fremde Dienste werden nicht gestoppt. Text wird nicht dauerhaft gespeichert. Ergebnisdateien bleiben auf Athena.</p>'}</section>`;}
|
||||||
function bind(setup=false){const root=document.querySelector('#tts-panel');if(!root)return;const el=id=>root.querySelector('#'+id);let state,profiles=[],busy=false,lastResult='';const error=x=>{if(root.isConnected)el('tts-error').textContent=x;};
|
function bind(setup=false){const root=document.querySelector('#tts-panel');if(!root)return;const el=id=>root.querySelector('#'+id);let state,profiles=[],busy=false,lastResult='';const error=x=>{if(root.isConnected)el('tts-error').textContent=x;};
|
||||||
async function refresh(){try{state=await api('tts');if(!root.isConnected)return;const rt=state.runtime,j=state.job;el('tts-status').textContent=setup?(rt.job?.phase||(rt.installed?'TTS ist eingerichtet.':'Noch nicht eingerichtet.')):(j?.phase||'Profil wählen und Text eingeben.')+` · RTX 3060 ${state.loaded?'geladen':'nicht geladen'}`;
|
async function refresh(){try{state=await api('tts');if(!root.isConnected)return;const rt=state.runtime,j=state.job;el('tts-status').textContent=setup?(rt.job?.phase||(rt.installed?'TTS ist eingerichtet.':'Noch nicht eingerichtet.')):(j?.phase||'Profil wählen und Text eingeben.')+` · RTX 3060 ${state.loaded?'geladen':'nicht geladen'}`;
|
||||||
if(setup){el('tts-install').disabled=busy||rt.installed||rt.job?.state==='running';el('tts-install-cancel').disabled=rt.job?.state!=='running';el('tts-assign').disabled=busy||!rt.installed||!profiles.length;}
|
if(setup){el('tts-install').disabled=busy||rt.installed||rt.job?.state==='running';el('tts-install-cancel').disabled=rt.job?.state!=='running';el('tts-assign').disabled=busy||!rt.installed||!profiles.length;}
|
||||||
|
|||||||
+6
-5
@@ -1,10 +1,10 @@
|
|||||||
"""Own CUDA environment and pinned official CustomVoice model, installable via GUI."""
|
"""Own CUDA environment and pinned Base model with the old router's preset voices."""
|
||||||
import json,sys,time,os,uuid,shutil,threading,hashlib,subprocess
|
import json,sys,time,os,uuid,shutil,threading,hashlib,subprocess
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from image_runtime import ImageRuntime
|
from image_runtime import ImageRuntime
|
||||||
FAST_VERSION='0.3.0'
|
FAST_VERSION='0.3.0'
|
||||||
REPO='Qwen/Qwen3-TTS-12Hz-1.7B-CustomVoice'
|
REPO='Qwen/Qwen3-TTS-12Hz-1.7B-Base'
|
||||||
REVISION='0c0e3051f131929182e2c023b9537f8b1c68adfe'
|
REVISION='fd4b254389122332181a7c3db7f27e918eec64e3'
|
||||||
SPEAKERS=['Vivian','Serena','Uncle_Fu','Dylan','Eric','Ryan','Aiden','Ono_Anna','Sohee']
|
SPEAKERS=['Vivian','Serena','Uncle_Fu','Dylan','Eric','Ryan','Aiden','Ono_Anna','Sohee']
|
||||||
LANGUAGES=['Auto','German','English','Chinese','Japanese','Korean','French','Russian','Portuguese','Spanish','Italian']
|
LANGUAGES=['Auto','German','English','Chinese','Japanese','Korean','French','Russian','Portuguese','Spanish','Italian']
|
||||||
class TTSRuntime(ImageRuntime):
|
class TTSRuntime(ImageRuntime):
|
||||||
@@ -32,7 +32,8 @@ class TTSRuntime(ImageRuntime):
|
|||||||
def status(self):
|
def status(self):
|
||||||
with self.lock:
|
with self.lock:
|
||||||
python,model=self.paths()
|
python,model=self.paths()
|
||||||
return dict(installed=python.is_file() and (model/'ready').exists(),job=dict(self.job) if self.job else None,backend='faster-qwen3-tts',backend_version=FAST_VERSION,backend_ready=(model.parent/'fast-backend.version').is_file() and (model.parent/'fast-backend.version').read_text()==FAST_VERSION,repo=REPO,revision=REVISION,speakers=SPEAKERS,languages=LANGUAGES)
|
installed=python.is_file() and (model/'ready').is_file() and (model/'ready').read_text().strip()==REVISION
|
||||||
|
return dict(installed=installed,job=dict(self.job) if self.job else None,backend='faster-qwen3-tts',backend_version=FAST_VERSION,backend_ready=(model.parent/'fast-backend.version').is_file() and (model.parent/'fast-backend.version').read_text()==FAST_VERSION,repo=REPO,revision=REVISION,speakers=SPEAKERS,languages=LANGUAGES)
|
||||||
def ensure_library(self):
|
def ensure_library(self):
|
||||||
if not self.status()['installed']:raise ValueError('Zuerst TTS einrichten.')
|
if not self.status()['installed']:raise ValueError('Zuerst TTS einrichten.')
|
||||||
_,model=self.paths();ident=hashlib.sha256((REPO+REVISION+'model.safetensors').encode()).hexdigest();target=self.root.parent/'models'/ident;target.mkdir(parents=True,exist_ok=True,mode=0o700)
|
_,model=self.paths();ident=hashlib.sha256((REPO+REVISION+'model.safetensors').encode()).hexdigest();target=self.root.parent/'models'/ident;target.mkdir(parents=True,exist_ok=True,mode=0o700)
|
||||||
@@ -72,7 +73,7 @@ class TTSRuntime(ImageRuntime):
|
|||||||
(base/'fast-backend.version').write_text(FAST_VERSION)
|
(base/'fast-backend.version').write_text(FAST_VERSION)
|
||||||
marker=self.root/'active.tmp';marker.write_text(json.dumps(dict(id=base.name)));marker.replace(self.root/'active.json')
|
marker=self.root/'active.tmp';marker.write_text(json.dumps(dict(id=base.name)));marker.replace(self.root/'active.json')
|
||||||
self.ensure_library()
|
self.ensure_library()
|
||||||
state='complete';phase='TTS bereit · CUDA-Modell mit eingebauten Stimmen installiert'
|
state='complete';phase='TTS bereit · Base-Modell mit Preset-Stimmen installiert'
|
||||||
except InterruptedError:state='cancelled';phase='TTS-Einrichtung abgebrochen'
|
except InterruptedError:state='cancelled';phase='TTS-Einrichtung abgebrochen'
|
||||||
except Exception as exc:phase=str(exc) if isinstance(exc,RuntimeError) else 'TTS-Einrichtung fehlgeschlagen. Speicher und Internetverbindung prüfen.'
|
except Exception as exc:phase=str(exc) if isinstance(exc,RuntimeError) else 'TTS-Einrichtung fehlgeschlagen. Speicher und Internetverbindung prüfen.'
|
||||||
finally:
|
finally:
|
||||||
|
|||||||
+1
-1
@@ -16,7 +16,7 @@ class TTSTests:
|
|||||||
path=self.root/ident/'job.json'
|
path=self.root/ident/'job.json'
|
||||||
return json.loads(path.read_text()) if path.is_file() else None
|
return json.loads(path.read_text()) if path.is_file() else None
|
||||||
def blockers(self,p):
|
def blockers(self,p):
|
||||||
if p['model']['repo']!=REPO or p['model']['file']!='model.safetensors' or p['model'].get('revision')!=REVISION:return ['Für diese TTS-Variante fehlt die Anbindung in Deck. Unter TTS → Einrichten kannst du ausdrücklich auf die unterstützte Variante mit eingebauten Stimmen wechseln. Die ursprüngliche Datei bleibt erhalten.']
|
if p['model']['repo']!=REPO or p['model']['file']!='model.safetensors' or p['model'].get('revision')!=REVISION:return ['Für diese TTS-Variante fehlt die Anbindung in Deck. Unter TTS → Einrichten kannst du ausdrücklich auf die unterstützte Base-Variante mit Preset-Stimmen wechseln. Die ursprüngliche Datei bleibt erhalten.']
|
||||||
return [] if self.runtime.status()['installed'] else ['TTS-Laufzeit unter TTS → Einrichten installieren.']
|
return [] if self.runtime.status()['installed'] else ['TTS-Laufzeit unter TTS → Einrichten installieren.']
|
||||||
def assign(self,ident,revision):
|
def assign(self,ident,revision):
|
||||||
if not self.runtime.status()['installed']:raise ValueError('Zuerst TTS einrichten.')
|
if not self.runtime.status()['installed']:raise ValueError('Zuerst TTS einrichten.')
|
||||||
|
|||||||
@@ -2,6 +2,22 @@
|
|||||||
import contextlib,json,re,sys
|
import contextlib,json,re,sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
class PresetBaseModel:
|
||||||
|
"""Keep the old router's preset embeddings and Base voice-clone path."""
|
||||||
|
def __init__(self,model,presets):self.model=model;self.presets=presets
|
||||||
|
def _kwargs(self,text,language,speaker,**kwargs):
|
||||||
|
return dict(text=text,language=language,voice_clone_prompt=[self.presets[speaker.lower()]],**kwargs)
|
||||||
|
def generate_custom_voice(self,**kwargs):return self.model.generate_voice_clone(**self._kwargs(**kwargs))
|
||||||
|
def generate_custom_voice_streaming(self,**kwargs):return self.model.generate_voice_clone_streaming(**self._kwargs(**kwargs))
|
||||||
|
def _warmup(self,**kwargs):return self.model._warmup(**kwargs)
|
||||||
|
|
||||||
|
def base_presets():
|
||||||
|
import torch
|
||||||
|
from safetensors.torch import load_file
|
||||||
|
from qwen_tts import VoiceClonePromptItem
|
||||||
|
rows=load_file(str(Path(__file__).parent/'assets/tts-presets/bundle.safetensors'))
|
||||||
|
return {name:VoiceClonePromptItem(ref_code=None,ref_spk_embedding=row.to(device='cuda:0',dtype=torch.bfloat16).contiguous(),x_vector_only_mode=True,icl_mode=False,ref_text=None) for name,row in rows.items()}
|
||||||
|
|
||||||
def text_chunks(text,limit=256):
|
def text_chunks(text,limit=256):
|
||||||
chunks=[];current=''
|
chunks=[];current=''
|
||||||
for sentence in re.split(r'(?<=[.!?])\s+',text.strip()):
|
for sentence in re.split(r'(?<=[.!?])\s+',text.strip()):
|
||||||
@@ -38,6 +54,8 @@ def main():
|
|||||||
from faster_qwen3_tts import FasterQwen3TTS
|
from faster_qwen3_tts import FasterQwen3TTS
|
||||||
torch.set_float32_matmul_precision('high')
|
torch.set_float32_matmul_precision('high')
|
||||||
model=FasterQwen3TTS.from_pretrained(model_path,device='cuda:0',dtype=torch.bfloat16,attn_implementation='sdpa',backend='torch',local_files_only=True)
|
model=FasterQwen3TTS.from_pretrained(model_path,device='cuda:0',dtype=torch.bfloat16,attn_implementation='sdpa',backend='torch',local_files_only=True)
|
||||||
|
config=Path(model_path)/'config.json'
|
||||||
|
if config.is_file() and json.loads(config.read_text()).get('tts_model_type')=='base':model=PresetBaseModel(model,base_presets())
|
||||||
# Pinned 0.3.0 uses this entry point; capture before advertising readiness.
|
# Pinned 0.3.0 uses this entry point; capture before advertising readiness.
|
||||||
model._warmup(prefill_len=100)
|
model._warmup(prefill_len=100)
|
||||||
# Initialize the codec too, so its first-use cost stays out of live replies.
|
# Initialize the codec too, so its first-use cost stays out of live replies.
|
||||||
|
|||||||
Reference in new issue
Block a user