From b99abaea25a8f398016a2e56e302401aef8700e0 Mon Sep 17 00:00:00 2001 From: Mikei386 <44135113+Mikei386@users.noreply.github.com> Date: Mon, 5 Oct 2026 22:09:13 +0200 Subject: [PATCH] Complete X-VC, YuE2 audio remix and ClearVoice integration --- FEATURE_COMPARISON.md | 114 +++++---- acestep.py | 5 +- app.js | 1 + applio.py | 4 +- backup.py | 40 ++- catalog.py | 4 +- clearvoice_worker.py | 36 +++ cuda_overlay.py | 14 ++ deploy/Dockerfile | 4 +- deploy/docker_backup.py | 23 +- deploy/install.py | 39 ++- deploy/ladypoly/Dockerfile | 4 +- deploy/ladypoly/bridge.py | 42 +++- deploy/ladypoly/patch_remix.py | 156 ++++++++++++ deploy/ladypoly/test_bridge.py | 16 +- deploy/prepare_xvc.py | 47 ++++ deploy/separator-web/app.py | 6 +- deploy/separator-web/index.html | 1 + deploy/setup_docker_helper.py | 3 +- deploy/xvc-requirements.lock | 152 ++++++++++++ deploy/xvc-web/Dockerfile | 6 + deploy/xvc-web/inference_log.py | 29 +++ deploy/xvc-web/native_ui.py | 264 ++++++++++++++++++++ deploy/xvc-web/patch_resemble_enhance.py | 40 +++ deploy/xvc-web/proxy.py | 24 ++ docker-ui.js | 1 + docs/AUDIO_REMIX_CLEARVOICE.md | 55 +++++ docs/XVC.md | 61 +++++ endpoint.py | 8 +- execution_setup.py | 9 + index.html | 2 +- music-ui.js | 10 +- music.py | 15 +- profiles.py | 4 + remix.py | 50 ++++ remix_runtime.py | 50 ++++ remix_sources.json | 301 +++++++++++++++++++++++ remix_worker.py | 20 ++ separator.py | 6 +- separator_runtime.py | 23 +- separator_sources.json | 21 ++ server.py | 44 +++- studio.js | 1 + test_acestep.py | 4 + test_audio_migration.py | 49 ++++ test_backup.py | 16 ++ test_xvc.py | 43 ++++ voice-ui.js | 2 +- xvc-ui.js | 10 + xvc.py | 45 ++++ xvc_runtime.py | 69 ++++++ xvc_sources.json | 102 ++++++++ 52 files changed, 1973 insertions(+), 122 deletions(-) create mode 100644 clearvoice_worker.py create mode 100644 cuda_overlay.py create mode 100644 deploy/ladypoly/patch_remix.py create mode 100644 deploy/prepare_xvc.py create mode 100644 deploy/xvc-requirements.lock create mode 100644 deploy/xvc-web/Dockerfile create mode 100644 deploy/xvc-web/inference_log.py create mode 100644 deploy/xvc-web/native_ui.py create mode 100644 deploy/xvc-web/patch_resemble_enhance.py create mode 100644 deploy/xvc-web/proxy.py create mode 100644 docs/AUDIO_REMIX_CLEARVOICE.md create mode 100644 docs/XVC.md create mode 100644 remix.py create mode 100644 remix_runtime.py create mode 100644 remix_sources.json create mode 100644 remix_worker.py create mode 100644 test_audio_migration.py create mode 100644 test_xvc.py create mode 100644 xvc-ui.js create mode 100644 xvc.py create mode 100644 xvc_runtime.py create mode 100644 xvc_sources.json diff --git a/FEATURE_COMPARISON.md b/FEATURE_COMPARISON.md index 21a8e00..628cca8 100644 --- a/FEATURE_COMPARISON.md +++ b/FEATURE_COMPARISON.md @@ -1,58 +1,74 @@ # Alter Athena Router und Athena Deck -Stand 01.10.2026. Vergleich der aktuellen Quellen und dokumentierten Prüfungen; -keine neue vollständige Live-Abnahme sämtlicher Funktionen. Installierte alte -Container bedeuten keine Anbindung an Deck. Kategorien und Docker-Listen allein -sind kein ausführbarer Worker. +Stand: 05.10.2026. Lesender Abgleich der alten Quellen, der laufenden Deck- +Installation, gespeicherter Profile und vorhandener/stillgelegter Container. +Der ursprüngliche Bestands-/Quellvergleich wurde um die Migration von X-VC, +YuE2 Audio Remix und ClearVoice sowie deren interne GPU-Abnahme ergänzt. +Es ist keine vollständige funktionale Abnahme aller übrigen Alt-Funktionen. +Der Athena MCP Operator ist auf Nutzerwunsch aus dem Migrationsumfang entfernt. -| Funktion | Athena Deck | Offener Umfang | +## Noch nicht übernommen + +| Funktion des alten Systems | Stand in Athena Deck | Nachweis / Umfang | |---|---|---| -| Chat, Profilwechsel, Streaming, Tools, Vision | vorhanden | weitere Client-/Modellkombinationen prüfen | -| Kontext, Slots, GPU-Split, Batch, KV-Quantisierung, MTP | vorhanden | Modellabhängigkeit beachten | -| Bildgenerierung und bis vier Referenzbilder | vorhanden | Referenzbildpfad nicht universell für alle Familien | -| Qwen PE-T2I/PE-I2I Prompt Enhancer | vorhanden | modellabhängige Auswahl und Speicherbedarf | -| TTS, STT und warme/dynamische Audio-Policy | vorhanden | nicht jede Sprachmodellfamilie ausführbar | -| LTX Original + DeskWEB, exklusiver Videomodus | vorhanden, Basisgeneration geprüft | Extend/Retake, Audio, LoRAs und alle Desktop-Erweiterungen nicht vollständig geprüft | -| Dashboard, History, Themes | vorhanden | kein neuer vollständiger Migrationsaudit | -| Modellkatalog, Komponenten, Downloads, automatische Speicheranpassung | vorhanden | Kompatibilitätsrezepte nicht universell | -| ACE-Step Musikstudio | fehlt als Deck-Worker | Laufzeit, Profile/API, GPU-Modus und Oberfläche | -| YuE2 Musikgenerierung | vorhanden: audio.cpp, Musikmodus, Ladypoly | weitere Modelle/Funktionen separat anbinden | -| BS-RoFormer, MelBand und Demucs Trennung | vorhanden: native Laufzeit, Profile, Web-GUI | weitere Familien separat prüfen | -| OmniVoice Voice Studio | fehlt | eigene Worker-/UI-Anbindung | -| X-VC Voice Changer | fehlt | eigene Worker-/UI-Anbindung | -| Applio/RVC Konvertierung und Training | fehlt | eigene Worker-/UI-Anbindung | -| TRELLIS.2 3D | fehlt | eigene Laufzeit, GPU-Modus und Oberfläche | -| EmbeddingGemma / Embeddings | fehlt im Deck-Endpunkt | Embedding-Worker und Route | -| Realtime Voice / WebRTC / OpenClaw Talk | fehlt in Deck | Brücke, Echtzeitaudio und Clientintegration | -| Responses API | fehlt in Deck | /v1/responses-Kompatibilität | -| PCM-Streaming für TTS | fehlt in Deck | Streaming-Audiopfad | -| Spezialmodi | LLM, Video, Musik, Audio-Trennung vorhanden | Voice/3D fehlen | -| Markierte zusätzliche Docker-Anwendungen | vorhanden | allein noch keine GPU-Worker-Orchestrierung | -| WireGuard-Einstellungen | nativer Host-/systemd-Dienst installiert, GUI/API/Web-Tools angebunden | echte Peer-Konfiguration und alter Gateway noch nicht migriert; Dual-Stack mit synthetischem Peer geprüft | -| Backup/Restore | implementiert | kompletter Neuaufbau auf leerem Debian nicht durchgetestet; Anwendungsdaten zusätzlicher Studios brauchen Rezepte | -| Nativer Debian-/systemd-Installer | unvollständig | frischer Host, Voraussetzungen und vollständige Abnahme | +| TRELLIS.2 / 3D Studio | fehlt | Alter `mike-ai-trellis-studio` samt Modell-/Ausgabemounts vorhanden, gestoppt. Keine entsprechende Deck-Kategorie, Laufzeit oder Profilanbindung gefunden. | +| Realtime Voice / Sprachdialog-Brücke | fehlt | Alter `athena-realtime-voice`-Dienst und Container vorhanden; kein entsprechender Deck-Dialogdienst. Nicht mit Applios vorhandener Live-Stimmkonvertierung verwechseln. | +| PCM-Sprachstream und weitere TTS-Ausgabeformate | fehlt | Alter Router: `/v1/audio/speech/pcm-stream`, MP3/WAV/PCM. Installiertes Deck: `/v1/audio/speech` akzeptiert WAV; kein gleichwertiger PCM-Streamingpfad. | +| Globale serverseitige Systemrichtlinie | kein Gegenstück gefunden | Alter Router hat `_load_global_system_policy` und `_inject_global_system_policy`. Im Deck-Quellbestand keine entsprechende globale Einspeisung gefunden. Client-Systemprompts ersetzen diese serverweite Funktion nicht. | +| Chatbefehle für Betriebsarten | kein Gegenstück gefunden | Alter Router wertet z. B. `/athena 3d` und weitere Modusbefehle aus. Deck besitzt die Betriebsartensteuerung in GUI/API, aber keine gleichwertige Chatbefehlsauswertung gefunden. | +| Alte Audio-Katalogrouten | andere Schnittstelle | Alt: `/v1/audio/models`, `/v1/audio/voices`. Deck: getrennte `/v1/audio/speech/models` und `/v1/audio/transcriptions/models`; keine alten Aliasrouten gefunden. Relevant für Altclients. | -Empfohlene Reihenfolge: Embeddings und API-Lücken; gemeinsame Steuerung weiterer -GPU-Spezialworker; Musik/Voice/3D je nach Bedarf; native Installation und vollständiger -Restore-Test. LTX-spezifische optionalen Funktionen separat gegen DeskWEB prüfen. +## Bereits übernommen – nicht erneut als fehlend führen -## Stilllegung und native Netzwerk-Anbindung am 01.10.2026 +- Chatprofile Fast, Medium, Large, Ultra und Unzensiert sind vorhanden; zusätzlich + Gemma, Lukes Devlab und Holo4. Gespeicherte Einstellungen müssen nicht identisch + mit den historischen Profilen sein; Änderungen waren teilweise ausdrücklich gewünscht. +- Kontext, Slots, GPU-Split, Batch/Microbatch, KV-Cache, MTP, Sampling/Penalties, + Min-p, Presets und getrennte Vision-Projektor-Zuordnung sind implementiert. +- Qwen-/FLUX-Bilder und Referenzbildbearbeitung, Prompt-Enhancer. +- Qwen-TTS, Qwen-ASR/STT und EmbeddingGemma samt Embeddings-Endpunkt. +- YuE2 / LadyPoly sowie ACE-Step 1.5 XL-SFT / eigene Studio-Oberfläche. +- Musik-Audiotrennung mit Profilen und Separator Web; zusätzlich ClearVoice / + MossFormer2_SE_48K für Sprache/Hintergrund mit eigenem Profil und GPU-Auswahl. +- YuE2 Audio-Remix: SheetSage2/MERT-Analyse, bearbeitbarer ABC-Plan und + Weitergabe an audio.cpp; in Deck und LadyPoly bedienbar. +- X-VC Studio: eigene Laufzeit/Gewichte, inaktives Profil, Weboberfläche und + Deck-GPU-Steuerung. Native Konvertierung und Resemble-Restaurierung geprüft. +- VoxCPM2, OmniVoice und Applio/RVC einschließlich der übernommenen eigenen GUI. + Die Voice-Webcontainer einschließlich X-VC und Applio sind vorhanden und laufen. +- Applio-Trainingsdaten/Checkpoints und Stimmen wurden kopiert; historische + UI-Auftragsdaten/Uploads/Ergebnisse sind nicht vollständig automatisch importiert. +- Optionale Responses-Kompatibilität ist implementiert. Sie bleibt eine definierte + Teilmenge, keine vollständige OpenAI-API (siehe RESPONSES_COMPATIBILITY.md). +- LTX DeskWEB, Dashboard, History, Downloads und zusätzliche Docker-Dienste. +- Native WireGuard-Verwaltung und Migration; alter Gateway-Container ist gestoppt. -Alle 33 alten `mike-ai-*`-Container außer `mike-ai-wireguard-gateway` sind -stillgelegt und auf `restart=no` gesetzt. Images, Definitionen und Daten bleiben -für den Vergleich erhalten. Vorherige Zustände und Neustartregeln sind geschützt -unter `/opt/athena-deck-dev/runtime/legacy-services-before-native-wireguard.json` -gesichert. Alte laufende Dienste sind damit keine aktive Rückfallversorgung mehr. +## Nicht als bestätigte Funktionslücke einstufen -`athena-deck-network.service` läuft nativ auf dem Debian-Host. Es verwaltet die -Schnittstelle `wgdeck0`; aktuell ist noch keine echte Peer-Konfiguration importiert -und der neue Tunnel ist deaktiviert. Im lokalen Modus werden die Deck-GUI 8108, -API-Ports 8120–8124 und die explizit registrierten Web-Tools 8118/8127/8128 über -Athenas KIT-LAN-Adresse bereitgestellt. SSH-Verwaltung bleibt unabhängig. +- LTX Extend/Retake, Audio, LoRAs und alle optionalen Desktopfunktionen: keine + vollständige aktuelle Einzelabnahme. Vor Migration weiterer Teile separat prüfen. +- LadyPoly Writer, Cover, LoRA und weitere Samplingfunktionen sind in der neuen + Brücke nicht angebunden. Welche davon im alten System vollständig funktionsfähig + waren, wurde bei diesem Abgleich nicht erneut getestet. +- Konfigurationsbackup ist nicht dasselbe wie Medien-/Trainingsdatenarchiv. + Applio-Nutzdaten brauchen weiterhin ihr gesondertes Archiv. Vollständiger Restore + auf einem leeren Debian-Host und nativer Neuaufbau sind nicht komplett abgenommen; + dies sind Prüflücken, kein Beleg einer fehlenden alten Modellfunktion. -Nachweis: 86 lokale Netzwerk-/API-/Profiltests, 32 isolierte Backup-/Modelltests -(mit Überschneidungen) und realer Dual-Stack-WireGuard-Handshake in zwei Wegwerf- -Netzwerk-Namensräumen. Kein produktiver Peer wurde zum Test verwendet. -GUI über SSH und KIT-LAN: HTTP 200; API ohne Token: HTTP 401; drei Web-Tools: HTTP 200. -Die vollständige Migration des alten Gateways steht noch aus; dieser bleibt aktiv. -Ein kompletter Restore auf leerem Debian ist weiterhin nicht abgenommen. +## Quellen dieses Abgleichs + +Alter Router: `/opt/mike-ai/stack/router/ai_profile_router.py`, +`router_profiles.json`, `config/profile-matrix.json`, +`/opt/mike-ai/stem-separator/app.py`, `speech_enhance.py`, +`/opt/mike-ai/yue2-3b/README.md` und Docker-Metadaten. +Neues System: produktive `/opt/athena-deck-dev/runtime/state/profiles.json`, +installierter `/app/endpoint.py` und `/app/profiles.py`, Containerbestand sowie +Repository-Dateien `docs/XVC.md`, `docs/APPLIO.md`, `RESPONSES_COMPATIBILITY.md` +und die Adapterquellen/-Dokumentationen. + +Interne GPU-Abnahme: X-VC liefert 16-kHz- und 44,1-kHz-WAV; ClearVoice +trennt auf RTX 3060; SheetSage2 erzeugt aus einer künstlichen Melodie einen +ABC-Plan, den YuE2 auf RTX 5080 zu 4 Sekunden Audio rendert. YuE2 bleibt +danach geladen. Diese technische Prüfung ersetzt keinen musikalischen Hörtest. + +Die frühere Liste vom 01.10.2026 ist durch diesen Stand ersetzt. diff --git a/acestep.py b/acestep.py index 15c99d4..8bf4f33 100644 --- a/acestep.py +++ b/acestep.py @@ -101,8 +101,9 @@ class MusicRouter: def start(self,profile_id,lyrics='',style='',**options): with self.lock: target=self._select(profile_id) - if options.get('steps') is None:options.pop('steps') - if target is self.yue and set(options)-{'seed','max_tokens','steps','wait'}:raise ValueError('ACE-Step-Parameter sind für dieses YuE2-Profil nicht unterstützt.') + if options.get('steps') is None:options.pop('steps',None) + if target is self.ace and set(options)&{'abc','cot'}:raise ValueError('ABC-Musikplan wird nur vom YuE2-Adapter unterstützt.') + if target is self.yue and set(options)-{'seed','max_tokens','steps','wait','abc','cot'}:raise ValueError('ACE-Step-Parameter sind für dieses YuE2-Profil nicht unterstützt.') return target.start(profile_id,lyrics,style,**options) def load(self,profile_id,wait=False): with self.lock:return self._select(profile_id).load(profile_id,wait) diff --git a/app.js b/app.js index 5c6b709..6e1a3cf 100644 --- a/app.js +++ b/app.js @@ -25,6 +25,7 @@ function appearancePage(){ } async function refresh(){if(refreshing)return;refreshing=true;const page=location.hash.slice(1)||'dashboard';document.querySelectorAll('nav a').forEach(a=>a.classList.toggle('active',a.hash==='#'+page));try{error.textContent='';let html; if(['separator-runtime','separator-test','separation'].includes(page)){SeparatorUI.render(page!=='separator-runtime');return;} +if(page==='xvc-runtime'){XVCUI.render();return;} if(page==='applio-runtime'){ApplioUI.render();return;} if(page==='acestep-runtime'){AceStepUI.render();return;} if(page==='audio-cpp-runtime'){AudioCppUI.render();return;} diff --git a/applio.py b/applio.py index eb1ad92..90f5698 100644 --- a/applio.py +++ b/applio.py @@ -37,8 +37,8 @@ class Applio: c.settimeout(10);request=json.loads(c.makefile('rb').readline(8193)) if request!={'action':'reserve'}:raise ValueError('Ungültige Ressourcenanfrage.') with self.lock: - if self.active:raise ValueError('Applio arbeitet bereits.') - if self.scheduler.gpu_mode!='voice' or not self.selected():raise ValueError('Applio-Profil in Deck aktivieren und Steuerung → Stimmwerkzeuge starten.') + if self.active:raise ValueError(getattr(self,'label','Applio')+' arbeitet bereits.') + if self.scheduler.gpu_mode!='voice' or not self.selected():raise ValueError(getattr(self,'label','Applio')+'-Profil in Deck aktivieren und Steuerung → Stimmwerkzeuge starten.') self.active=True;owned=True release=self.scheduler.image_reservation(False,kind='voice') from image_test import probe diff --git a/backup.py b/backup.py index 040ffe9..0afb670 100644 --- a/backup.py +++ b/backup.py @@ -7,7 +7,7 @@ from auth import atomic_write,validate_record from backup_codec import seal,open_backup from catalog import repo_id,file_role,KINDS from profiles import SCHEMAS,CHAT_GPU_DEFAULTS,chat_parameters,FLOAT_PARAMETERS -SETTINGS=('applio-data/settings.json','separator-profiles.json','profiles.json','endpoint.json','audio-policy.json','video/comfy-selection.json','models/huggingface.json','video/comfy-client-token','video/original-work/settings.json') +SETTINGS=('xvc-data/settings.json','applio-data/settings.json','separator-profiles.json','profiles.json','endpoint.json','audio-policy.json','video/comfy-selection.json','models/huggingface.json','video/comfy-client-token','video/original-work/settings.json') MAX_HISTORY=40*1024**2 VERSION=1 # Exact byte hash verified against official Hub metadata, not a filename heuristic. @@ -36,7 +36,7 @@ def validate(doc): repo_id(source['repo']) if not re.fullmatch('[a-f0-9]{40}',source['revision']) or source['file'].startswith('/') or '..' in PurePosixPath(source['file']).parts or '\\' in source['file'] or any(ord(c)<32 for c in source['file']):raise ValueError('Ungültige Ersatzquelle.') metadata=m.get('runtime_metadata') - if metadata is not None and metadata!={'architecture':'rvc'}:raise ValueError('Ungültige Applio-Modellmetadaten.') + if metadata is not None and metadata not in ({'architecture':'rvc'},{'architecture':'xvc'}):raise ValueError('Ungültige Stimm-Modellmetadaten.') ids.add(m['id']) pids=set();names=set();api_names=set() for p in profiles: @@ -94,6 +94,9 @@ def validate(doc): if not isinstance(hf,dict) or set(hf)!={'token'} or hf['token'] is not None and (not isinstance(hf['token'],str) or not re.fullmatch(r'hf_[A-Za-z0-9]{10,252}',hf['token'])):raise ValueError('Ungültiger Hugging-Face-Zugang.') if 'video/comfy-client-token' in settings and not re.fullmatch(r'[A-Za-z0-9_-]{32,256}',settings['video/comfy-client-token'].strip()):raise ValueError('Ungültiger Diensttoken.') if 'video/original-work/settings.json' in settings and (not isinstance(settings['video/original-work/settings.json'],dict) or len(json.dumps(settings['video/original-work/settings.json']))>65536):raise ValueError('Ungültige LTX-Einstellungen.') + if 'xvc-data/settings.json' in settings: + v=settings['xvc-data/settings.json'] + if not isinstance(v,dict) or set(v)!={'device'} or v['device'] not in ('3060','5080'):raise ValueError('Ungültige X-VC-GPU.') if 'applio-data/settings.json' in settings: v=settings['applio-data/settings.json'] if not isinstance(v,dict) or set(v)!={'device'} or v['device'] not in ('3060','5080'):raise ValueError('Ungültige Applio-GPU.') @@ -102,7 +105,7 @@ def validate(doc): validate_profiles(settings['separator-profiles.json']) validate_record(doc.get('credentials')) runtimes=doc.get('runtimes') - if not isinstance(runtimes,dict) or set(runtimes)-{'llama','llama_builds','image','tts','enhancers','swarm_nodes','ltx_original','audio_cpp','separator','voxcpm','omnivoice','acestep','applio'} or not {'llama','llama_builds','image','tts','enhancers','swarm_nodes'}<=set(runtimes):raise ValueError('Ungültiges Laufzeitrezept.') + if not isinstance(runtimes,dict) or set(runtimes)-{'llama','llama_builds','image','tts','enhancers','swarm_nodes','ltx_original','audio_cpp','separator','voxcpm','omnivoice','acestep','applio','xvc','music_remix'} or not {'llama','llama_builds','image','tts','enhancers','swarm_nodes'}<=set(runtimes):raise ValueError('Ungültiges Laufzeitrezept.') if 'separator' in runtimes: from separator_runtime import MODELS value=runtimes['separator'] @@ -110,6 +113,8 @@ def validate(doc): if 'sources' in value: from separator_runtime import SOURCES if value['sources']!={name:SOURCES[name] for name in value['models']}:raise ValueError('Audio-Separator-Quellen stimmen nicht mit dem geprüften Rezept überein.') + if 'music_remix' in runtimes and type(runtimes['music_remix']) is not bool:raise ValueError('Ungültige Audio-Remix-Laufzeit.') + if 'xvc' in runtimes and type(runtimes['xvc']) is not bool:raise ValueError('Ungültige X-VC-Laufzeit.') if 'applio' in runtimes and type(runtimes['applio']) is not bool:raise ValueError('Ungültige Applio-Laufzeit.') if 'acestep' in runtimes and type(runtimes['acestep']) is not bool:raise ValueError('Ungültige ACE-Step-Laufzeit.') if 'omnivoice' in runtimes and type(runtimes['omnivoice']) is not bool:raise ValueError('Ungültige OmniVoice-Laufzeit.') @@ -165,7 +170,7 @@ class Backup: models=[] for m in s.catalog.status()['entries']: item={k:m[k] for k in ('id','repo','revision','file','size','sha256','kind')} - if (m.get('runtime_metadata') or {}).get('architecture')=='rvc':item['runtime_metadata']={'architecture':'rvc'} + if (architecture:=(m.get('runtime_metadata') or {}).get('architecture')) in ('rvc','xvc'):item['runtime_metadata']={'architecture':architecture} if m['repo'].startswith('local/'): item['source']='local';item['download_source']=m.get('download_source') or LOCAL_SOURCES.get(m['sha256']) models.append(item) @@ -181,9 +186,17 @@ class Backup: network=s.network.call('backup-export') else:warnings.append('Deck-Netzwerkmodul deaktiviert; fremder WireGuard-Gateway wird nicht gesichert.') document=dict(format='athena-deck',version=VERSION,created_at=time.time(),settings=settings,models=models,credentials=s.credentials.read(),theme=theme,network=network,services=services,runtime_versions=dict(image=dict(comfy=s.image_runtime.status()['comfy_revision'],gguf=s.image_runtime.status()['gguf_revision']),tts=s.tts_runtime.status()['revision']),runtimes=dict(audio_cpp=bool(getattr(s,'audio_cpp_runtime',None) and s.audio_cpp_runtime.status()['installed']),ltx_original=bool(getattr(s,'ltx_original_runtime',None) and s.ltx_original_runtime.status()['installed']),llama=llama,llama_builds=[dict(commit=b['commit'],backend=b['backend']) for b in state['builds']],image=s.image_runtime.status()['installed'],tts=s.tts_runtime.status()['installed'],enhancers={task:data['revision'] for task in ('t2i','i2i') if (data:=s.prompt_enhancer.installed(task))},swarm_nodes=(self.root/'video/swarm-comfy-nodes').is_dir()),warnings=warnings) + if getattr(s,'remix_runtime',None): + document['runtimes']['music_remix']=s.remix_runtime.status()['installed'] + if document['runtimes']['music_remix']: + from remix_runtime import VERSION as REMIX_VERSION + document['runtime_versions']['music_remix']=REMIX_VERSION if getattr(s,'separator_runtime',None): from separator_runtime import SOURCES separator=s.separator_runtime.status();document['runtimes']['separator']=dict(installed=separator['installed'],models=[m['id'] for m in separator['models'] if m['installed']],sources={m['id']:SOURCES[m['id']] for m in separator['models'] if m['installed']});document['runtime_versions']['separator']=separator['version'] + if getattr(s,'xvc_runtime',None): + from xvc_runtime import RECIPE_HASH + document['runtimes']['xvc']=s.xvc_runtime.status()['installed'];document['runtime_versions']['xvc']=dict(code=s.xvc_runtime.status()['revision'],assets=RECIPE_HASH) if getattr(s,'applio_runtime',None): document['runtimes']['applio']=s.applio_runtime.status()['installed'];document['runtime_versions']['applio']=s.applio_runtime.status()['revision'] if (self.root/'applio-data/logs').exists():document['warnings'].append('Eigene Applio-Stimmen und Trainingsdaten separat sichern. Dieses Konfigurationsbackup enthält sie nicht; nach Restore erst den Applio-Datenbestand zurückspielen.') @@ -234,6 +247,9 @@ class Backup: if versions.get('voxcpm'): from voxcpm_runtime import VERSION as VOXCPM_VERSION if versions['voxcpm']!=VOXCPM_VERSION:blockers.append('Backup verlangt eine andere VoxCPM-Version. Passende Deck-Version verwenden.') + if versions.get('music_remix'): + from remix_runtime import VERSION as REMIX_VERSION + if versions['music_remix']!=REMIX_VERSION:blockers.append('Backup verlangt eine andere Audio-Remix-Version.') if versions.get('separator'): from separator_runtime import VERSION as SEPARATOR_VERSION if versions['separator']!=SEPARATOR_VERSION:blockers.append('Backup verlangt eine andere Audio-Separator-Version.') @@ -243,10 +259,13 @@ class Backup: if versions.get('ltx_original'): from ltx_original_runtime import DESKTOP_REV,LTX_REV if versions['ltx_original']!=dict(desktop=DESKTOP_REV,inference=LTX_REV):blockers.append('Backup verlangt eine andere originale LTX-Version. Passende Deck-Version verwenden.') + if versions.get('xvc'): + from xvc_runtime import REVISION as XVC_REVISION,RECIPE_HASH + if versions['xvc']!=dict(code=XVC_REVISION,assets=RECIPE_HASH):blockers.append('Backup verlangt eine andere X-VC-Version oder Komponentenquelle.') if versions.get('applio'): from applio_runtime import REVISION as APPLIO_REVISION if versions['applio']!=APPLIO_REVISION:blockers.append('Backup verlangt eine andere Applio-Version.') - if versions and {k:v for k,v in versions.items() if k not in ('ltx_original','audio_cpp','separator','voxcpm','omnivoice','acestep','applio')}!=dict(image=dict(comfy=s.image_runtime.status()['comfy_revision'],gguf=s.image_runtime.status()['gguf_revision']),tts=s.tts_runtime.status()['revision']):blockers.append('Backup verlangt andere Bild-/TTS-Laufzeitversionen. Passende Deck-Version oder geprüftes Runtime-Upgrade verwenden.') + if versions and {k:v for k,v in versions.items() if k not in ('ltx_original','audio_cpp','separator','voxcpm','omnivoice','acestep','applio','xvc','music_remix')}!=dict(image=dict(comfy=s.image_runtime.status()['comfy_revision'],gguf=s.image_runtime.status()['gguf_revision']),tts=s.tts_runtime.status()['revision']):blockers.append('Backup verlangt andere Bild-/TTS-Laufzeitversionen. Passende Deck-Version oder geprüftes Runtime-Upgrade verwenden.') for c in doc['services']: if not c.get('registry') and not c.get('build_recipe'):warnings.append(c['name']+': Image nur lokal vorhanden; Registry-/Buildquelle fehlt.') ports=s.endpoint.allowed_ports @@ -271,8 +290,10 @@ class Backup: if len(set(data['services']))!=len(data['services']) or any(name not in services for name in data['services']):raise ValueError('Unbekannter Zusatzdienst.') if any(not services[name].get('registry') and not services[name].get('build_recipe') for name in data['services']):raise ValueError('Gewählter Dienst hat keine Wiederherstellungsquelle.') s=self.server + if getattr(getattr(s,'remix',None),'active',False):raise ValueError('Audio-Remix-Analyse zuerst abschließen.') + if getattr(getattr(s,'xvc',None),'active',False):raise ValueError('X-VC-Auftrag zuerst abschließen.') if getattr(getattr(s,'applio',None),'active',False):raise ValueError('Applio-Auftrag zuerst abschließen.') - if s.catalog.pending or s.catalog.job and s.catalog.job['state']=='downloading' or s.runtime.busy or any((getattr(o,'job',None) or {}).get('state')=='running' for o in (s.image_runtime,s.tts_runtime,s.ltx_original_runtime,getattr(s,'audio_cpp_runtime',None),getattr(s,'acestep_runtime',None),getattr(s,'applio_runtime',None),getattr(s,'music',None),getattr(s,'separator_runtime',None),getattr(s,'separator_tests',None),s.prompt_enhancer,s.auto_tests,s.chat_tests,s.image_tests,s.tts_tests,s.stt)):raise ValueError('Zuerst laufende Downloads, Builds und Tests abschließen oder abbrechen.') + if s.catalog.pending or s.catalog.job and s.catalog.job['state']=='downloading' or s.runtime.busy or any((getattr(o,'job',None) or {}).get('state')=='running' for o in (s.image_runtime,s.tts_runtime,s.ltx_original_runtime,getattr(s,'audio_cpp_runtime',None),getattr(s,'acestep_runtime',None),getattr(s,'applio_runtime',None),getattr(s,'xvc_runtime',None),getattr(s,'music',None),getattr(s,'remix_runtime',None),getattr(s,'remix',None),getattr(s,'separator_runtime',None),getattr(s,'separator_tests',None),s.prompt_enhancer,s.auto_tests,s.chat_tests,s.image_tests,s.tts_tests,s.stt)):raise ValueError('Zuerst laufende Downloads, Builds und Tests abschließen oder abbrechen.') self.cancel.clear();self.job=dict(id=secrets.token_hex(16),state='running',phase='Wiederherstellung vorbereiten',completed=0,total=len(doc['models'])+len(data['services'])+5,items=[],started_at=time.time(),theme=doc.get('theme','deck')) self._save();threading.Thread(target=self._restore,args=(copy.deepcopy(doc),data['services'],data['restore_credentials']),daemon=True).start();self.plan=None return self.status() @@ -298,6 +319,8 @@ class Backup: self._phase('Vorhandene Bild-/Videolaufzeit prüfen oder installieren');s.image_runtime.start();self._wait(s.image_runtime.status) if r['tts'] and not s.tts_runtime.status()['installed']: self._phase('TTS-Laufzeit und Zusatzdateien installieren');s.tts_runtime.start();self._wait(s.tts_runtime.status) + if r.get('xvc') and not s.xvc_runtime.status()['installed']: + self._phase('X-VC-Laufzeit und geprüfte Zusatzgewichte installieren');s.xvc_runtime.start();self._wait(s.xvc_runtime.status) if r.get('applio') and not s.applio_runtime.status()['installed']: self._phase('Applio-Laufzeit und Basisgewichte installieren');s.applio_runtime.start();self._wait(s.applio_runtime.status) if r.get('acestep') and not s.acestep_runtime.status()['installed']: @@ -317,6 +340,8 @@ class Backup: for name in r['separator']['models']: if not s.separator_runtime.model_ready(name) or not verify_package(s.separator_runtime.root/'models',name): self._phase('Audio-Separator-Modellpaket laden');s.separator_runtime.download(name);self._wait(s.separator_runtime.status) + if r.get('music_remix') and not s.remix_runtime.status()['installed']: + self._phase('Audio-Remix-Laufzeit und Modelle installieren');s.remix_runtime.start();self._wait(s.remix_runtime.status) targets=r['llama_builds']+([r['llama']] if r['llama'] and r['llama'] not in r['llama_builds'] else []) for target in targets: state=s.runtime.status();matching=next((b for b in state['builds'] if b['commit']==target['commit'] and b['backend']==target['backend']),None) @@ -337,6 +362,7 @@ class Backup: key=secrets.token_urlsafe(32);rollback.write_bytes(seal(before,key));rollback.chmod(0o600) # Recovery key stays on this server in a separate protected file, never in status responses. (rollback.with_suffix('.key')).write_text(key);rollback.with_suffix('.key').chmod(0o600) + if getattr(s,'xvc',None):s.xvc.unload_idle() if getattr(s,'applio',None):s.applio.unload_idle() s.endpoint.close();s.video.close();s.tts_tests.stop();s.stt.stop() until=time.monotonic()+30 @@ -434,6 +460,7 @@ class Backup: if name=='video/comfy-client-token': path=self.root/name;path.parent.mkdir(parents=True,exist_ok=True);path.write_text(value+'\n');path.chmod(0o600) else:atomic_write(self.root/name,value) + if getattr(s,'xvc',None):s.xvc.settings=copy.deepcopy(doc['settings'].get('xvc-data/settings.json',{'device':'5080'})) if getattr(s,'applio',None):s.applio.settings=copy.deepcopy(doc['settings'].get('applio-data/settings.json',{'device':'3060'})) with s.profiles.lock: from profiles import migrate_api_ids @@ -467,6 +494,7 @@ class Backup: if getattr(self.server,'music',None):self.server.music.stop() if getattr(self.server,'omnivoice_runtime',None):self.server.omnivoice_runtime.stop() if getattr(self.server,'voxcpm_runtime',None):self.server.voxcpm_runtime.stop() + if getattr(self.server,'xvc_runtime',None):self.server.xvc_runtime.stop() if getattr(self.server,'applio_runtime',None):self.server.applio_runtime.stop() if getattr(self.server,'acestep_runtime',None):self.server.acestep_runtime.stop() if getattr(self.server,'audio_cpp_runtime',None):self.server.audio_cpp_runtime.stop() diff --git a/catalog.py b/catalog.py index 659f78b..7422282 100644 --- a/catalog.py +++ b/catalog.py @@ -70,6 +70,8 @@ def file_role(filename): role,label='auxiliary','ACE-Step-Musik-Sprachmodell' elif PurePosixPath(name).name in ('model-00002-of-00004.safetensors','model-00003-of-00004.safetensors','model-00004-of-00004.safetensors'): role,label='auxiliary','Gewichts-Teildatei' + elif name=='xvc.pt': + role,label='model','X-VC-Stimmgewicht' elif name.endswith('.pth') and not PurePosixPath(name).name.startswith(('g_','d_')) and not any(p in ('pretraineds','predictors','embedders') for p in parts): role,label='model','Stimmgewicht (PTH)' elif name.endswith(('.gguf','.safetensors')): @@ -213,7 +215,7 @@ class Catalog: name=f['rfilename'];p=PurePosixPath(name) from acestep_models import ACE_REPO,ACE_BASE_REPO,ACE_FILES,ACE_BASE_FILES recipe_file=(repo==ACE_REPO and name in ACE_FILES) or (repo==ACE_BASE_REPO and name in ACE_BASE_FILES) or (repo=='k2-fsa/OmniVoice' and name=='chat_template.jinja') - allowed=recipe_file or p.suffix.lower() in ('.gguf','.safetensors','.json','.tiktoken') or (repo=='openbmb/VoxCPM2' and name=='audiovae.pth') + allowed=recipe_file or p.suffix.lower() in ('.gguf','.safetensors','.json','.tiktoken') or (repo=='openbmb/VoxCPM2' and name=='audiovae.pth') or (repo=='chenxie95/X-VC' and name=='xvc.pt') if p.is_absolute() or '..' in p.parts or not allowed:continue size=f.get('size',f.get('lfs',{}).get('size')) if not isinstance(size,int) or size<1:continue diff --git a/clearvoice_worker.py b/clearvoice_worker.py new file mode 100644 index 0000000..ed101cc --- /dev/null +++ b/clearvoice_worker.py @@ -0,0 +1,36 @@ +"""Pinned ClearVoice enhancement; file mode segments long recordings correctly.""" +import json,os,subprocess,sys,tempfile +from pathlib import Path +import numpy as np +import soundfile as sf +import torch +from separator_runtime import verify_package,CLEARVOICE + +def enhance(model_dir,source,output): + if not verify_package(model_dir,CLEARVOICE):raise ValueError('ClearVoice-Modellpaket-Prüfsumme stimmt nicht.') + if not torch.cuda.is_available():raise ValueError('CUDA nicht verfügbar; kein CPU-Fallback.') + output=Path(output) + with tempfile.TemporaryDirectory(prefix='clearvoice-',dir=output) as temp: + work=Path(temp);(work/'checkpoints').symlink_to((Path(model_dir)/'clearvoice').resolve(),target_is_directory=True) + subprocess.run(['ffmpeg','-nostdin','-hide_banner','-loglevel','error','-y','-i',str(source),'-ar','48000','-c:a','pcm_f32le',str(work/'input.wav')],check=True,timeout=180,stdout=subprocess.DEVNULL,stderr=subprocess.DEVNULL) + audio,sr=sf.read(work/'input.wav',dtype='float32',always_2d=True) + previous=Path.cwd() + try: + os.chdir(work) + from clearvoice import ClearVoice + from clearvoice.networks import SpeechModel + from unittest.mock import patch + if torch.cuda.device_count()!=1:raise ValueError('Genau eine von Deck ausgewählte GPU erforderlich.') + # Upstream uses physical nvidia-smi indices; Deck exposes only local CUDA:0. + with patch.object(SpeechModel,'get_free_gpu',return_value=0):model=ClearVoice(task='speech_enhancement',model_names=[CLEARVOICE]) + channels=[] + for i in range(audio.shape[1]): + path=work/f'channel-{i}.wav';sf.write(path,audio[:,i],sr,subtype='FLOAT') + clean=np.asarray(model(str(path),False),dtype='float32').squeeze() + if clean.ndim!=1 or not np.isfinite(clean).all():raise ValueError('Ungültige ClearVoice-Ausgabe.') + channels.append(clean) + length=min(len(audio),*(len(c) for c in channels));speech=np.column_stack([c[:length] for c in channels]);background=audio[:length]-speech + finally:os.chdir(previous) + for name,data in [('speech.wav',speech),('rest.wav',background)]:sf.write(output/name,np.clip(data,-1,1),sr,subtype='PCM_16') + (output/'results.json').write_text(json.dumps(['speech.wav','rest.wav'])) +if __name__=='__main__':enhance(sys.argv[1],sys.argv[3],sys.argv[4]) diff --git a/cuda_overlay.py b/cuda_overlay.py new file mode 100644 index 0000000..78f3db2 --- /dev/null +++ b/cuda_overlay.py @@ -0,0 +1,14 @@ +"""Expose only immutable CUDA packages, never another application's full environment.""" +import json,subprocess +from pathlib import Path +PREFIXES=('torchgen','functorch','torch','torchaudio','triton','nvidia','cuda','cuda_bindings','cuda_python') +def share_cuda(python,base,shared,command): + roots=json.loads(subprocess.check_output([str(shared),'-c','import json,site;print(json.dumps(site.getsitepackages()))'],text=True)) + destination=Path(base)/'cuda-packages';destination.mkdir(exist_ok=True) + for root in roots: + if not Path(root).is_dir():continue + for path in Path(root).iterdir(): + if any(path.name==p or path.name.startswith(p+'-') or path.name.startswith(p+'_') for p in PREFIXES): + target=destination/path.name + if not target.exists():target.symlink_to(path.resolve(),target_is_directory=path.is_dir()) + command([python,'-c','import site,sys;from pathlib import Path;Path(site.getsitepackages()[0],"deck-shared-cuda.pth").write_text(sys.argv[1]+"\\n")',str(destination)]) diff --git a/deploy/Dockerfile b/deploy/Dockerfile index 70df419..79232b6 100644 --- a/deploy/Dockerfile +++ b/deploy/Dockerfile @@ -17,9 +17,11 @@ COPY deploy/image-requirements.lock /app/deploy/image-requirements.lock COPY deploy/acestep-requirements.lock /app/deploy/acestep-requirements.lock COPY deploy/tts-requirements.lock /app/deploy/tts-requirements.lock COPY deploy/ltx-original-requirements.lock /app/deploy/ltx-original-requirements.lock -COPY applio.py applio_runtime.py applio_worker.py applio-ui.js acestep_models.py acestep.py acestep_worker.py acestep_runtime.py acestep-ui.js embeddings.py voxcpm_test.py voxcpm_worker.py voxcpm_runtime.py separator_sources.json separator.py separator_runtime.py separator_worker.py music.py audio_cpp_runtime.py ltx_original_runtime.py ltx_original_entry.py video_original.py backup.py backup_codec.py audio_policy.py prompt_enhancer.py prompt_enhancer_worker.py api_compat.py responses_compat.py stt.py execution_setup.py tts_runtime.py tts_test.py tts_worker.py auto_test.py chat_test.py endpoint.py inference.py docker_support.py image_encoder_node.py image_runtime.py image_test.py image_upload.py profiles.py capacity.py server.py runtime.py video.py video_proxy.py video_comfy.py video_comfy_node.py video_comfy_proxy.py catalog.py hub_auth.py auth.py collect_hardware.py dashboard_data.py dashboard_history.py /app/ +COPY cuda_overlay.py remix.py remix_runtime.py remix_worker.py remix_sources.json clearvoice_worker.py xvc.py xvc_runtime.py xvc_sources.json xvc-ui.js applio.py applio_runtime.py applio_worker.py applio-ui.js acestep_models.py acestep.py acestep_worker.py acestep_runtime.py acestep-ui.js embeddings.py voxcpm_test.py voxcpm_worker.py voxcpm_runtime.py separator_sources.json separator.py separator_runtime.py separator_worker.py music.py audio_cpp_runtime.py ltx_original_runtime.py ltx_original_entry.py video_original.py backup.py backup_codec.py audio_policy.py prompt_enhancer.py prompt_enhancer_worker.py api_compat.py responses_compat.py stt.py execution_setup.py tts_runtime.py tts_test.py tts_worker.py auto_test.py chat_test.py endpoint.py inference.py docker_support.py image_encoder_node.py image_runtime.py image_test.py image_upload.py profiles.py capacity.py server.py runtime.py video.py video_proxy.py video_comfy.py video_comfy_node.py video_comfy_proxy.py catalog.py hub_auth.py auth.py collect_hardware.py dashboard_data.py dashboard_history.py /app/ COPY voice-ui.js voxcpm-ui.js separator-ui.js music-ui.js audio-cpp-ui.js ltx-original-ui.js backup-ui.js video-ui.js stt-ui.js tts-ui.js auto-test-ui.js chat-test-ui.js endpoint-ui.js docker-ui.js image-test-ui.js profiles-ui.js dashboard-ui.js index.html app.js studio.js runtime-ui.js catalog-ui.js style.css dashboard.css themes.css login.html login.js access-ui.js network-ui.js /app/ COPY deploy/docker_backup.py /app/deploy/docker_backup.py +COPY deploy/xvc-requirements.lock /app/deploy/xvc-requirements.lock +COPY deploy/xvc-web /app/deploy/xvc-web COPY deploy/applio-requirements.lock /app/deploy/applio-requirements.lock COPY deploy/applio-web /app/deploy/applio-web COPY network/__init__.py network/client.py network/config.py network/rpc.py /app/network/ diff --git a/deploy/docker_backup.py b/deploy/docker_backup.py index c0244e7..61f9de2 100644 --- a/deploy/docker_backup.py +++ b/deploy/docker_backup.py @@ -53,7 +53,7 @@ def export(manager): try:relative=str(Path(source).relative_to(deck)) except ValueError:pass mounts.append(dict(index=i,target=m['Destination'],read_only=not m['RW'],deck_path=relative,files=config_files(source,m['Destination']),was_file=Path(source).is_file())) - result.append(dict(name=row['name'],image=c['Image'],registry=registry,application=c.get('Labels',{}).get(APP,''),labels={k:v for k,v in (c.get('Labels') or {}).items() if k.startswith('io.athena-deck.')},env=c.get('Env') or [],entrypoint=c.get('Entrypoint'),cmd=c.get('Cmd'),uid=app_uid(row['id'],c.get('User') or ''),user=c.get('User') or '',workdir=c.get('WorkingDir') or '',network=h['NetworkMode'],ports=h.get('PortBindings') or {},restart=h.get('RestartPolicy',{}).get('Name') or 'no',memory=h.get('Memory') or 0,nanocpus=h.get('NanoCpus') or 0,running=x['State']['Running'],mounts=mounts,build_recipe='swarm-ui' if row['name']=='athena-swarm-ui' else 'ladypoly' if row['name']=='athena-ladypoly' else 'separator-web' if row['name']=='athena-separator-web' else 'applio-web' if row['name']=='athena-applio-web' else 'acestep-web' if row['name']=='athena-acestep-web' else 'voice-web' if row['name'] in ('athena-voxcpm2-web','athena-omnivoice-web') else None,unsupported=bool(h.get('Privileged') or h.get('DeviceRequests') or h.get('Devices') or h.get('CapAdd')))) + result.append(dict(name=row['name'],image=c['Image'],registry=registry,application=c.get('Labels',{}).get(APP,''),labels={k:v for k,v in (c.get('Labels') or {}).items() if k.startswith('io.athena-deck.')},env=c.get('Env') or [],entrypoint=c.get('Entrypoint'),cmd=c.get('Cmd'),uid=app_uid(row['id'],c.get('User') or ''),user=c.get('User') or '',workdir=c.get('WorkingDir') or '',network=h['NetworkMode'],ports=h.get('PortBindings') or {},restart=h.get('RestartPolicy',{}).get('Name') or 'no',memory=h.get('Memory') or 0,nanocpus=h.get('NanoCpus') or 0,running=x['State']['Running'],mounts=mounts,build_recipe='swarm-ui' if row['name']=='athena-swarm-ui' else 'ladypoly' if row['name']=='athena-ladypoly' else 'separator-web' if row['name']=='athena-separator-web' else 'xvc-web' if row['name']=='athena-xvc-web' else 'applio-web' if row['name']=='athena-applio-web' else 'acestep-web' if row['name']=='athena-acestep-web' else 'voice-web' if row['name'] in ('athena-voxcpm2-web','athena-omnivoice-web') else None,unsupported=bool(h.get('Privileged') or h.get('DeviceRequests') or h.get('Devices') or h.get('CapAdd')))) return {'services':result,'configured':bool(deck)} def validate(c): @@ -61,8 +61,8 @@ def validate(c): if any(c.get('labels',{}).get(k)!=v for k,v in LABELS.items()):raise ValueError('Nur ausdrücklich Deck zugeordnete Anwendungscontainer erlaubt.') if c.get('unsupported'):raise ValueError('GPU-/privilegierter Container benötigt manuelle Einrichtung.') if c.get('network') not in ('bridge','default','host'):raise ValueError('Benutzerdefiniertes Docker-Netzwerk benötigt manuelle Einrichtung.') - if c.get('network')=='host' and c['name'] not in ('athena-swarm-ui','ltx-deskweb','athena-ladypoly','athena-separator-web','athena-voxcpm2-web','athena-omnivoice-web','athena-acestep-web','athena-applio-web'):raise ValueError('Host-Netzwerk nur für bekannte Deck-Oberflächen erlaubt.') - recipes={'applio-web':('athena-applio-web','athena-applio-web:3.6.5-deck1'),'acestep-web':('athena-acestep-web','athena-acestep-web:1.0.0'),'separator-web':('athena-separator-web','athena-separator-web:0.1.0'),'swarm-ui':('athena-swarm-ui','athena-swarm-ui:de7b834'),'ladypoly':('athena-ladypoly','athena-ladypoly:3960afc-deck1')} + if c.get('network')=='host' and c['name'] not in ('athena-swarm-ui','ltx-deskweb','athena-ladypoly','athena-separator-web','athena-voxcpm2-web','athena-omnivoice-web','athena-acestep-web','athena-applio-web','athena-xvc-web'):raise ValueError('Host-Netzwerk nur für bekannte Deck-Oberflächen erlaubt.') + recipes={'xvc-web':('athena-xvc-web','athena-xvc-web:0.1.0-deck1'),'applio-web':('athena-applio-web','athena-applio-web:3.6.5-deck1'),'acestep-web':('athena-acestep-web','athena-acestep-web:1.0.0'),'separator-web':('athena-separator-web','athena-separator-web:0.1.0'),'swarm-ui':('athena-swarm-ui','athena-swarm-ui:de7b834'),'ladypoly':('athena-ladypoly','athena-ladypoly:3960afc-deck1')} if c.get('build_recipe')=='voice-web' and c['name'] in ('athena-voxcpm2-web','athena-omnivoice-web') and c.get('image') in ('athena-voice-web:0.2.1-deck1','athena-voice-web:0.2.1-deck2'):pass elif c.get('build_recipe') is not None and recipes.get(c['build_recipe'])!=(c['name'],c.get('image')):raise ValueError('Unbekanntes Build-Rezept.') ref=c.get('registry') or c.get('image','') @@ -94,12 +94,13 @@ def validate(c): if m.get('index')!=i or type(m.get('read_only')) is not bool or type(m.get('was_file')) is not bool:raise ValueError('Ungültige Volume-Einstellung.') rel=m.get('deck_path') media={'video/original-work/remote-inputs/deskweb':('/data/inputs',False),'video/original-work/outputs':('/data/outputs',True)} + native_xvc=rel=='xvc-data/bridge-key' and c['name']=='athena-xvc-web' and target=='/run/secrets/xvc-bridge' and m['read_only'] and m['was_file'] native_applio=rel=='applio-data/bridge-key' and c['name']=='athena-applio-web' and target=='/run/secrets/applio-bridge' and m['read_only'] and m['was_file'] native_media=rel in media and c['name']=='ltx-deskweb' and (target,m['read_only'])==media[rel] and not m['was_file'] - if rel is not None and not native_media and not native_applio and (rel not in ('models','video/comfy-work/models','video/comfy-client-token') or not m['read_only']):raise ValueError('Deck-Volume nicht freigegeben; nur bekannte Modell-/Tokenpfade und LTX-Medienordner erlaubt.') + if rel is not None and not native_media and not native_applio and not native_xvc and (rel not in ('models','video/comfy-work/models','video/comfy-client-token') or not m['read_only']):raise ValueError('Deck-Volume nicht freigegeben; nur bekannte Modell-/Tokenpfade und LTX-Medienordner erlaubt.') for name,data in m.get('files',{}).items(): allowed=('file','Settings.fds','Backends.fds') - if c['name'] in ('athena-ladypoly','athena-separator-web','athena-voxcpm2-web','athena-omnivoice-web','athena-acestep-web','athena-applio-web') and m['target']=='/data':allowed+=('settings.json','deck-connection.json') + if c['name'] in ('athena-ladypoly','athena-separator-web','athena-voxcpm2-web','athena-omnivoice-web','athena-acestep-web','athena-applio-web','athena-xvc-web') and m['target']=='/data':allowed+=('settings.json','deck-connection.json') if name not in allowed:raise ValueError('Unbekannte Konfigurationsdatei.') if not isinstance(data,str) or len(base64.b64decode(data,validate=True))>MAX_FILE:raise ValueError('Ungültige Konfigurationsdatei.') return c @@ -117,9 +118,9 @@ def restore(manager,c): # Never replace or restart an existing service during a restore. if x['Config']['Image'] not in (c['image'],c.get('registry')):raise ValueError('Vorhandener Container verwendet ein anderes Image; manuell prüfen.') return {'state':'reused','message':'Vorhandener markierter Container unverändert übernommen.'} - if c['name'] in ('athena-ladypoly','athena-separator-web','athena-voxcpm2-web','athena-omnivoice-web','athena-acestep-web','athena-applio-web'): - with socket.socket() as probe:probe.bind(('127.0.0.1',{'athena-ladypoly':8127,'athena-separator-web':8128,'athena-voxcpm2-web':8129,'athena-omnivoice-web':8130,'athena-acestep-web':8131,'athena-applio-web':8132}[c['name']])) - if c.get('build_recipe') in ('swarm-ui','ladypoly','separator-web','voice-web','acestep-web','applio-web'): + if c['name'] in ('athena-ladypoly','athena-separator-web','athena-voxcpm2-web','athena-omnivoice-web','athena-acestep-web','athena-applio-web','athena-xvc-web'): + with socket.socket() as probe:probe.bind(('127.0.0.1',{'athena-ladypoly':8127,'athena-separator-web':8128,'athena-voxcpm2-web':8129,'athena-omnivoice-web':8130,'athena-acestep-web':8131,'athena-applio-web':8132,'athena-xvc-web':8133}[c['name']])) + if c.get('build_recipe') in ('swarm-ui','ladypoly','separator-web','voice-web','acestep-web','applio-web','xvc-web'): source=Path(__file__).parent/c['build_recipe'] if not (source/'Dockerfile').is_file():raise ValueError('Gepinntes Swarm-Build-Rezept fehlt im Systemhelfer.') if c['build_recipe']=='voice-web': @@ -147,7 +148,7 @@ def restore(manager,c): if base.is_symlink():raise ValueError('Unsicheres Dienstverzeichnis.') base.mkdir(parents=True,exist_ok=True,mode=0o700) args=['create','--name',name,'--network',c['network'],'--restart',c['restart'],'--cap-drop','ALL','--security-opt','no-new-privileges:true','--pids-limit','256'] - if c['name'] in ('athena-ladypoly','athena-separator-web','athena-voxcpm2-web','athena-omnivoice-web','athena-acestep-web','athena-applio-web'): + if c['name'] in ('athena-ladypoly','athena-separator-web','athena-voxcpm2-web','athena-omnivoice-web','athena-acestep-web','athena-applio-web','athena-xvc-web'): args+=['--read-only','--tmpfs','/tmp:rw,noexec,nosuid,size='+('1g' if c['name']=='athena-separator-web' else '128m')+',uid=65534,gid=65534'] if c['memory']:args+=['--memory',str(c['memory'])] if c['nanocpus']:args+=['--cpus',str(c['nanocpus']/1e9)] @@ -163,10 +164,10 @@ def restore(manager,c): source=deck/m['deck_path'] if m['deck_path'] is not None else base/str(i) if source.is_symlink():raise ValueError('Unsicheres Volume-Verzeichnis.') if m['deck_path']: - if m['deck_path'] in ('video/comfy-client-token','applio-data/bridge-key') and not source.exists(): + if m['deck_path'] in ('video/comfy-client-token','applio-data/bridge-key','xvc-data/bridge-key') and not source.exists(): import secrets source.parent.mkdir(parents=True,exist_ok=True);source.write_text(secrets.token_urlsafe(48)+'\n');source.chmod(0o600);os.chown(source,65534,65534) - elif m['deck_path'] not in ('video/comfy-client-token','applio-data/bridge-key'): + elif m['deck_path'] not in ('video/comfy-client-token','applio-data/bridge-key','xvc-data/bridge-key'): source.mkdir(parents=True,exist_ok=True) if m['deck_path'].startswith('video/original-work/'): is_input=m['deck_path'].endswith('/deskweb');os.chown(source,1000 if is_input else 65534,65534);source.chmod(0o2770 if is_input else 0o2750) diff --git a/deploy/install.py b/deploy/install.py index 492073b..b51ca0e 100644 --- a/deploy/install.py +++ b/deploy/install.py @@ -18,6 +18,9 @@ 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 += ['xvc.py','xvc_runtime.py','xvc_sources.json','xvc-ui.js','deploy/xvc-requirements.lock','deploy/prepare_xvc.py'] +FILES += ['cuda_overlay.py','remix.py','remix_runtime.py','remix_worker.py','remix_sources.json','clearvoice_worker.py','deploy/ladypoly/patch_remix.py'] +FILES += sorted(str(p.relative_to(ROOT)) for p in (ROOT/'deploy/xvc-web').rglob('*') if p.is_file() and not {'__pycache__','.pytest_cache'} & set(p.parts)) FILES += sorted(str(p.relative_to(ROOT)) for p in (ROOT/'deploy/applio-web').rglob('*') if p.is_file() and not {'__pycache__','.pytest_cache'} & set(p.parts)) def run(*args, check=True, interactive=False): @@ -67,7 +70,37 @@ def free_port(port): raise RuntimeError('Der gewünschte Loopback-Port ist bereits belegt.') from None +def compact_runtime_image(runtime_image): + """Flatten only image files; never export a running container or its volumes.""" + metadata=json.loads(run('docker','image','inspect',runtime_image).stdout)[0] + if len(metadata.get('RootFS',{}).get('Layers',[])) < 100: + return runtime_image + tag='athena-deck-runtime-flat:'+metadata['Id'].split(':')[-1][:16] + if run('docker','image','inspect',tag,check=False).returncode == 0: + return tag + print('Docker-Laufzeitbasis zusammenfassen; Datenvolumes bleiben unangetastet.',flush=True) + container=run('docker','create',metadata['Id']).stdout.strip() + config=metadata['Config'];changes=[] + for value in config.get('Env',[]):changes += ['--change','ENV '+value] + for key in ('Entrypoint','Cmd'): + if config.get(key):changes += ['--change',key.upper()+' '+json.dumps(config[key])] + for key in ('User','WorkingDir'): + if config.get(key):changes += ['--change',('USER' if key=='User' else 'WORKDIR')+' '+config[key]] + for key,value in (config.get('Labels') or {}).items(): + changes += ['--change','LABEL '+key+'='+json.dumps(value)] + try: + # /tmp is often a small RAM filesystem on GPU hosts. + with tempfile.TemporaryFile(dir='/var/tmp') as archive: + subprocess.run(['docker','export',container],stdout=archive,check=True) + archive.seek(0) + subprocess.run(['docker','import',*changes,'-',tag],stdin=archive,stdout=subprocess.DEVNULL,check=True) + finally: + run('docker','rm',container,check=False) + return tag + + def build(runtime_image=None): + if runtime_image:runtime_image=compact_runtime_image(runtime_image) digest = hashlib.sha256() for name in FILES: digest.update(name.encode());digest.update((ROOT/name).read_bytes()) @@ -111,8 +144,8 @@ def launch(config): '-p','127.0.0.1:'+str(config['port'])+':8108', '--health-cmd', 'python3 -c "import urllib.request,json; assert json.load(urllib.request.urlopen(\'http://127.0.0.1:8108/api/v1/auth/status\',timeout=3))[\'initialized\']"', '--health-interval','30s','--health-timeout','5s','--health-retries','3'] - if config['port']==8134 or 8134 in config.get('api_ports',[]):raise RuntimeError('Port 8134 ist für die interne Applio-Brücke reserviert.') - args+=['-p','127.0.0.1:8134:8134'] + if config['port'] in (8134,8135) or set(config.get('api_ports',[])) & {8134,8135}:raise RuntimeError('Ports 8134/8135 sind für interne Stimmwerkzeug-Brücken reserviert.') + args+=['-p','127.0.0.1:8134:8134','-p','127.0.0.1:8135:8135'] if config.get('api_ports'): args+=['-e','DECK_API_BIND=0.0.0.0','-e','DECK_API_PORTS='+','.join(map(str,config['api_ports']))] for port in config['api_ports']:args+=['-p',f'127.0.0.1:{port}:{port}'] @@ -219,7 +252,7 @@ def update(base, rollback=False, force=False, api_ports=None, reuse_runtime=Fals backup_name=config['name']+'-previous' if inspect(backup_name):raise RuntimeError('Rückfall-Containername belegt. Keine Änderung ausgeführt.') stamp=str(time.time_ns()) - shutil.copytree(base/'state',base/'backups'/stamp,ignore=shutil.ignore_patterns('cache','omni-reference-check.py','omni-cache-clean.py','applio-runtime','applio-data','applio-checkout','applio-runtime.py','import_applio.py','applio-migration.log','acestep-runtime','acestep-jobs','acestep-setup-code','acestep-checkout','acestep-source-files','acestep-test-tmp','music-verification','music-test-temp','music-jobs','separator-runtime','separator-tests','voxcpm-runtime','omnivoice-runtime','voice-worker-check','voice-integration-check','voice-setup-code','audio-cpp-runtime','ltx-original-runtime','original-work','tts-runtime','tts-tests','voice-tests','models','runtime','runtime-verification','image-tests','image-verification','image-verification-*','image-runtime','video-runtime','video-verification','video-verification-*','comfy-work','router-verification-*')) + shutil.copytree(base/'state',base/'backups'/stamp,ignore=shutil.ignore_patterns('xvc-runtime','xvc-data','xvc-prepare','cache','omni-reference-check.py','omni-cache-clean.py','applio-runtime','applio-data','applio-checkout','applio-runtime.py','import_applio.py','applio-migration.log','acestep-runtime','acestep-jobs','acestep-setup-code','acestep-checkout','acestep-source-files','acestep-test-tmp','music-verification','music-test-temp','music-jobs','music-remix-runtime','separator-runtime','separator-tests','voxcpm-runtime','omnivoice-runtime','voice-worker-check','voice-integration-check','voice-setup-code','audio-cpp-runtime','ltx-original-runtime','original-work','tts-runtime','tts-tests','voice-tests','models','runtime','runtime-verification','image-tests','image-verification','image-verification-*','image-runtime','video-runtime','video-verification','video-verification-*','comfy-work','router-verification-*')) was_running=previous['State']['Running'] if was_running:run('docker','stop','--time','15',config['name']) run('docker','rename',config['name'],backup_name) diff --git a/deploy/ladypoly/Dockerfile b/deploy/ladypoly/Dockerfile index 39f6e4a..c4ebf89 100644 --- a/deploy/ladypoly/Dockerfile +++ b/deploy/ladypoly/Dockerfile @@ -6,8 +6,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends git libsndfile1 && rm -rf /app/.git \ && pip install --no-cache-dir fastapi==0.115.12 uvicorn==0.34.2 python-multipart==0.0.20 numpy==2.2.6 soundfile==0.13.1 COPY bridge.py /app/webui/deck_bridge.py +COPY patch_remix.py /tmp/patch_remix.py +RUN python /tmp/patch_remix.py /app/webui RUN python -c "from pathlib import Path; p=Path('/app/webui/server.py'); s=p.read_text(); s=s.replace('SETTINGS_FILE = Path(__file__).resolve().parent / \"settings.json\"','SETTINGS_FILE = Path(\"/data/settings.json\")'); s=s.replace('from loras import Loras', 'from deck_bridge import Loras'); s=s.replace('if __name__ == \"__main__\":','from deck_bridge import install\ninstall(globals())\n\nif __name__ == \"__main__\":'); p.write_text(s)" -RUN python -c "from pathlib import Path; p=Path('/app/webui/static/index.html'); s=p.read_text().replace('
', 'In Deck das YuE2-Profil am API-Endpunkt freigeben und den Musik-Modus aktivieren. Hier den API-Token aus „Zugang & API“ und den genauen Profilnamen eingeben.
LadyPoly öffnen →Diese Anbindung unterstützt Liedtext, Stil, Seed und Syntheseschritte. Score, LoRA, eigener Writer und Cover-Generator sind hier noch nicht angebunden. Deck lädt und entlädt die Gewichte.
''' +PAGE='''In Deck das YuE2-Profil am API-Endpunkt freigeben und den Musik-Modus aktivieren. Hier den API-Token aus „Zugang & API“ und den genauen Profilnamen eingeben.
LadyPoly öffnen →Diese Anbindung unterstützt Liedtext, Stil, Seed und Syntheseschritte. Audio-Remix und ABC-Score laufen über Deck. LoRA, eigener Writer und Bild-Cover-Generator sind hier noch nicht angebunden. Deck lädt und entlädt die Gewichte.
''' def install(g): app=g['app'];g['SETTINGS'].song_engine='gguf';g['SETTINGS'].art_auto=False;g['SETTINGS'].stall_timeout=0 @@ -47,26 +47,42 @@ def install(g): CONNECTION.write_text(json.dumps(c));CONNECTION.chmod(0o600) return {'ok':True} def render(job,spec): - if spec.get('abc') or spec.get('cfg_scale') is not None or spec.get('abc_sampling') or spec.get('semantic_sampling') or g['SETTINGS'].loras: - raise RuntimeError('Score, Sampling-Overrides und LoRA sind in der Deck-Anbindung noch nicht verfügbar.') + if spec.get('cfg_scale') is not None or spec.get('abc_sampling') or spec.get('semantic_sampling') or g['SETTINGS'].loras: + raise RuntimeError('Sampling-Overrides und LoRA sind in der Deck-Anbindung noch nicht verfügbar.') c=json.loads(CONNECTION.read_text()) if CONNECTION.exists() else {} - spec['cot']='off' + spec['cot']=spec.get('cot','off') if spec.get('abc') else 'off' job.setup='Deck lädt YuE2 und erzeugt Musik · Musik-Modus erforderlich';job.setup_at=time.time();job.push(force=True) start=time.monotonic() - audio=request('/v1/audio/music',dict(model=c.get('model',''),lyrics=spec['lyrics'],style=spec['style'],seed=spec['seed'],steps=g['SETTINGS'].ode_steps,max_tokens=9000)) + audio=request('/v1/audio/music',dict(model=c.get('model',''),lyrics=spec['lyrics'],style=spec['style'],seed=spec['seed'],steps=g['SETTINGS'].ode_steps,max_tokens=9000,**({'abc':spec['abc'],'cot':spec['cot']} if spec.get('abc') else {}))) if job.cancel_flag.is_set():raise InterruptedError('UI-Auftrag abgebrochen. Laufenden Deck-Job in Deck stoppen.') work=g['OUTPUTS']/('.pending-'+job.id);work.mkdir(parents=True,exist_ok=True) wav=work/'audio.wav';wav.write_bytes(audio) - return g['GgufSong'](spec,wav,{'e2e_seconds':time.monotonic()-start},'',{'runtime':'Athena Deck audio.cpp','profile':c.get('model')}) + return g['GgufSong'](spec,wav,{'e2e_seconds':time.monotonic()-start},spec.get('abc',''),{'runtime':'Athena Deck audio.cpp','profile':c.get('model')}) g['render_gguf']=render;g['render_torch']=render g['ENGINE'].detail='Remote-Laufzeit in Athena Deck · Musik-Modus erforderlich' + # Replace upstream handlers: its local torch engine is deliberately unused. + app.router.routes[:]=[r for r in app.router.routes if getattr(r,'path','') not in ('/api/cover/status','/api/cover/from-audio')] + @app.get('/api/cover/status') + def cover_status(): + try:state=json.loads(request('/api/v1/music-remix',base='http://127.0.0.1:8108')) + except Exception as exc:raise HTTPException(503,str(exc)) from None + return {'sheetsage':{'available':state['installed']},'takes':[{'name':t['name'],'title':t['title'],'has_score':True} for t in g['library']() if t.get('score')]} + @app.post('/api/cover/from-audio') + async def from_audio(file: UploadFile=File(...),melody_only: bool=Form(True)): + audio=await file.read(256*1024**2+1) + if len(audio)>256*1024**2:raise HTTPException(400,'Audio maximal 256 MiB.') + boundary=secrets.token_hex(24) + body=(f'--{boundary}\r\nContent-Disposition: form-data; name="melody_only"\r\n\r\n{str(melody_only).lower()}\r\n--{boundary}\r\nContent-Disposition: form-data; name="file"; filename="input.wav"\r\nContent-Type: application/octet-stream\r\n\r\n'.encode()+audio+f'\r\n--{boundary}--\r\n'.encode()) + try: + result=json.loads(await asyncio.to_thread(request,'/api/v1/music-remix/transcribe',body,None,'multipart/form-data; boundary='+boundary,'http://127.0.0.1:8108'));result['source']=Path(file.filename or 'Audio').name;return result + except Exception as exc:raise HTTPException(400,str(exc)) from None @app.middleware('http') async def deck_guard(req,call_next): path=req.url.path origin=req.headers.get('Origin') if req.method!='GET' and origin and origin not in ('http://'+req.headers.get('Host',''),'https://'+req.headers.get('Host','')): return g['JSONResponse']({'detail':'Cross-Origin-Zugriff nicht erlaubt.'},status_code=403) - if req.method!='GET' and not (path in {'/api/generate','/api/deck/connection','/api/unlock'} or (req.method=='DELETE' and path.startswith('/api/library/') and path.count('/')==3)): + if req.method!='GET' and not (path in {'/api/generate','/api/deck/connection','/api/unlock','/api/cover/from-audio','/api/cover/from-take'} or (req.method=='DELETE' and path.startswith('/api/library/') and path.count('/')==3)): return g['JSONResponse']({'detail':'Laufzeiten, Modelle und Einstellungen werden in Athena Deck verwaltet.'},status_code=409) response=await call_next(req) response.headers['Cache-Control']='no-store' diff --git a/deploy/ladypoly/patch_remix.py b/deploy/ladypoly/patch_remix.py new file mode 100644 index 0000000..53b26a2 --- /dev/null +++ b/deploy/ladypoly/patch_remix.py @@ -0,0 +1,156 @@ +"""Small Linux integration fixes for the pinned community WebUI. + +Keep these transformations explicit and fail the image build if upstream moves +the expected code. That prevents a future upstream update from silently +producing a half-patched console. +""" +from pathlib import Path +import sys + + +root = Path(sys.argv[1]) +app_js = root / "static" / "app.js" +index_html = root / "static" / "index.html" +server_py = root / "server.py" + + +def replace_once(path: Path, old: str, new: str) -> None: + text = path.read_text(encoding="utf-8") + if text.count(old) != 1: + raise RuntimeError(f"expected exactly one patch marker in {path}: {old[:80]!r}") + path.write_text(text.replace(old, new, 1), encoding="utf-8") + + +# The published UI calls refreshArt() during startup, but does not define it. +# Athena does not install the Windows-only stable-diffusion.cpp helper, so show +# that state honestly and keep the optional controls inert instead of crashing +# the whole page. +art_marker = ''' $("artDirAdd").addEventListener("click", function () { +''' +art_fix = ''' function refreshArt() { + return api("/api/art/status").then(function (data) { + STATE.art = data; + var installed = !!data.installed; + var supported = !!data.supported; + $("artState").textContent = data.busy || (installed ? "installed" : + (supported ? "not installed" : "not available on Linux")); + $("artState").dataset.s = data.busy ? "busy" : (installed ? "ready" : "missing"); + $("artInstall").disabled = !!data.busy || !supported; + $("artInstall").textContent = installed ? "Reinstall" : "Install"; + $("setArtAuto").checked = !!data.auto; + $("setArtAuto").disabled = !installed; + $("setArtModel").innerHTML = (data.models || []).length + ? data.models.map(function (m) { + return ''; + }).join("") + : ''; + if (data.selected) $("setArtModel").value = data.selected; + $("setArtModel").disabled = !installed; + $("artDir").disabled = !supported; + $("artDirAdd").disabled = !supported; + $("artDirs").textContent = supported + ? ((data.dirs || []).length ? "Also scanning: " + data.dirs.join(" · ") : "No extra folders configured.") + : "The community release only provides the cover-art installer for Windows; song generation is unaffected."; + $("artCatalog").innerHTML = ""; + return data; + }).catch(function (error) { + $("artState").textContent = "unavailable"; + $("artInstall").disabled = true; + $("artDirs").textContent = error.message; + }); + } + + $("artDirAdd").addEventListener("click", function () { +''' +replace_once(app_js, art_marker, art_fix) + +# This UI container intentionally has no GPU: Deck owns the remote CUDA worker. +replace_once(app_js, ''' if (!data.hardware.cuda) { + toast("No CUDA device visible — generation needs an NVIDIA GPU with BF16", "bad"); + } +''', '') + +# The backend already ships a complete SheetSage2 upload endpoint but hides it +# from the published console. Surface it beside the existing take-to-take +# remix controls so uploaded songs can seed a new melody/arrangement. +replace_once( + index_html, + ''' + + +''', + ''' + +SheetSage2 listens to an uploaded song and writes an editable melody + and chord score for YuE2. This is structural transcription, not a sample or a copy of + the original sound. After analysis, choose a new style and generate normally.
+Checking SheetSage2…
+ + +''', +) + +replace_once( + app_js, + ''' $("coverStatus").textContent = takes.length + ? takes.length + " takes carry a score you can remix." + : "Make a song in Full plan or Melody only mode first; Direct mode keeps no score."; + }).catch(function () {}); +''', + ''' $("coverStatus").textContent = takes.length + ? takes.length + " takes carry a score you can remix." + : "Make a song in Full plan or Melody only mode first; Direct mode keeps no score."; + var sheetsage = data.sheetsage || {}; + $("coverFromAudio").disabled = !sheetsage.available; + $("coverAudioStatus").textContent = sheetsage.available + ? "SheetSage2 is ready. Analysis temporarily parks YuE2 because both use the GPU." + : "SheetSage2 is not installed yet; uploaded-audio remix is unavailable."; + }).catch(function (error) { + $("coverFromAudio").disabled = true; + $("coverAudioStatus").textContent = error.message; + }); +''', +) + +replace_once( + app_js, + ''' /* -------------------------------------------------------------- compose */ +''', + ''' $("coverFromAudio").addEventListener("click", function () { + var file = $("coverAudio").files[0]; + if (!file) return toast("Choose an audio file first", "bad"); + var button = $("coverFromAudio"); + var body = new FormData(); + body.append("file", file, file.name); + body.append("melody_only", $("coverAudioMelodyOnly").checked ? "true" : "false"); + button.disabled = true; + button.textContent = "Analysing…"; + $("coverAudioStatus").textContent = "Listening to “" + file.name + "”… this can take several minutes."; + api("/api/cover/from-audio", { method: "POST", body: body }).then(function (data) { + applyCoverScore(data.abc, "Melody analysed from “" + data.source + "” in " + data.seconds + " s. Choose the new style and generate."); + if (!data.melody_only) { var full = document.querySelector('input[name="cot"][value="full"]'); if (full) { full.checked = true; full.dispatchEvent(new Event("change", {bubbles:true})); } } + $("coverAudioStatus").textContent = "Analysis complete in " + data.seconds + " s. The editable score is loaded below."; + }).catch(function (error) { + $("coverAudioStatus").textContent = error.message; + toast(error.message, "bad"); + }).then(function () { + button.textContent = "Analyse uploaded melody"; + refreshCover(); + }); + }); + + /* -------------------------------------------------------------- compose */ +''', +) diff --git a/deploy/ladypoly/test_bridge.py b/deploy/ladypoly/test_bridge.py index e129fa8..2be9419 100644 --- a/deploy/ladypoly/test_bridge.py +++ b/deploy/ladypoly/test_bridge.py @@ -21,10 +21,20 @@ class BridgeTest(unittest.TestCase): self.assertEqual(payload['max_tokens'],9000);self.assertNotIn('abc',payload) saved=result.save_artifacts(root/'take');self.assertEqual(saved['audio_seconds'],1) self.assertTrue((root/'take/audio.flac').is_file()) - def test_unsupported_score_does_not_start_deck(self): + def test_unsupported_sampling_does_not_start_deck(self): with patch.object(bridge,'request') as request: - with self.assertRaisesRegex(RuntimeError,'Score'): - server.render_gguf(None,{'abc':'synthetic'}) + with self.assertRaisesRegex(RuntimeError,'Sampling'): + server.render_gguf(None,{'cfg_scale':1}) request.assert_not_called() + def test_remix_score_forwarded_and_preserved_in_library(self): + with tempfile.TemporaryDirectory() as temp: + root=Path(temp);connection=root/'connection.json';connection.write_text(json.dumps({'model':'Synthetic Music','token':'synthetic'})) + raw=io.BytesIO() + with wave.open(raw,'wb') as wav:wav.setparams((1,2,48000,0,'NONE','none'));wav.writeframes(bytes(9600)) + job=SimpleNamespace(id='synthetic',cancel_flag=SimpleNamespace(is_set=lambda:False),push=lambda **k:None) + abc='X:1\nK:C\nC D E F|';spec=dict(style='pop',lyrics='test',seed=1,abc=abc,cot='melody') + with patch.object(bridge,'CONNECTION',connection),patch.object(server,'OUTPUTS',root),patch.object(bridge,'request',return_value=raw.getvalue()) as request: + result=server.render_gguf(job,spec);self.assertEqual(request.call_args.args[1]['abc'],abc);self.assertEqual(request.call_args.args[1]['cot'],'melody');result.save_artifacts(root/'take');self.assertEqual((root/'take/score.abc').read_text(),abc) + if __name__=='__main__':unittest.main() diff --git a/deploy/prepare_xvc.py b/deploy/prepare_xvc.py new file mode 100644 index 0000000..db289fa --- /dev/null +++ b/deploy/prepare_xvc.py @@ -0,0 +1,47 @@ +"""Prepare X-VC without starting services; merge its inactive profile only after Deck stops.""" +import json,os,secrets,subprocess,sys,time,uuid +from pathlib import Path +sys.path.insert(0,str(Path(__file__).resolve().parent.parent)) +from catalog import Catalog +from xvc_runtime import XVCRuntime + +def prepare(state): + state=Path(state).resolve();runtime=XVCRuntime(state/'xvc-runtime',None) + python,source=runtime.paths() + # The venv interpreter targets Deck's bundled Python, which lives inside its image. + if not (python.exists() or python.is_symlink()) or not (source/'models/codec/sac/model.py').is_file():raise ValueError('X-VC-Laufzeit zuerst installieren.') + ident=runtime.ensure_library();pending=state/'xvc-profile-pending.json' + if pending.exists(): + row=json.loads(pending.read_text()) + if row.get('model_id')!=ident or row.get('api_id')!='xvc-studio':raise ValueError('Abweichendes vorbereitetes X-VC-Profil prüfen.') + else: + row=dict(id=uuid.uuid4().hex,revision=1,name='X-VC Studio',api_id='xvc-studio',api_aliases=[],kind='voice',model_id=ident,parameters={},components={},presets=[],prompt_enhancer=None,updated_at=time.time()) + pending.write_text(json.dumps(row,indent=2));os.chown(pending,65534,65534) + root=state/'xvc-data';root.mkdir(parents=True,exist_ok=True);os.chown(root,65534,65534) + settings=root/'settings.json' + if not settings.exists():settings.write_text(json.dumps({'device':'5080'}));os.chown(settings,65534,65534) + key=root/'bridge-key' + if not key.exists():key.write_text(secrets.token_urlsafe(48));key.chmod(0o600);os.chown(key,65534,65534) + name='athena-xvc-web';found=subprocess.run(['docker','inspect',name],capture_output=True,text=True) + if found.returncode==0: + row=json.loads(found.stdout)[0];labels=row['Config'].get('Labels') or {} + if labels.get('io.athena-deck.managed')!='true' or labels.get('io.athena-deck.application')!='xvc-web':raise ValueError('Containername anderweitig belegt.') + if row['State']['Running']:raise ValueError('Vorhandene X-VC-UI läuft bereits; Vorbereitung verändert sie nicht.') + else: + subprocess.run(['docker','create','--name',name,'--network','host','--restart','unless-stopped','--label','io.athena-deck.managed=true','--label','io.athena-deck.role=application','--label','io.athena-deck.application=xvc-web','--read-only','--cap-drop','ALL','--security-opt','no-new-privileges:true','--pids-limit','128','--memory','512m','--cpus','1','--tmpfs','/tmp:rw,noexec,nosuid,size=128m,uid=65534,gid=65534','--mount','type=bind,src='+str(key)+',dst=/run/secrets/xvc-bridge,readonly','athena-xvc-web:0.1.0-deck1'],check=True,stdout=subprocess.DEVNULL) + print('X-VC: inaktives Profil vorbereitet, UI-Container gestoppt. Keine Endpunktfreigabe geändert.') + +def apply_profile(state,deck='athena-deck-dev'): + from profiles import Profiles + result=subprocess.run(['docker','inspect',deck],capture_output=True,text=True,check=True) + if json.loads(result.stdout)[0]['State']['Running']:raise ValueError('Deck läuft: Profil erst im späteren Wartungsfenster übernehmen.') + state=Path(state);row=json.loads((state/'xvc-profile-pending.json').read_text());profiles=Profiles(state/'profiles.json',Catalog(state/'models')) + existing=next((p for p in profiles.rows if p.get('api_id')==row['api_id']),None) + if existing: + if existing['model_id']!=row['model_id']:raise ValueError('X-VC API-ID bereits anders belegt.') + else:profiles.save(dict(id=None,revision=0,name=row['name'],api_id=row['api_id'],kind='voice',model_id=row['model_id'],parameters={})) + os.chown(state/'profiles.json',65534,65534) + print('Inaktives X-VC-Profil übernommen; Betriebsart und Freigaben unverändert.') +if __name__=='__main__': + if '--apply-profile' in sys.argv:apply_profile(sys.argv[1]) + else:prepare(sys.argv[1]) diff --git a/deploy/separator-web/app.py b/deploy/separator-web/app.py index d6d951c..82283cc 100644 --- a/deploy/separator-web/app.py +++ b/deploy/separator-web/app.py @@ -6,11 +6,11 @@ from email import policy from email.parser import BytesParser BASE='http://127.0.0.1:8108' CONFIG=Path('/data/deck-connection.json') -TARGETS={'vocals':'model_bs_roformer_ep_317_sdr_12.9755.ckpt','drums':'htdemucs_ft.yaml','bass':'htdemucs_ft.yaml','guitar':'htdemucs_6s.yaml','piano':'htdemucs_6s.yaml','other':'htdemucs_6s.yaml'} +TARGETS={'vocals':'model_bs_roformer_ep_317_sdr_12.9755.ckpt','drums':'htdemucs_ft.yaml','bass':'htdemucs_ft.yaml','guitar':'htdemucs_6s.yaml','piano':'htdemucs_6s.yaml','other':'htdemucs_6s.yaml','speech':'MossFormer2_SE_48K'} def archive_name(target,filename): if target not in TARGETS:raise ValueError('Unbekannte Zielspur.') - if Path(filename).name=='rest.wav':return 'Instrumental.wav' if target=='vocals' else 'Rest.wav' - return {'vocals':'Vocals','drums':'Drums','bass':'Bass','guitar':'Guitar','piano':'Piano','other':'Other'}[target]+'.wav' + if Path(filename).name=='rest.wav':return 'Instrumental.wav' if target=='vocals' else 'Background.wav' if target=='speech' else 'Rest.wav' + return {'vocals':'Vocals','drums':'Drums','bass':'Bass','guitar':'Guitar','piano':'Piano','other':'Other','speech':'Speech'}[target]+'.wav' def request(path,body=None,ctype='application/json',token=None): if token is None:token=json.loads(CONFIG.read_text())['token'] if CONFIG.exists() else '' if not token:raise ValueError('Zuerst die Deck-Verbindung einrichten.') diff --git a/deploy/separator-web/index.html b/deploy/separator-web/index.html index d31aab4..f6ff82e 100644 --- a/deploy/separator-web/index.html +++ b/deploy/separator-web/index.html @@ -10,6 +10,7 @@ + diff --git a/deploy/setup_docker_helper.py b/deploy/setup_docker_helper.py index 6cbb6d5..f770402 100644 --- a/deploy/setup_docker_helper.py +++ b/deploy/setup_docker_helper.py @@ -26,7 +26,7 @@ def main(): for name in ('Dockerfile','patch-source.py','proxy.py','entrypoint.py'): shutil.copyfile(Path(__file__).parent/'swarm-ui'/name,base/'swarm-ui'/name) (base/'ladypoly').mkdir(exist_ok=True) - for name in ('Dockerfile','bridge.py'): + for name in ('Dockerfile','bridge.py','patch_remix.py'): shutil.copyfile(Path(__file__).parent/'ladypoly'/name,base/'ladypoly'/name) (base/'separator-web').mkdir(exist_ok=True) for name in ('Dockerfile','app.py','index.html'): @@ -34,6 +34,7 @@ def main(): (base/'acestep-web').mkdir(exist_ok=True) for name in ('Dockerfile','app.py','index.html'): shutil.copyfile(Path(__file__).parent/'acestep-web'/name,base/'acestep-web'/name) + shutil.copytree(Path(__file__).parent/'xvc-web',base/'xvc-web',dirs_exist_ok=True,ignore=shutil.ignore_patterns('__pycache__')) shutil.copytree(Path(__file__).parent/'applio-web',base/'applio-web',dirs_exist_ok=True,ignore=shutil.ignore_patterns('__pycache__')) (base/'voice-web').mkdir(exist_ok=True) for name in ('Dockerfile','base.Dockerfile','bridge.py'): diff --git a/deploy/xvc-requirements.lock b/deploy/xvc-requirements.lock new file mode 100644 index 0000000..7dea764 --- /dev/null +++ b/deploy/xvc-requirements.lock @@ -0,0 +1,152 @@ +absl-py==2.5.0 +aiofiles==24.1.0 +annotated-doc==0.0.5 +annotated-types==0.8.0 +antlr4-python3-runtime==4.9.3 +anyio==4.15.1 +argbind==0.3.9 +asttokens==3.0.2 +audioread==3.1.0 +brotli==1.2.0 +certifi==2026.7.22 +cffi==2.1.1 +charset-normalizer==3.5.2 +click==8.5.0 +cloudpickle==3.1.2 +contourpy==1.3.3 +cycler==0.12.1 +decorator==5.3.1 +descript-audiotools==0.7.2 +docstring_parser==0.18.0 +einops==0.8.2 +einx==0.4.3 +executing==2.2.1 +fastapi==0.142.2 +ffmpy==1.0.0 +filelock==3.32.3 +fire==0.7.1 +flatten-dict==0.5.0 +fonttools==4.66.1 +frozendict==2.4.7 +fsspec==2026.7.0 +gradio==5.49.1 +gradio_client==1.13.3 +groovy==0.1.2 +grpcio==1.84.0 +h11==0.16.0 +hf-xet==1.6.0 +httpcore==1.0.9 +httpx==0.28.1 +huggingface_hub==0.36.2 +hydra-core==1.3.7 +idna==3.20 +importlib_resources==7.1.0 +ipython==9.17.1 +ipython_pygments_lexers==1.1.1 +jedi==0.20.0 +Jinja2==3.1.6 +joblib==1.6.0 +julius==0.2.8 +kiwisolver==1.5.1 +lazy-loader==0.6 +librosa==0.10.1 +llvmlite==0.50.0 +loguru==0.7.3 +Markdown==3.11 +markdown-it-py==4.2.0 +markdown2==2.5.5 +MarkupSafe==3.0.3 +matplotlib==3.11.2 +matplotlib-inline==0.2.2 +mdurl==0.1.2 +mpmath==1.3.0 +msgpack==1.2.3 +narwhals==2.26.0 +networkx==3.6.1 +numba==0.68.0 +numpy==1.26.4 +nvidia-cublas-cu12==12.8.4.1 +nvidia-cuda-cupti-cu12==12.8.90 +nvidia-cuda-nvrtc-cu12==12.8.93 +nvidia-cuda-runtime-cu12==12.8.90 +nvidia-cudnn-cu12==9.10.2.21 +nvidia-cufft-cu12==11.3.3.83 +nvidia-cufile-cu12==1.13.1.3 +nvidia-curand-cu12==10.3.9.90 +nvidia-cusolver-cu12==11.7.3.90 +nvidia-cusparse-cu12==12.5.8.93 +nvidia-cusparselt-cu12==0.7.1 +nvidia-nccl-cu12==2.27.3 +nvidia-nvjitlink-cu12==12.8.93 +nvidia-nvtx-cu12==12.8.90 +omegaconf==2.3.1 +opentelemetry-api==1.45.0 +orjson==3.12.0 +packaging==26.3 +pandas==2.3.3 +parso==0.8.7 +pexpect==4.9.0 +pillow==11.3.0 +platformdirs==4.12.3 +pooch==1.9.0 +prompt_toolkit==3.0.53 +protobuf==3.19.6 +psutil==7.2.2 +ptyprocess==0.7.0 +pure_eval==0.2.4 +pycparser==3.0 +pydantic==2.11.10 +pydantic_core==2.33.2 +pydub==0.25.1 +Pygments==2.21.0 +pyloudnorm==0.2.0 +pyparsing==3.3.3 +pystoi==0.4.1 +python-dateutil==2.9.0.post0 +python-multipart==0.0.32 +pytz==2026.5 +PyYAML==6.0.3 +randomname==0.2.1 +regex==2026.9.29 +requests==2.34.2 +resemble-enhance==0.0.1 +rich==14.3.4 +ruff==0.16.10 +safehttpx==0.1.7 +safetensors==0.8.0 +scikit-learn==1.9.1 +scipy==1.11.4 +semantic-version==2.10.0 +setuptools==78.1.0 +shellingham==1.5.4 +six==1.17.0 +soundfile==0.12.1 +soxr==0.5.0.post1 +stack-data==0.6.3 +starlette==0.52.1 +sympy==1.14.0 +tabulate==0.10.0 +tensorboard==2.20.0 +tensorboard-data-server==0.7.2 +termcolor==3.3.0 +threadpoolctl==3.7.0 +tokenizers==0.22.2 +tomlkit==0.13.3 +torch==2.8.0+cu128 +torch-einops-utils==0.1.35 +torch-stoi==0.2.3 +torchaudio==2.8.0+cu128 +tqdm==4.70.1 +traitlets==5.16.1 +transformers==4.57.6 +triton==3.4.0 +typer==0.27.2 +typing-inspection==0.4.4 +typing_extensions==4.16.0 +tzdata==2026.5 +urllib3==2.8.0 +uvicorn==0.54.0 +wcwidth==0.9.2 +websockets==15.0.1 +Werkzeug==3.1.9 +x-transformers==2.31.6 diff --git a/deploy/xvc-web/Dockerfile b/deploy/xvc-web/Dockerfile new file mode 100644 index 0000000..7262729 --- /dev/null +++ b/deploy/xvc-web/Dockerfile @@ -0,0 +1,6 @@ +FROM python:3.12-slim-bookworm +RUN pip install --no-cache-dir fastapi==0.115.12 uvicorn==0.34.2 httpx==0.28.1 +WORKDIR /ui +COPY proxy.py ./ +USER 65534:65534 +CMD ["python","-m","uvicorn","proxy:app","--host","127.0.0.1","--port","8133","--no-access-log"] diff --git a/deploy/xvc-web/inference_log.py b/deploy/xvc-web/inference_log.py new file mode 100644 index 0000000..af4a2d9 --- /dev/null +++ b/deploy/xvc-web/inference_log.py @@ -0,0 +1,29 @@ +"""Small inference-only replacement for X-VC's training logger. + +The upstream logger imports WandB, Matplotlib and TensorBoard at module import +time although model inference only uses the normal logging functions. +""" + +import logging + + +logging.basicConfig(level=logging.INFO) +_logger = logging.getLogger("xvc") + +debug = _logger.debug +info = _logger.info +warn = _logger.warning +warning = _logger.warning +error = _logger.error + + +def init(*_args, **_kwargs): + return None + + +def write_audio(*_args, **_kwargs): + return None + + +def write_loss(*_args, **_kwargs): + return None diff --git a/deploy/xvc-web/native_ui.py b/deploy/xvc-web/native_ui.py new file mode 100644 index 0000000..991b73e --- /dev/null +++ b/deploy/xvc-web/native_ui.py @@ -0,0 +1,264 @@ +"""Local Athena adaptation of the public X-VC Gradio demo.""" + +import contextlib,json,socket,threading +import logging +import os +import sys +import tempfile +import time +from pathlib import Path +from typing import Tuple + +import gradio as gr +import numpy as np +import soundfile as sf +import torch +from omegaconf import OmegaConf + +HERE = os.environ["XVC_SOURCE"] +ASSETS = Path(os.environ["XVC_ASSETS"]) +sys.path.insert(0, HERE) + +from bins.infer_utils import precompute_conditions, run_offline, run_streaming, to_numpy_audio +from models.codec.sac.model import XVC +from utils.audio import audio_highpass_filter, audio_volume_normalize, load_audio + +logging.basicConfig(level=logging.INFO) +log = logging.getLogger("xvc-local") + +MODEL_REPO = "chenxie95/X-VC" +SPACE_REPO = "hugging-apps/x-vc-voice-conversion" +SPEAKER_SUBDIR = "pretrained/speech_eres2net_sv_en_voxceleb_16k" +SAMPLE_RATE = 16000 +ENHANCED_SAMPLE_RATE = 44100 +LATENT_HOP_LENGTH = 1280 +MAX_SECONDS = 20.0 +RESEMBLE_REVISION = "4e3510ce4a8391159f665903544c5150bee7b2cb" +RESEMBLE_RUN_DIR = ASSETS / "enhance/enhancer_stage2" +MODE_OFFLINE = "Offline (höchste Qualität)" +MODE_STREAMING = "Streaming (simulierte Echtzeit)" + + +def _load_model() -> XVC: + speaker_config = ASSETS / "space" / SPEAKER_SUBDIR / "configuration.json" + checkpoint = ASSETS / "model/xvc.pt" + + cfg = OmegaConf.load(os.path.join(HERE, "configs", "xvc.yaml")) + cfg["model"]["generator"].pop("loss_config", None) + cfg["model"].pop("discriminator", None) + cfg["model"]["generator"]["speaker_encoder"]["pretrained_dir"] = os.path.dirname(speaker_config) + for node in (cfg["model"]["generator"]["semantic_encoder"]["encoder"]["from_pretrained"], cfg["model"]["generator"]["semantic_encoder"]["cfg"]): + node["local_ckpt"] = str(ASSETS / "tokenizer") + infer_cfg = os.path.join(tempfile.gettempdir(), "xvc_inference.yaml") + OmegaConf.save(cfg, infer_cfg) + + loaded = XVC.load_from_checkpoint(infer_cfg, checkpoint, device=torch.device("cuda")) + loaded.remove_weight_norm() + loaded = loaded.eval().to("cuda") + log.info("X-VC model ready on %s", torch.cuda.get_device_name(0)) + return loaded + + +MODEL = None +LOCK = threading.Lock() + + +def _prepare_wav(path: str) -> np.ndarray: + wav = load_audio(path, sampling_rate=SAMPLE_RATE, volume_normalize=False) + if wav is None or len(wav) == 0: + raise gr.Error("Die Audiodatei konnte nicht gelesen werden.") + wav = wav[: int(MAX_SECONDS * SAMPLE_RATE)] + wav = audio_volume_normalize(wav) + wav = audio_highpass_filter(wav, SAMPLE_RATE, 40) + remainder = len(wav) % LATENT_HOP_LENGTH + if remainder: + wav = np.pad(wav, (0, LATENT_HOP_LENGTH - remainder), mode="constant") + return wav.astype(np.float32) + + +def _tensor(wav: np.ndarray) -> torch.Tensor: + return torch.from_numpy(wav).unsqueeze(0).unsqueeze(1).float().to("cuda") + + +def _write_wav(audio: np.ndarray, sample_rate: int = SAMPLE_RATE, suffix: str = "native-16k") -> str: + output = os.environ["XVC_OUTPUT"] + os.makedirs(output, exist_ok=True) + path = os.path.join(output, f"xvc-{suffix}-{int(time.time() * 1000)}.wav") + sf.write(path, np.clip(np.asarray(audio, dtype=np.float32), -1.0, 1.0), sample_rate, subtype="PCM_16") + return path + + +@torch.inference_mode() +def _enhance_wav(audio: np.ndarray) -> tuple[str, float]: + if not (RESEMBLE_RUN_DIR / "hparams.yaml").is_file(): + raise gr.Error("Resemble-Enhance-Gewichte fehlen; X-VC-Laufzeit unter Laufzeiten prüfen.") + + from resemble_enhance.enhancer.inference import enhance + + started = time.time() + source = torch.from_numpy(np.asarray(audio, dtype=np.float32).reshape(-1)) + restored, sample_rate = enhance( + source, + SAMPLE_RATE, + "cuda", + nfe=32, + solver="midpoint", + lambd=0.1, + tau=0.5, + run_dir=RESEMBLE_RUN_DIR, + ) + if int(sample_rate) != ENHANCED_SAMPLE_RATE: + raise RuntimeError(f"Unerwartete Resemble-Enhance-Abtastrate: {sample_rate}") + return _write_wav(restored.cpu().numpy(), int(sample_rate), "enhanced-44k1"), time.time() - started + + +@torch.inference_mode() +def _convert( + source_audio: str, + reference_audio: str, + enhance_44k1: bool = True, + mode: str = MODE_OFFLINE, + chunk_ms: int = 2400, + current_ms: int = 120, + future_ms: int = 100, + smooth_ms: int = 20, + progress=gr.Progress(track_tqdm=True), +) -> Tuple[str, str | None, str]: + if not source_audio: + raise gr.Error("Bitte eine Quelldatei mit dem zu erhaltenden Inhalt hochladen.") + if not reference_audio: + raise gr.Error("Bitte eine Referenzdatei mit der Zielstimme hochladen.") + + source_np = _prepare_wav(source_audio) + reference_np = _prepare_wav(reference_audio) + source_wav = _tensor(source_np) + target_wav = _tensor(reference_np) + seconds = len(source_np) / SAMPLE_RATE + started = time.time() + + if mode == MODE_STREAMING: + history_ms = int(chunk_ms) - int(current_ms) - int(smooth_ms) - int(future_ms) + if history_ms < 0: + raise gr.Error("Fenster muss mindestens Current + Lookahead + Crossfade umfassen.") + speaker_condition, frame_condition = precompute_conditions(MODEL, target_wav, target_wav) + recon, latency_ms = run_streaming( + model=MODEL, + source_wav=source_wav, + speaker_condition=speaker_condition, + frame_condition=frame_condition, + sample_rate=SAMPLE_RATE, + chunk_ms=int(chunk_ms), + current_ms=int(current_ms), + future_ms=int(future_ms), + smooth_ms=int(smooth_ms), + ) + elapsed = time.time() - started + latency = np.asarray(latency_ms, dtype=np.float64) + report = ( + f"**Streaming** · {len(latency)} Chunks · Mittel **{latency.mean():.0f} ms**, " + f"P95 **{np.percentile(latency, 95):.0f} ms** · insgesamt {elapsed:.2f} s " + f"für {seconds:.2f} s Audio (RTF {elapsed / seconds:.2f})" + ) + else: + recon = run_offline(MODEL, source_wav, target_wav, target_wav) + elapsed = time.time() - started + report = ( + f"**Offline** · {seconds:.2f} s Audio in {elapsed:.2f} s " + f"(RTF {elapsed / seconds:.2f})" + ) + + recon_np = to_numpy_audio(recon) + native_path = _write_wav(recon_np) + enhanced_path = None + if enhance_44k1: + del source_wav, target_wav, recon + torch.cuda.empty_cache() + enhanced_path, enhancement_seconds = _enhance_wav(recon_np) + report += ( + f" · Resemble Enhance **{enhancement_seconds:.2f} s**, " + f"Ausgabe **44,1 kHz** (rekonstruierte Bandbreite)" + ) + return native_path, enhanced_path, report + + +def convert(source_audio: str, reference_audio: str, enhance_44k1: bool = True, mode: str = MODE_OFFLINE, chunk_ms: int = 2400, current_ms: int = 120, future_ms: int = 100, smooth_ms: int = 20, progress=gr.Progress(track_tqdm=True)): + global MODEL + with LOCK: + connection = socket.socket(socket.AF_UNIX) + try: + connection.connect(os.environ["XVC_LEASE_SOCKET"]) + connection.sendall(b'{"action":"reserve"}\n') + with connection.makefile("rb") as stream: + reply = json.loads(stream.readline(8193)) + if not reply.get("ok"): + raise gr.Error(reply.get("error", "Deck-Ressourcen nicht verfügbar.")) + if reply["gpu"] != os.environ["CUDA_VISIBLE_DEVICES"]: + raise gr.Error("GPU-Auswahl hat sich geändert; X-VC erneut öffnen.") + if MODEL is None: + MODEL = _load_model() + return _convert(source_audio, reference_audio, enhance_44k1, mode, chunk_ms, current_ms, future_ms, smooth_ms, progress) + finally: + connection.close() + + +CSS = "#col-container { max-width: 1100px; margin: 0 auto; }" +HEADER = """# X-VC — Voice Changer + +Die **Quelle** liefert Text, Aussprache und Timing. Die **Referenz** liefert die +Zielstimme. X-VC arbeitet Audio-zu-Audio ohne Transkript oder Training. + +[Paper](https://arxiv.org/abs/2604.12456) · [Modell](https://huggingface.co/chenxie95/X-VC) · +[Code](https://github.com/Jerrister/X-VC) +""" + +with gr.Blocks(title="X-VC Voice Changer", theme=gr.themes.Citrus(), css=CSS) as demo: + with gr.Column(elem_id="col-container"): + gr.Markdown(HEADER) + with gr.Row(): + source = gr.Audio(label="Quelle — Inhalt und Sprechweise", type="filepath", sources=["upload", "microphone"]) + reference = gr.Audio(label="Referenz — gewünschte Zielstimme", type="filepath", sources=["upload", "microphone"]) + run = gr.Button("Stimme umwandeln", variant="primary") + enhance_44k1 = gr.Checkbox( + value=True, + label="Zusätzlich mit Resemble Enhance auf 44,1 kHz restaurieren", + info="Rekonstruiert fehlende Höhen per KI; das native 16-kHz-Ergebnis bleibt zum Vergleich erhalten.", + ) + with gr.Row(): + output_native = gr.Audio(label="X-VC Original · 16 kHz", type="filepath", autoplay=False) + output_enhanced = gr.Audio(label="Enhanced · 44,1 kHz", type="filepath", autoplay=False) + report = gr.Markdown() + with gr.Accordion("Erweiterte Einstellungen", open=False): + mode = gr.Radio([MODE_OFFLINE, MODE_STREAMING], value=MODE_OFFLINE, label="Verarbeitungsmodus") + with gr.Row(): + current_ms = gr.Slider(40, 640, value=120, step=40, label="Aktueller Chunk (ms)") + chunk_ms = gr.Slider(800, 4800, value=2400, step=200, label="Gesamtfenster (ms)") + with gr.Row(): + future_ms = gr.Slider(0, 400, value=100, step=20, label="Lookahead (ms)") + smooth_ms = gr.Slider(0, 100, value=20, step=10, label="Crossfade (ms)") + gr.Markdown( + "Die ersten 20 Sekunden jeder Datei werden verarbeitet. X-VC bleibt nativ bei 16 kHz; " + "die optionale zweite Datei rekonstruiert die Sprachbandbreite auf 44,1 kHz." + ) + run.click( + convert, + inputs=[source, reference, enhance_44k1, mode, chunk_ms, current_ms, future_ms, smooth_ms], + outputs=[output_native, output_enhanced, report], + api_name="convert", + ) + +if __name__ == "__main__": + import secrets + import uvicorn + from fastapi import FastAPI, Request + from fastapi.responses import JSONResponse + app = FastAPI() + @app.middleware("http") + async def protect(request: Request, call_next): + key = Path(os.environ["XVC_BRIDGE_KEY_FILE"]).read_text().strip() + if not secrets.compare_digest(request.headers.get("X-XVC-Bridge", ""), key): + return JSONResponse({"detail": "Deck-Brücke erforderlich."}, status_code=403) + return await call_next(request) + @app.get("/health") + def health():return {"status": "ready", "model_loaded": MODEL is not None} + app = gr.mount_gradio_app(app, demo.queue(default_concurrency_limit=1), path="/", allowed_paths=[os.environ["XVC_OUTPUT"]]) + uvicorn.run(app, host="0.0.0.0", port=8135, access_log=False) diff --git a/deploy/xvc-web/patch_resemble_enhance.py b/deploy/xvc-web/patch_resemble_enhance.py new file mode 100644 index 0000000..7701d4c --- /dev/null +++ b/deploy/xvc-web/patch_resemble_enhance.py @@ -0,0 +1,40 @@ +"""Remove training-only imports from Resemble Enhance's inference path.""" + +from pathlib import Path + +import resemble_enhance + + +root = Path(resemble_enhance.__file__).parent + +replacements = { + root / "enhancer" / "inference.py": { + "from .train import Enhancer, HParams": ( + "from .enhancer import Enhancer\nfrom .hparams import HParams" + ), + }, + root / "denoiser" / "inference.py": { + "from .train import Denoiser, HParams": ( + "from .denoiser import Denoiser\nfrom .hparams import HParams" + ), + }, + root / "enhancer" / "enhancer.py": { + "from ..utils.distributed import global_leader_only\n" + "from ..utils.train_loop import TrainLoop": ( + "def global_leader_only(fn):\n" + " return fn\n\n" + "class TrainLoop:\n" + " @classmethod\n" + " def get_running_loop(cls):\n" + " return None" + ), + }, +} + +for path, edits in replacements.items(): + text = path.read_text(encoding="utf-8") + for old, new in edits.items(): + if old not in text: + raise RuntimeError(f"Expected Resemble Enhance source not found in {path}: {old!r}") + text = text.replace(old, new, 1) + path.write_text(text, encoding="utf-8") diff --git a/deploy/xvc-web/proxy.py b/deploy/xvc-web/proxy.py new file mode 100644 index 0000000..e5926f3 --- /dev/null +++ b/deploy/xvc-web/proxy.py @@ -0,0 +1,24 @@ +"""CPU-only forwarding UI; the native Deck backend owns model and GPU access.""" +from pathlib import Path +import httpx +from fastapi import FastAPI,Request +from fastapi.responses import JSONResponse,StreamingResponse +from starlette.background import BackgroundTask +app=FastAPI();KEY=Path('/run/secrets/xvc-bridge') +@app.api_route('/{path:path}',methods=['GET','POST','PUT','DELETE','PATCH','HEAD','OPTIONS']) +async def proxy(path:str,request:Request): + if request.method not in ('GET','HEAD','OPTIONS'): + origin=request.headers.get('origin','');host=request.headers.get('host','') + if origin.split('://',1)[-1]!=host and request.headers.get('X-XVC-UI')!='1':return JSONResponse({'detail':'Same-origin control required.'},status_code=403) + if int(request.headers.get('content-length','0'))>512*1024**2:return JSONResponse({'detail':'Upload zu groß.'},status_code=413) + client=httpx.AsyncClient(timeout=180) + try: + headers={'X-XVC-Bridge':KEY.read_text().strip(),'Host':request.headers.get('host','127.0.0.1:8133')} + if request.headers.get('content-type'):headers['Content-Type']=request.headers['content-type'] + req=client.build_request(request.method,'http://127.0.0.1:8135/'+path,params=request.query_params,headers=headers,content=request.stream()) + response=await client.send(req,stream=True) + async def close():await response.aclose();await client.aclose() + safe={k:v for k,v in response.headers.items() if k in ('content-type','content-length','location','content-disposition')};safe['Cache-Control']='no-store' + return StreamingResponse(response.aiter_raw(),status_code=response.status_code,headers=safe,background=BackgroundTask(close)) + except (OSError,httpx.HTTPError): + await client.aclose();return JSONResponse({'detail':'X-VC ist vorbereitet, aber noch nicht gestartet. In Deck ein X-VC-Profil aktivieren und Stimmwerkzeuge starten.'},status_code=503) diff --git a/docker-ui.js b/docker-ui.js index 36d860b..1bf9ef2 100644 --- a/docker-ui.js +++ b/docker-ui.js @@ -3,6 +3,7 @@ window.DockerUI=(()=>{ const apps={ 'athena-voxcpm2-web':{title:'VoxCPM2 Studio',description:'Stimme erzeugen, gestalten und klonen; Ausführung über Decks Stimmworker.',port:8129,hint:'VoxCPM2-Profil in Deck aktivieren und Stimmwerkzeuge starten.'}, 'athena-omnivoice-web':{title:'OmniVoice Studio',description:'Bisherige OmniVoice-Weboberfläche; GPU-Aufträge laufen über Deck.',port:8130,hint:'OmniVoice-Profil in Deck aktivieren und Stimmwerkzeuge starten. Beim Klonen Referenztranskript eingeben.'}, + 'athena-xvc-web':{title:'X-VC Studio',description:'Vorhandene Sprachaufnahme in eine Referenzstimme umwandeln; optional Klang mit Resemble Enhance verbessern. Native Ausführung durch Deck.',port:8133,hint:'X-VC-Profil aktivieren und Stimmwerkzeuge starten; GPU unter Laufzeiten → X-VC einstellen.'}, 'athena-applio-web':{title:'Applio Studio',description:'Unsere eigene Oberfläche für RVC-Stimmumwandlung, Live und eigenes Stimmtraining. Native Applio-3.6.5-Laufzeit in Deck.',port:8132,hint:'Applio-Profil aktivieren und Stimmwerkzeuge starten; GPU unter Laufzeiten → Applio einstellen.'}, 'athena-acestep-web':{title:'ACE-Step Studio',description:'Musik und Songs mit ACE-Step XL-SFT und dem 1.7B-Musik-Sprachmodell; Ausführung und Gewichte in Deck.',port:8131,hint:'ACE-Step-Profil freigeben und in der Steuerung Musik starten.'}, 'athena-ladypoly':{title:'LadyPoly YuE2',description:'Weboberfläche für Decks Musiklaufzeit.',port:8127,hint:'In der Steuerung Musik starten. Deck-Verbindung in LadyPoly einrichten.'}, diff --git a/docs/AUDIO_REMIX_CLEARVOICE.md b/docs/AUDIO_REMIX_CLEARVOICE.md new file mode 100644 index 0000000..785d37d --- /dev/null +++ b/docs/AUDIO_REMIX_CLEARVOICE.md @@ -0,0 +1,55 @@ +# YuE2 Audio Remix und ClearVoice + +YuE2 Audio Remix nutzt die vorhandene LadyPoly-UI und den vorhandenen +YuE2-audio.cpp-Worker. Kein zusätzlicher UI-/GPU-Container ist notwendig. + +## Audio Remix + +- SheetSage2: `m-a-p/SheetSage2`, Revision + `eab522a8168e8b8b8c4856bf8609cd86198f01fe`. +- Backbone: `m-a-p/MERT-v2-FullSong`, Revision + `d8ba1c745e733b3908ce6ad16ebeb17ac7600a42`. +- Quellen und SHA-256 aller Dateien: `remix_sources.json`. +- Eigene Python-Umgebung mit Transformers 4.45.2; CUDA-Pakete aus der + Separator-Laufzeit werden gezielt geteilt. Fehlt diese, installiert der + Restore eine eigene CUDA-PyTorch-Laufzeit. +- In Deck unter Musik: „YuE2 Audio Remix“. In LadyPoly: „Remix a take“ → + „Remix an uploaded recording“. Analyse lädt MERT/SheetSage2 auf die 5080, + nachdem Deck die exklusive Musik-Freigabe erteilt und YuE2 entladen hat. +- Bei einem Notenrasterfehler an einer harten Aufnahmegrenze wird nur die + Analyse einmal mit zwei Sekunden stillem Ausklang wiederholt. Die Originaldatei + bleibt unverändert; der Musikplan kann entsprechend eine Schluss-Pause enthalten. +- Den erstellten ABC-Musikplan prüfen/bearbeiten; Modus `melody` für neue + Begleitung oder `full` für Melodie und Harmonie. Danach Stil und Songtext + eingeben und generieren. YuE2 bleibt zwischen Generierungen geladen. +- Analyse rekonstruiert musikalische Struktur; sie erhält weder exakt den + ursprünglichen Klang noch die Originalstimme. +- WAV/FLAC/MP3 und andere FFmpeg-lesbare Formate, maximal 256 MiB/20 Minuten. + Hochgeladenes Audio und Zwischenresultate werden nach der Analyse gelöscht. +- Bearer-geschützter Upload: POST `/api/v1/music-remix/transcribe` mit + Multipart `file`, optional `melody_only=true|false`. Status: + GET `/api/v1/music-remix`. Installation verlangt Deck-Adminzugriff. +- Musik-Endpunkt `/v1/audio/music`: zusätzlich `abc` und `cot=melody|full`. + ACE-Step bleibt ein unabhängiger Adapter und akzeptiert diese Felder nicht. + +## ClearVoice + +- Modell: `alibabasglab/MossFormer2_SE_48K`, Revision + `eff8c97925c8bec812af707814b3e5d777fd4503`. +- Paket: `clearvoice==0.1.2`, separate NumPy-1.26.4-Umgebung. Der bestehende + audio-separator behält seine eigenen NumPy-/RoFormer-Abhängigkeiten. +- In Audio-Trennung ein eigenes Profil mit Aktivierung/GPU-Auswahl. + Auf Athena wird die RTX 3060 voreingestellt. Kein stiller GPU-/CPU-Fallback. +- In Separator Web „Sprache“ auswählen. ZIP: `Speech.wav` und + `Background.wav`. Hintergrund ist das Residuum der Originalaufnahme; + ClearVoice ist Sprachverbesserung, keine verlustfreie Quellentrennung. +- 48-kHz-Ausgabe, kanalweise Dateiverarbeitung für Mono/Stereo und lange + Aufnahmen. Damit wird die problematische direkte Array-Verarbeitung bei + Aufnahmen über 20 Sekunden vermieden. +- Modellquellen/Hashes, Profileinstellungen und Installationsrezepte werden + im Konfigurationsbackup gespeichert bzw. durch feste Deck-Rezepte + rekonstruiert. Medienresultate gehören nicht zum Konfigurationsbackup. + +Originaldokumentation: +https://huggingface.co/m-a-p/SheetSage2 +https://github.com/modelscope/ClearerVoice-Studio/tree/main/clearvoice diff --git a/docs/XVC.md b/docs/XVC.md new file mode 100644 index 0000000..974594a --- /dev/null +++ b/docs/XVC.md @@ -0,0 +1,61 @@ +# X-VC voice conversion + +Official source: https://github.com/Jerrister/X-VC at +`49df8c591eafc48b096e466d96f9839f9c0dd739`. +Official weights: https://huggingface.co/chenxie95/X-VC at +`9e54747d8c4d1ef544b903e2300a4ba040dcc126`. +`xvc_sources.json` pins all ten model, tokenizer, speaker-encoder and +Resemble Enhance assets, including size and upstream checksums. +The verified downloads total 7,206,037,113 bytes (6.71 GiB). +`deploy/xvc-requirements.lock` records the CPU-import-tested environment. +Resemble Enhance's training-only imports are removed, as in our old UI; +its old DeepSpeed/Torch dependency pins are intentionally not installed. + +## Architecture + +The previous X-VC Gradio interface is retained. It converts source audio to +a reference voice without training or a transcript. Native output is 16 kHz; +optional Resemble Enhance produces a second 44.1-kHz output. The previous UI's +20-second input limit is retained and displayed. Streaming mode is simulated +chunked conversion, not a live microphone session. + +`athena-xvc-web:0.1.0-deck1` is a rootless CPU-only forwarding container on +host loopback port 8133. It forwards Gradio uploads, queue events and results +to native Deck backend 8135 using a private bridge key. Backend 8135 must +never be added to public network relays. Add only 8133 to the native network +helper's service-port policy during the approved deployment. + +The native backend owns the GPU weights. No model is loaded on UI import or +startup. Conversion requires an enabled X-VC voice profile AND Deck's voice +mode, acquires the shared GPU lease, and checks the selected GPU UUID. +Weights stay resident between conversions; mode/profile/device changes +terminate the native process and restart the empty UI backend. Default GPU +is RTX 5080; RTX 3060 is selectable but not yet verified for conversion. + +## Prepared, not activated (2026-10-05) + +On Athena the isolated runtime and all assets are installed; the main library +entry points to its real Hugging Face source using a relative symlink. +The UI container exists in `created`/stopped state. The candidate profile is +`xvc-profile-pending.json`, named `X-VC Studio`, API ID `xvc-studio`. +The live profile list, endpoint activation, GPU mode and existing Deck image +have not been changed. No conversion, GPU test or UI server has been started. +CPU import passed with `MODEL is None` and no initialized CUDA context. + +After authorization, stop Deck and run `deploy/prepare_xvc.py STATE +--apply-profile` from the new full checkout. It refuses a running Deck and +merges only the single inactive profile into the current profile list. +Deploy the prepared application update (private port 8135 included), update +the helper recipes, relay public UI port 8133, and start the UI container. +Enable X-VC under voice profiles and select voice mode only when ready to test. +The GPU conversion test is deliberately pending until then. + +## Recovery + +The configuration backup stores X-VC GPU selection, inactive/active profile +state, original main-weight source, exact code/assets recipe identity and the +stopped/running UI container state. Restore reinstalls the native package, +redownloads every pinned component and verifies upstream checksums, then +rebuilds the CPU forwarding container. Bridge-key mounts have a specific +allowlist. Reference uploads and generated results are not configuration +backup content; archive those separately if needed. diff --git a/endpoint.py b/endpoint.py index cbc0b9c..c86c4c8 100644 --- a/endpoint.py +++ b/endpoint.py @@ -93,6 +93,7 @@ class Endpoint: if not row:raise ValueError('Profil nicht gefunden.') if data['enabled'] and not row['runnable']:raise ValueError('Profil nicht ausführbar: '+' '.join(row['blockers'])) if row['kind']=='voice' and getattr(self,'applio',None):self.applio.unload_idle() + if row['kind']=='voice' and getattr(self,'xvc',None):self.xvc.unload_idle() with self.lock: if row['kind']=='voice' and self.voxcpm: job=self.voxcpm.status().get('job') or {} @@ -170,7 +171,8 @@ class Endpoint: if not (p['enabled'] and p['runnable'] and p['kind']==kind):continue if kind=='voice': from applio import applio_model - if applio_model(p.get('model')):continue + from xvc import xvc_model + if applio_model(p.get('model')) or xvc_model(p.get('model')):continue row=dict(id='athena-image' if kind=='image' else p.get('api_id',p['name']),name=p['name'],display_name=p['name'],object='model',created=int(p['updated_at']),owned_by='athena-deck') if kind=='chat': params=p.get('parameters',{}) @@ -375,9 +377,9 @@ class APIHandler(BaseHTTPRequestHandler): def music_generation(self,ep,data): if ep.scheduler.gpu_mode!='music':raise APIError('Bitte in der Übersicht auf Musik umschalten.',503,'music_mode_required') if not ep.music:raise APIError('Musikworker nicht eingerichtet.',501) - if set(data)-{'model','lyrics','style','seed','max_tokens','steps','duration_seconds','guidance','thinking','instrumental','bpm','language'}:raise APIError('Nicht unterstützte Musikfelder.') + if set(data)-{'model','lyrics','style','seed','max_tokens','steps','duration_seconds','guidance','thinking','instrumental','bpm','language','abc','cot'}:raise APIError('Nicht unterstützte Musikfelder.') profile=ep.find_profile(data.get('model'),'music') - try:job=ep.music.start(profile['id'],data.get('lyrics',''),data.get('style'),seed=data.get('seed',1234),max_tokens=data.get('max_tokens',400),steps=data.get('steps'),wait=True,**{k:data[k] for k in ('duration_seconds','guidance','thinking','instrumental','bpm','language') if k in data}) + try:job=ep.music.start(profile['id'],data.get('lyrics',''),data.get('style'),seed=data.get('seed',1234),max_tokens=data.get('max_tokens',400),steps=data.get('steps'),wait=True,**{k:data[k] for k in ('duration_seconds','guidance','thinking','instrumental','bpm','language','abc','cot') if k in data}) except ValueError as exc:raise APIError(str(exc)) from None end=time.monotonic()+1850 while time.monotonic()YuE2 über audio.cpp oder ACE-Step XL-SFT mit 1.7B-Musik-Sprachmodell. Parameter richten sich nach dem gewählten Profil.
RTX 5080 bevorzugt. Deck-Aufträge werden koordiniert. Das gewählte Modell bleibt zwischen Songs geladen, bis du die Betriebsart wechselst. Text und Stil werden nicht dauerhaft gespeichert.
YuE2 über audio.cpp oder ACE-Step XL-SFT mit 1.7B-Musik-Sprachmodell. Parameter richten sich nach dem gewählten Profil.
RTX 5080 bevorzugt. Deck-Aufträge werden koordiniert. Das gewählte Modell bleibt zwischen Songs geladen, bis du die Betriebsart wechselst. Text und Stil werden nicht dauerhaft gespeichert.
Text erzeugt Sprache. Mit optionaler WAV-Referenz übernimmt das Modell deren Stimme. OmniVoice benötigt dazu den gesprochenen Text; ein leeres Transkriptfeld wird mit der vorhandenen Spracherkennung automatisch ergänzt.
Für RVC-Stimmumwandlung und eigenes Training: Applio Studio öffnen →
Im LLM- oder Stimmwerkzeuge-Modus verfügbar. Deck entlädt sein LLM vor der Stimmgenerierung und lädt es bei der nächsten Chat-Anfrage wieder. Das Stimmmodell bleibt für weitere Texte geladen und wird beim Profil-, GPU- oder Betriebsartwechsel entladen. Referenzdatei wird nach dem Auftrag gelöscht; Text wird nicht gespeichert.
Text erzeugt Sprache. Mit optionaler WAV-Referenz übernimmt das Modell deren Stimme. OmniVoice benötigt dazu den gesprochenen Text; ein leeres Transkriptfeld wird mit der vorhandenen Spracherkennung automatisch ergänzt.
Für RVC-Stimmumwandlung und eigenes Training: Applio Studio öffnen → · X-VC Studio öffnen →
Im LLM- oder Stimmwerkzeuge-Modus verfügbar. Deck entlädt sein LLM vor der Stimmgenerierung und lädt es bei der nächsten Chat-Anfrage wieder. Das Stimmmodell bleibt für weitere Texte geladen und wird beim Profil-, GPU- oder Betriebsartwechsel entladen. Referenzdatei wird nach dem Auftrag gelöscht; Text wird nicht gespeichert.
Vorhandene Sprachaufnahmen anhand einer Referenzstimme umwandeln. Unsere bisherige Oberfläche bleibt erhalten; die native Laufzeit und GPU steuert Athena Deck.
Vor einem Auftrag X-VC in Stimmwerkzeuge → Profile aktivieren und Steuerung → Stimmwerkzeuge starten. Immer nur ein Stimmwerkzeug-Profil aktiv.
Gewichte und Zusatzkomponenten werden aus ihren fest hinterlegten Originalquellen wiederhergestellt. Eigene Referenzaufnahmen und Ergebnisse separat sichern.