diff --git a/app.js b/app.js index 2d9243d..f6ba14c 100644 --- a/app.js +++ b/app.js @@ -26,6 +26,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==='seed-vc-runtime'){SeedVCUI.render();return;} +if(page==='soulx-singer-runtime'){SoulXSingerUI.render();return;} if(page==='xvc-runtime'){XVCUI.render();return;} if(page==='applio-runtime'){ApplioUI.render();return;} if(page==='acestep-runtime'){AceStepUI.render();return;} diff --git a/backup.py b/backup.py index ae5a121..90b3f51 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,ACE_COMPONENTS -SETTINGS=('seed_vc-data/settings.json','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') +SETTINGS=('soulx_singer-data/settings.json','seed_vc-data/settings.json','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']);sf=source['file'] if not isinstance(source['revision'],str) or not re.fullmatch('[a-f0-9]{40}',source['revision']) or not isinstance(sf,str) or not sf or len(sf)>1024 or sf.startswith('/') or '..' in PurePosixPath(sf).parts or '\\' in sf or any(ord(c)<32 for c in sf):raise ValueError('Ungültige Ersatzquelle.') metadata=m.get('runtime_metadata') - if metadata is not None and metadata not in ({'architecture':'rvc'},{'architecture':'xvc'},{'architecture':'seed_vc'}):raise ValueError('Ungültige Stimm-Modellmetadaten.') + if metadata is not None and metadata not in ({'architecture':'rvc'},{'architecture':'xvc'},{'architecture':'seed_vc'},{'architecture':'soulx_singer'}):raise ValueError('Ungültige Stimm-Modellmetadaten.') ids.add(m['id']) pids=set();names=set();api_names=set() for p in profiles: @@ -100,6 +100,9 @@ def validate(doc): if 'seed_vc-data/settings.json' in settings: v=settings['seed_vc-data/settings.json'] if not isinstance(v,dict) or set(v)!={'device'} or v['device'] not in ('3060','5080'):raise ValueError('Ungültige Seed-VC-GPU.') + if 'soulx_singer-data/settings.json' in settings: + v=settings['soulx_singer-data/settings.json'] + if not isinstance(v,dict) or set(v)!={'device'} or v['device'] not in ('3060','5080'):raise ValueError('Ungültige SoulX-Singer-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.') @@ -108,7 +111,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','xvc','seed_vc','music_remix'} 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','seed_vc','soulx_singer','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'] @@ -119,6 +122,7 @@ def validate(doc): 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 'seed_vc' in runtimes and type(runtimes['seed_vc']) is not bool:raise ValueError('Ungültige Seed-VC-Laufzeit.') + if 'soulx_singer' in runtimes and type(runtimes['soulx_singer']) is not bool:raise ValueError('Ungültige SoulX-Singer-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.') @@ -174,7 +178,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 (architecture:=(m.get('runtime_metadata') or {}).get('architecture')) in ('rvc','xvc','seed_vc'):item['runtime_metadata']={'architecture':architecture} + if (architecture:=(m.get('runtime_metadata') or {}).get('architecture')) in ('rvc','xvc','seed_vc','soulx_singer'):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']) elif m.get('download_source'):item['download_source']=copy.deepcopy(m['download_source']) @@ -205,6 +209,9 @@ class Backup: if getattr(s,'seed_vc_runtime',None): from seed_vc_runtime import RECIPE_HASH document['runtimes']['seed_vc']=s.seed_vc_runtime.status()['installed'];document['runtime_versions']['seed_vc']=dict(code=s.seed_vc_runtime.status()['revision'],assets=RECIPE_HASH) + if getattr(s,'soulx_singer_runtime',None): + from soulx_singer_runtime import RECIPE_HASH + document['runtimes']['soulx_singer']=s.soulx_singer_runtime.status()['installed'];document['runtime_versions']['soulx_singer']=dict(code=s.soulx_singer_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.') @@ -273,10 +280,13 @@ class Backup: if versions.get('seed_vc'): from seed_vc_runtime import REVISION as SEED_VC_REVISION,RECIPE_HASH if versions['seed_vc']!=dict(code=SEED_VC_REVISION,assets=RECIPE_HASH):blockers.append('Backup verlangt eine andere Seed-VC-Version oder Komponentenquelle.') + if versions.get('soulx_singer'): + from soulx_singer_runtime import REVISION as SOULX_REVISION,RECIPE_HASH + if versions['soulx_singer']!=dict(code=SOULX_REVISION,assets=RECIPE_HASH):blockers.append('Backup verlangt eine andere SoulX-Singer-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','xvc','seed_vc','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.') + 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','seed_vc','soulx_singer','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 @@ -304,8 +314,9 @@ class Backup: 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,'seed_vc',None),'active',False):raise ValueError('Seed-VC-Auftrag zuerst abschließen.') + if getattr(getattr(s,'soulx_singer',None),'active',False):raise ValueError('SoulX-Singer-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,'xvc_runtime',None),getattr(s,'seed_vc_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.') + 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,'seed_vc_runtime',None),getattr(s,'soulx_singer_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() @@ -335,6 +346,8 @@ class Backup: self._phase('X-VC-Laufzeit und geprüfte Zusatzgewichte installieren');s.xvc_runtime.start();self._wait(s.xvc_runtime.status) if r.get('seed_vc') and not s.seed_vc_runtime.status()['installed']: self._phase('Seed-VC-Laufzeit und geprüfte Zusatzgewichte installieren');s.seed_vc_runtime.start();self._wait(s.seed_vc_runtime.status) + if r.get('soulx_singer') and not s.soulx_singer_runtime.status()['installed']: + self._phase('SoulX-Singer-Laufzeit und geprüfte Zusatzgewichte installieren');s.soulx_singer_runtime.start();self._wait(s.soulx_singer_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']: @@ -378,6 +391,7 @@ class Backup: (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,'seed_vc',None):s.seed_vc.unload_idle() + if getattr(s,'soulx_singer',None):s.soulx_singer.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 @@ -477,6 +491,7 @@ class Backup: 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,'seed_vc',None):s.seed_vc.settings=copy.deepcopy(doc['settings'].get('seed_vc-data/settings.json',{'device':'5080'})) + if getattr(s,'soulx_singer',None):s.soulx_singer.settings=copy.deepcopy(doc['settings'].get('soulx_singer-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 @@ -512,6 +527,7 @@ class Backup: 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,'seed_vc_runtime',None):self.server.seed_vc_runtime.stop() + if getattr(self.server,'soulx_singer_runtime',None):self.server.soulx_singer_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 ab8495c..9cc53b2 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=='model-svc.pt': + role,label='model','SoulX-Singer-Stimmgewicht' 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): @@ -224,7 +226,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') or (repo=='chenxie95/X-VC' and name=='xvc.pt') or (repo=='Plachta/Seed-VC' and name=='DiT_seed_v2_uvit_whisper_base_f0_44k_bigvgan_pruned_ft_ema_v2.pth') + allowed=recipe_file or p.suffix.lower() in ('.gguf','.safetensors','.json','.tiktoken') or (repo=='openbmb/VoxCPM2' and name=='audiovae.pth') or (repo=='Soul-AILab/SoulX-Singer' and name=='model-svc.pt') or (repo=='chenxie95/X-VC' and name=='xvc.pt') or (repo=='Plachta/Seed-VC' and name=='DiT_seed_v2_uvit_whisper_base_f0_44k_bigvgan_pruned_ft_ema_v2.pth') 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/deploy/docker_backup.py b/deploy/docker_backup.py index 8b5961f..2bfadf9 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 'seed-vc-web' if row['name']=='athena-seed-vc-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')))) + 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 'soulx-singer-web' if row['name']=='athena-soulx-singer-web' else 'seed-vc-web' if row['name']=='athena-seed-vc-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','athena-xvc-web','athena-seed-vc-web'):raise ValueError('Host-Netzwerk nur für bekannte Deck-Oberflächen erlaubt.') - recipes={'seed-vc-web':('athena-seed-vc-web','athena-seed-vc-web:0.1.0-deck2'),'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('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','athena-seed-vc-web','athena-soulx-singer-web'):raise ValueError('Host-Netzwerk nur für bekannte Deck-Oberflächen erlaubt.') + recipes={'soulx-singer-web':('athena-soulx-singer-web','athena-soulx-singer-web:0.1.0'),'seed-vc-web':('athena-seed-vc-web','athena-seed-vc-web:0.1.0-deck2'),'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')=='seed-vc-web' and c['name']=='athena-seed-vc-web' and c.get('image') in ('athena-seed-vc-web:0.1.0-deck1','athena-seed-vc-web:0.1.0-deck2'):pass elif 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.') @@ -96,13 +96,14 @@ def validate(c): rel=m.get('deck_path') media={'video/original-work/remote-inputs/deskweb':('/data/inputs',False),'video/original-work/outputs':('/data/outputs',True)} native_seed_vc=rel=='seed_vc-data/bridge-key' and c['name']=='athena-seed-vc-web' and target=='/run/secrets/seed-vc-bridge' and m['read_only'] and m['was_file'] + native_soulx_singer=rel=='soulx_singer-data/bridge-key' and c['name']=='athena-soulx-singer-web' and target=='/run/secrets/soulx-singer-bridge' and m['read_only'] and m['was_file'] 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 not native_xvc and not native_seed_vc 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 not native_seed_vc and not native_soulx_singer 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','athena-xvc-web','athena-seed-vc-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','athena-seed-vc-web','athena-soulx-singer-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 @@ -120,9 +121,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','athena-xvc-web','athena-seed-vc-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,'athena-seed-vc-web':8136}[c['name']])) - if c.get('build_recipe') in ('swarm-ui','ladypoly','separator-web','voice-web','acestep-web','applio-web','xvc-web','seed-vc-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','athena-seed-vc-web','athena-soulx-singer-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,'athena-seed-vc-web':8136,'athena-soulx-singer-web':8138}[c['name']])) + if c.get('build_recipe') in ('swarm-ui','ladypoly','separator-web','voice-web','acestep-web','applio-web','xvc-web','seed-vc-web','soulx-singer-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': @@ -150,7 +151,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','athena-xvc-web','athena-seed-vc-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','athena-seed-vc-web','athena-soulx-singer-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)] @@ -166,10 +167,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','xvc-data/bridge-key','seed_vc-data/bridge-key') and not source.exists(): + if m['deck_path'] in ('video/comfy-client-token','applio-data/bridge-key','xvc-data/bridge-key','seed_vc-data/bridge-key','soulx_singer-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','xvc-data/bridge-key','seed_vc-data/bridge-key'): + elif m['deck_path'] not in ('video/comfy-client-token','applio-data/bridge-key','xvc-data/bridge-key','seed_vc-data/bridge-key','soulx_singer-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 0efa21c..e41de60 100644 --- a/deploy/install.py +++ b/deploy/install.py @@ -18,6 +18,8 @@ LABEL = 'de.casaderoll.athena-deck.standalone' FILES = ['assets/tts-presets/bundle.safetensors','assets/tts-presets/bundle.json','deploy/applio-requirements.lock','deploy/activate_applio.py','deploy/import_applio.py','deploy/backup_applio_data.py','applio.py','applio_runtime.py','applio_worker.py','applio-ui.js','deploy/activate_acestep.py','acestep_models.py','deploy/import_acestep.py','deploy/acestep-web/Dockerfile','deploy/acestep-web/app.py','deploy/acestep-web/index.html','acestep.py','acestep_worker.py','acestep_runtime.py','acestep-ui.js','deploy/acestep-requirements.lock','deploy/omnivoice-requirements.lock','omnivoice_runtime.py','omnivoice_worker.py','deploy/voice-web/Dockerfile','deploy/voice-web/base.Dockerfile','deploy/voice-web/bridge.py','deploy/patch_yue2_residency.py','embeddings.py','voxcpm_test.py','voxcpm_worker.py','voice-ui.js','voxcpm_runtime.py','voxcpm-ui.js','deploy/voxcpm-requirements.lock','network/native.py','deploy/setup_network_helper.py','separator_sources.json','deploy/separator-web/Dockerfile','deploy/separator-web/app.py','deploy/separator-web/index.html','separator.py','separator_runtime.py','separator_worker.py','separator-ui.js','deploy/ladypoly/Dockerfile','deploy/ladypoly/bridge.py','music.py','music-ui.js','audio_cpp_runtime.py','audio-cpp-ui.js','ltx_original_runtime.py','ltx_original_entry.py','video_original.py','ltx-original-ui.js','deploy/ltx-original-requirements.lock','backup.py','backup_codec.py','backup-ui.js','deploy/docker_backup.py','deploy/swarm-ui/Dockerfile','deploy/swarm-ui/patch-source.py','deploy/swarm-ui/proxy.py','deploy/swarm-ui/entrypoint.py','deploy/Dockerfile.app-update','video_comfy.py','video_comfy_node.py','video_comfy_proxy.py','prompt_enhancer.py','prompt_enhancer_worker.py','image_upload.py','audio_policy.py','deploy/tts-requirements.lock','stt.py','stt-ui.js','api_compat.py','responses_compat.py','execution_setup.py','tts_runtime.py','tts_test.py','tts_worker.py','tts-ui.js','auto_test.py','auto-test-ui.js','chat_test.py','chat-test-ui.js','endpoint.py','inference.py','endpoint-ui.js','docker_support.py','docker-ui.js','deploy/docker_helper.py','deploy/setup_docker_helper.py','image_encoder_node.py','image_runtime.py','image_test.py','image-test-ui.js','profiles.py','profiles-ui.js','capacity.py','runtime.py','runtime-ui.js','video.py','video_proxy.py','video-ui.js','catalog.py','hub_auth.py','catalog-ui.js','server.py','auth.py','collect_hardware.py','dashboard_data.py','dashboard_history.py','dashboard-ui.js','dashboard.css','themes.css','deploy/import_dashboard_history.py','index.html','app.js','studio.js','style.css','login.html','login.js','access-ui.js','network-ui.js','network/__init__.py','network/client.py','network/config.py','network/rpc.py','deploy/Dockerfile','deploy/image-requirements.lock'] +FILES += ['soulx_singer.py','soulx_singer_runtime.py','soulx-singer-ui.js','deploy/prepare_soulx_singer.py'] +FILES += sorted(str(p.relative_to(ROOT)) for folder in ('soulx-singer-web','soulx-singer-svc') for p in (ROOT/'deploy'/folder).rglob('*') if p.is_file() and '__pycache__' not in p.parts) FILES += ['seed_vc.py','seed_vc_runtime.py','seed_vc_sources.json','seed-vc-ui.js','deploy/seed-vc-requirements.lock','deploy/prepare_seed_vc.py'] FILES += sorted(str(p.relative_to(ROOT)) for p in (ROOT/'deploy/seed-vc-web').rglob('*') if p.is_file() and '__pycache__' not in p.parts) FILES += ['xvc.py','xvc_runtime.py','xvc_sources.json','xvc-ui.js','deploy/xvc-requirements.lock','deploy/prepare_xvc.py'] @@ -147,8 +149,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'] in (8134,8135,8137) or set(config.get('api_ports',[])) & {8134,8135,8137}:raise RuntimeError('Ports 8134/8135/8137 sind für interne Stimmwerkzeug-Brücken reserviert.') - args+=['-p','127.0.0.1:8134:8134','-p','127.0.0.1:8135:8135','-p','127.0.0.1:8137:8137'] + if config['port'] in (8134,8135,8137,8139) or set(config.get('api_ports',[])) & {8134,8135,8137,8139}:raise RuntimeError('Ports 8134/8135/8137 sind für interne Stimmwerkzeug-Brücken reserviert.') + args+=['-p','127.0.0.1:8134:8134','-p','127.0.0.1:8135:8135','-p','127.0.0.1:8137:8137','-p','127.0.0.1:8139:8139'] 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}'] @@ -240,7 +242,7 @@ def install(args): print('Generierter API-Token: geschützte Datei '+str(base/'bootstrap/api-token.txt')+'. In Passwortmanager übernehmen und Datei danach entfernen.') -def update(base, rollback=False, force=False, api_ports=None, reuse_runtime=False): +def update(base, rollback=False, force=False, api_ports=None, reuse_runtime=False, keep_snapshots=False): config=load_manifest(base) previous=owned(config['name'],base) if not previous: @@ -255,7 +257,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('seed_vc-runtime','seed_vc-data','seed_vc-prepare','reference-models','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-*')) + shutil.copytree(base/'state',base/'backups'/stamp,ignore=shutil.ignore_patterns('soulx_singer-runtime','soulx_singer-data','seed_vc-runtime','seed_vc-data','seed_vc-prepare','reference-models','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) @@ -271,7 +273,7 @@ def update(base, rollback=False, force=False, api_ports=None, reuse_runtime=Fals run('docker','rm',backup_name) # Keep only two automatic pre-update state snapshots after a successful update. snapshots=sorted((p for p in (base/'backups').iterdir() if p.is_dir() and not p.is_symlink() and p.name.isdigit()),key=lambda p:int(p.name)) - for snapshot in snapshots[:-2]:shutil.rmtree(snapshot) + for snapshot in ([] if keep_snapshots else snapshots[:-2]):shutil.rmtree(snapshot) print('Nur Athena Deck wurde aktualisiert. Vorheriges Image bleibt für --rollback erhalten.') diff --git a/deploy/prepare_soulx_singer.py b/deploy/prepare_soulx_singer.py new file mode 100644 index 0000000..8603db2 --- /dev/null +++ b/deploy/prepare_soulx_singer.py @@ -0,0 +1,50 @@ +"""Prepare SoulX-Singer without starting services; merge its inactive profile only after Deck stops.""" +import hashlib,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 soulx_singer_runtime import SoulXSingerRuntime + +def prepare(state,create_container=True): + state=Path(state).resolve();runtime=SoulXSingerRuntime(state/'soulx_singer-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/'cli/inference_svc.py').is_file():raise ValueError('SoulX-Singer-Laufzeit zuerst installieren.') + from soulx_singer_runtime import ASSETS,REPO,MODEL_REVISION + ident=hashlib.sha256((REPO+MODEL_REVISION+'model-svc.pt').encode()).hexdigest();pending=state/'soulx_singer-profile-pending.json' + if pending.exists(): + row=json.loads(pending.read_text()) + if row.get('model_id')!=ident or row.get('api_id')!='soulx-singer-singing':raise ValueError('Abweichendes vorbereitetes SoulX-Singer-Profil prüfen.') + else: + row=dict(id=uuid.uuid4().hex,revision=1,name='SoulX-Singer Gesang',api_id='soulx-singer-singing',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/'soulx_singer-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) + if not create_container: + print('SoulX-Singer: inaktives Profil vorbereitet; kein Container gestartet oder registriert.');return + name='athena-soulx-singer-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')!='soulx-singer-web':raise ValueError('Containername anderweitig belegt.') + if row['State']['Running']:raise ValueError('Vorhandene SoulX-Singer-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=soulx-singer-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/soulx-singer-bridge,readonly','athena-soulx-singer-web:0.1.0'],check=True,stdout=subprocess.DEVNULL) + print('SoulX-Singer: 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);SoulXSingerRuntime(state/'soulx_singer-runtime',None).ensure_library();row=json.loads((state/'soulx_singer-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('SoulX-Singer 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 SoulX-Singer-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],create_container='--no-container' not in sys.argv) diff --git a/deploy/scheduled_backup.py b/deploy/scheduled_backup.py index 0b8e160..728ba45 100644 --- a/deploy/scheduled_backup.py +++ b/deploy/scheduled_backup.py @@ -23,7 +23,7 @@ def key(): return KEY.read_bytes().strip()+b'\n' def sources(): - names=('seed_vc-data','legacy-userdata','applio-data','xvc-data','voice-tests','music-jobs','acestep-jobs','separator-tests','image-tests','tts-tests') + names=('soulx_singer-data','seed_vc-data','legacy-userdata','applio-data','xvc-data','voice-tests','music-jobs','acestep-jobs','separator-tests','image-tests','tts-tests') roots=[(STATE/n,'deck/'+n) for n in names]+[(STATE/'video/original-work/outputs','deck/video/original-work/outputs'),(STATE/'video/original-work/remote-inputs','deck/video/original-work/remote-inputs'),(STATE/'video/original-work/deskweb','deck/video/original-work/deskweb'),(Path('/opt/athena-ladypoly/data'),'services/ladypoly'),(Path('/opt/athena-deck-docker-apps'),'services/web-studios')] # Private locally-trained voices have no public replacement source. for p in (STATE/'models').glob('*/entry.json'): diff --git a/deploy/soulx-singer-svc/README.md b/deploy/soulx-singer-svc/README.md index 4097052..0db3de6 100644 --- a/deploy/soulx-singer-svc/README.md +++ b/deploy/soulx-singer-svc/README.md @@ -2,8 +2,8 @@ Dieses Rezept installiert **Stimmumwandlung vorhandenen Gesangs** (SVC), nicht SoulX-Singers separates Text-/Noten-zu-Gesang-Modell. Es aktiviert kein Profil, -startet keinen Dienst und lädt nichts auf die GPU. Die Deck-Worker-/Studio-Anbindung -ist noch nicht Bestandteil dieser Vorbereitung. +startet keinen Dienst und lädt nichts auf die GPU. Die anschließende Deck-Anbindung ist im +[Studio-Rezept](../soulx-singer-web/README.md) beschrieben. ## Quellen und Abhängigkeiten diff --git a/deploy/soulx-singer-svc/requirements.lock b/deploy/soulx-singer-svc/requirements.lock index 9718fcf..abf941f 100644 --- a/deploy/soulx-singer-svc/requirements.lock +++ b/deploy/soulx-singer-svc/requirements.lock @@ -1,14 +1,28 @@ accelerate==1.11.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 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 decorator==5.3.1 +fastapi==0.142.2 +ffmpy==1.0.0 filelock==3.32.3 fsspec==2026.7.0 +gradio==5.49.1 +gradio_client==1.13.3 +groovy==0.1.2 +h11==0.16.0 hf-xet==1.6.0 +httpcore==1.0.9 +httpx==0.28.1 huggingface-hub==0.36.0 idna==3.20 Jinja2==3.1.6 @@ -16,7 +30,9 @@ joblib==1.6.0 lazy-loader==0.6 librosa==0.11.0 llvmlite==0.50.0 +markdown-it-py==4.2.0 MarkupSafe==3.0.3 +mdurl==0.1.2 mpmath==1.3.0 msgpack==1.2.3 narwhals==2.26.0 @@ -38,27 +54,51 @@ nvidia-nccl-cu12==2.27.3 nvidia-nvjitlink-cu12==12.8.93 nvidia-nvtx-cu12==12.8.90 omegaconf==2.3.0 +opentelemetry-api==1.45.1 +orjson==3.12.0 packaging==26.3 +pandas==2.3.3 +pillow==11.3.0 platformdirs==4.12.3 pooch==1.9.0 psutil==7.2.2 pycparser==3.0 +pydantic==2.11.10 +pydantic_core==2.33.2 +pydub==0.25.1 +Pygments==2.21.0 +python-dateutil==2.9.0.post0 +python-multipart==0.0.32 +pytz==2026.5 PyYAML==6.0.3 regex==2026.9.29 requests==2.34.2 +rich==15.0.0 +ruff==0.16.10 +safehttpx==0.1.7 safetensors==0.8.0 scikit-learn==1.9.1 scipy==1.15.3 +semantic-version==2.10.0 setuptools==78.1.0 +shellingham==1.5.4 +six==1.17.0 soundfile==0.13.1 soxr==1.1.0 +starlette==0.52.1 sympy==1.14.0 threadpoolctl==3.7.0 tokenizers==0.19.1 +tomlkit==0.13.3 torch==2.8.0+cu128 torchaudio==2.8.0+cu128 tqdm==4.67.1 transformers==4.41.2 triton==3.4.0 +typer==0.27.3 +typing-inspection==0.4.4 typing_extensions==4.16.0 +tzdata==2026.5 urllib3==2.8.0 +uvicorn==0.54.0 +websockets==15.0.1 diff --git a/deploy/soulx-singer-svc/requirements.txt b/deploy/soulx-singer-svc/requirements.txt index 6e126e2..20e204b 100644 --- a/deploy/soulx-singer-svc/requirements.txt +++ b/deploy/soulx-singer-svc/requirements.txt @@ -7,3 +7,4 @@ scipy==1.15.3 soundfile==0.13.1 omegaconf==2.3.0 tqdm==4.67.1 +gradio==5.49.1 diff --git a/deploy/soulx-singer-web/Dockerfile b/deploy/soulx-singer-web/Dockerfile new file mode 100644 index 0000000..30d69f7 --- /dev/null +++ b/deploy/soulx-singer-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","8138","--no-access-log"] diff --git a/deploy/soulx-singer-web/README.md b/deploy/soulx-singer-web/README.md new file mode 100644 index 0000000..d0a5b3e --- /dev/null +++ b/deploy/soulx-singer-web/README.md @@ -0,0 +1,58 @@ +# SoulX-Singer Studio + +SVC-Stimmumwandlung mit offiziellem SoulX-Singer-Gewicht, RMVPE und Whisper Base. +Reinen Gesang plus saubere Gesangsreferenz hochladen. Ausgabe: PCM-16-WAV mit +24 kHz, Player und direkter Download. Standard: 32 Schritte, CFG 3, unveränderte +Tonhöhe. Keine Texte, Noten oder Trainingsdaten erforderlich. + +In Deck Profil **SoulX-Singer Gesang** aktivieren, Steuerung → Stimmwerkzeuge +starten, dann Studio auf Port **8138** öffnen. GPU kann auf der +SoulX-Laufzeitseite zwischen RTX 5080 und RTX 3060 gewählt werden. Nur ein +Stimmprofil ist gleichzeitig freigegeben. Die GPU wird vor jedem Auftrag bei +Deck reserviert; das Modell bleibt für Folgeaufträge geladen und wird beim +Profil-/GPU-/Betriebsartwechsel entladen. Profilwechsel während eines aktiven +Auftrags werden abgelehnt. Ein abgestürzter Worker gibt seine Reservierung frei. + +## Installation und Restore + +[Gewichte und native Umgebung](../soulx-singer-svc/README.md) über das feste +Rezept vorbereiten. `requirements.lock` enthält auch Gradio 5.49.1 und den +geprüften UI-Stack. Nach CPU-Prüfung `ui-ready` unter der Laufzeitwurzel +markieren; der integrierte Runtime-Installer erledigt das automatisch. +`SoulXSingerRuntime.ensure_library()` registriert das Hauptmodell mit relativem +Bibliothekslink; `deploy/prepare_soulx_singer.py` bereitet Profil und UI vor. +Ein Profil wird nur bei gestopptem Deck in den Zustand übernommen. + +Die eigentliche Oberfläche läuft **nativ als Deck-Kindprozess**, mit dem +separaten Python unter `/soulx_singer-runtime/python`. Decks Dienstbenutzer +benötigt NVIDIA-Gerätezugriff, FFmpeg und Schreibrechte auf Laufzeit und +`/soulx_singer-data`. Native Kindprozess-/Lease-Dateien und Bridge-Key +werden durch Deck erzeugt; kein Docker-Worker ist erforderlich. + +Der optionale CPU-Proxy wird aus diesem Dockerfile gebaut, Image +`athena-soulx-singer-web:0.1.0`, Container `athena-soulx-singer-web` mit bekannten +Deck-Anwendungslabels. Er bindet 127.0.0.1:8138, spricht mit dem nativen Backend +auf 127.0.0.1:8139 und erhält nur den Bridge-Key als schreibgeschützte Datei +unter `/run/secrets/soulx-singer-bridge`. Kein GPU-/Modellmount. Der heutige +Deck-Testcontainer veröffentlicht 8139 ausschließlich auf dem Host-Loopback. +Bei nativer Installation bindet das Backend an Loopback (`DECK_BIND_HOST`); +bei Containerbetrieb ist seine interne Bindung 0.0.0.0 notwendig. Für LAN/VPN +Port 8138 in die ausdrücklich freigegebene Netzwerk-Proxy-Portliste aufnehmen. + +Deck-Konfigurationsbackup enthält Profil, GPU-Auswahl und Runtime-Quellen. +Der Docker-Backup-Helfer rekonstruiert den Proxy aus dem Git-Rezept und erzeugt +bei Bedarf einen neuen lokalen Bridge-Key. Referenzen, Uploads und Ergebnisse +unter `soulx_singer-data` gehören in den verschlüsselten Nutzdatenexport; +öffentliche Gewichte und Python-venv werden neu aufgebaut, nicht kopiert. + +`soulx_singer-activate.json` ist ein ausdrücklich angelegter, einmaliger lokaler +Wartungsauftrag mit `profile_id`: Nach einem autorisierten Update aktiviert +Deck genau dieses SoulX-Profil, wechselt auf Stimmwerkzeuge und lädt über seine +GPU-Reservierung vor. Ergebnis in `soulx_singer-data/activation.json`; die +Auftragsdatei wird verbraucht. Es gibt keinen allgemeinen Wiederanlaufmodus. + +Die Worker-Startüberwachung verwendet einen langlebigen Deck-Startthread, damit +Linux PDEATHSIG nicht beim Ende eines kurzen HTTP-/Aktivierungs-Threads auslöst. +Bei Wartungsupdates kann `deploy.install.update(..., keep_snapshots=True)` +bestehende Update-Snapshots ausdrücklich erhalten; dieses Einspielen hat keine +alten Backups gelöscht. diff --git a/deploy/soulx-singer-web/native_ui.py b/deploy/soulx-singer-web/native_ui.py new file mode 100644 index 0000000..53f004c --- /dev/null +++ b/deploy/soulx-singer-web/native_ui.py @@ -0,0 +1,87 @@ +"""Small singing UI: pinned upstream SVC, lazy GPU load under Deck's voice lease.""" +import json,os,secrets,socket,threading,time,uuid +from pathlib import Path +from types import SimpleNamespace +import gradio as gr +import numpy as np +import soundfile as sf +from fastapi import FastAPI,Request +from fastapi.responses import JSONResponse +import uvicorn + +LOCK=threading.RLock() +ENGINE=None +ASSETS=Path(os.environ['SOULX_SINGER_ASSETS']) +OUTPUT=Path(os.environ['SOULX_SINGER_OUTPUT']) + +def load_engine(): + from cli.inference_svc import build_model + from soulxsinger.utils.file_utils import load_config + from preprocess.tools.f0_extraction import F0Extractor + config=load_config(ASSETS/'soulx/config.yaml') + model=build_model(str(ASSETS/'soulx/model-svc.pt'),config,device='cuda',use_fp16=True) + f0=F0Extractor(str(ASSETS/'preprocess/rmvpe/rmvpe.pt'),device='cuda',verbose=False) + return model,config,f0 + +def convert(source,reference,steps=32,pitch=0,progress=gr.Progress()): + global ENGINE + if not source or not reference:raise gr.Error('Gesangsdatei und Referenzstimme hochladen.') + with LOCK: + connection=socket.socket(socket.AF_UNIX) + try: + connection.connect(os.environ['SOULX_SINGER_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 geändert; SoulX erneut öffnen.') + progress(0,desc='Gesangsmodell laden') + if ENGINE is None:ENGINE=load_engine() + model,config,f0=ENGINE;started=time.monotonic() + from soulxsinger.utils.audio_utils import load_wav + import torch + progress(None,desc='Tonhöhen erkennen und Gesang umwandeln') + pt_f0=torch.from_numpy(f0.process(reference,verbose=False)).unsqueeze(0).cuda() + gt_f0=torch.from_numpy(f0.process(source,verbose=False)).unsqueeze(0).cuda() + pt=load_wav(reference,config.audio.sample_rate).cuda();gt=load_wav(source,config.audio.sample_rate).cuda() + with torch.inference_mode(): + audio,_=model.infer(pt_wav=pt,gt_wav=gt,pt_f0=pt_f0,gt_f0=gt_f0,auto_shift=False,pitch_shift=int(pitch),n_steps=int(steps),cfg=3.0,use_fp16=True) + audio=audio.squeeze().float().cpu().numpy() + if not audio.size or not np.isfinite(audio).all():raise gr.Error('Ungültige SoulX-Audioausgabe.') + path=OUTPUT/('Gesang-'+uuid.uuid4().hex[:12]+'.wav');sf.write(path,audio,config.audio.sample_rate,subtype='PCM_16') + return str(path),str(path),f'Fertig · 24 kHz WAV · {time.monotonic()-started:.1f} s Verarbeitung' + finally:connection.close() + +with gr.Blocks(title='SoulX-Singer · Gesang') as demo: + gr.Markdown('# Gesang mit deiner Referenzstimme\nGesangsdatei und Zielstimme hochladen. Melodie und Timing bleiben erhalten; kein Stimmtraining nötig. Die Qualität hängt von beiden Aufnahmen ab.') + with gr.Row(): + source=gr.Audio(label='Reiner Gesang',type='filepath',sources=['upload']) + reference=gr.Audio(label='Referenzstimme',type='filepath',sources=['upload','microphone']) + gr.Markdown('Verwende möglichst eine saubere Gesangsreferenz und reinen Quellgesang ohne Begleitmusik. Ausgabe: 24 kHz. Der Quellgesang wird nach dem offiziellen SoulX-Verfahren verarbeitet.') + run=gr.Button('Gesang umwandeln',variant='primary') + with gr.Accordion('Einstellungen',open=False): + steps=gr.Slider(1,200,value=32,step=1,label='Qualität / Diffusionsschritte') + pitch=gr.Slider(-24,24,value=0,step=1,label='Tonhöhe verschieben (Halbtöne)') + output=gr.Audio(label='Ergebnis',type='filepath');download=gr.File(label='WAV herunterladen');report=gr.Markdown() + run.click(convert,[source,reference,steps,pitch],[output,download,report],api_name='convert') +app=FastAPI() +@app.middleware('http') +async def protect(request:Request,call_next): + key=Path(os.environ['SOULX_SINGER_BRIDGE_KEY_FILE']).read_text().strip() + if not secrets.compare_digest(request.headers.get('X-SoulX-Singer-Bridge',''),key):return JSONResponse({'detail':'Deck-Brücke erforderlich.'},status_code=403) + return await call_next(request) +@app.post('/load') +def preload(): + global ENGINE + with LOCK: + connection=socket.socket(socket.AF_UNIX) + try: + connection.connect(os.environ['SOULX_SINGER_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'):return JSONResponse(reply,status_code=409) + if reply['gpu']!=os.environ['CUDA_VISIBLE_DEVICES']:return JSONResponse({'error':'GPU geändert'},status_code=409) + if ENGINE is None:ENGINE=load_engine() + return {'status':'ready','model_loaded':True} + finally:connection.close() +@app.get('/health') +def health():return {'status':'ready','model_loaded':ENGINE is not None} +app=gr.mount_gradio_app(app,demo.queue(default_concurrency_limit=1),path='/',allowed_paths=[str(OUTPUT)]) +if __name__=='__main__':uvicorn.run(app,host=os.environ.get('SOULX_SINGER_BIND','127.0.0.1'),port=8139,access_log=False) diff --git a/deploy/soulx-singer-web/proxy.py b/deploy/soulx-singer-web/proxy.py new file mode 100644 index 0000000..4666f68 --- /dev/null +++ b/deploy/soulx-singer-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/soulx-singer-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-SOULX-SINGER-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-SOULX-SINGER-Bridge':KEY.read_text().strip(),'Host':request.headers.get('host','127.0.0.1:8138')} + if request.headers.get('content-type'):headers['Content-Type']=request.headers['content-type'] + req=client.build_request(request.method,'http://127.0.0.1:8139/'+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','content-encoding','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':'SoulX-Singer ist vorbereitet, aber noch nicht gestartet. In Deck ein SoulX-Singer-Profil aktivieren und Stimmwerkzeuge starten.'},status_code=503) diff --git a/docker-ui.js b/docker-ui.js index 0485720..ce225e8 100644 --- a/docker-ui.js +++ b/docker-ui.js @@ -4,6 +4,7 @@ window.DockerUI=(()=>{ '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-seed-vc-web':{title:'Seed-VC Gesang',description:'Reiner Gesang und Referenzstimme → Gesang in der Zielstimme, ohne Training.',port:8136,hint:'Seed-VC-Profil aktivieren und Stimmwerkzeuge starten.'}, + 'athena-soulx-singer-web':{title:'SoulX-Singer Gesang',description:'Reiner Gesang und Referenzstimme → Gesang in der Zielstimme, ohne Training.',port:8138,hint:'SoulX-Singer-Profil aktivieren und Stimmwerkzeuge starten.'}, '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.'}, diff --git a/docs/CURRENT_SYSTEM.md b/docs/CURRENT_SYSTEM.md index baa14db..e483fe9 100644 --- a/docs/CURRENT_SYSTEM.md +++ b/docs/CURRENT_SYSTEM.md @@ -100,13 +100,22 @@ inaktiv; GPU-/Hörtest steht aus. Originalprojekt archiviert. Einrichtung, native Voraussetzungen, Steuerung und Restore: [Seed-VC Gesang](../deploy/seed-vc-web/README.md). -### SoulX-Singer-SVC (Gewichte und Laufzeit vorbereitet) +### SoulX-Singer-SVC (eingespielt und aktiviert) -Am 6. Oktober 2026 auf Athena vorbereitet: SVC-Hauptgewicht, RMVPE und Whisper -Base mit festen Originalrevisionen und SHA-256; eigene Python-Umgebung mit -Torch 2.8.0/CUDA 12.8 und Transformers 4.41.2. Gesamter Platzbedarf ungefähr -11 GiB. Strenges Laden des Hauptgewichts und CPU-Tests für den tatsächlichen -Decoder, Whisper-Merkmale und RMVPE mit künstlichem Audio erfolgreich. -Keine Profile aktiviert, kein Dienst gestartet und kein GPU-Qualitätstest. -Deck-Worker/Studio-Anbindung noch offen. -[Quellen, Installation und Wiederbeschaffung](../deploy/soulx-singer-svc/README.md). +Profil **SoulX-Singer Gesang**, API-ID `soulx-singer-singing`, in Stimmwerkzeuge +aktiv; RTX 5080. Native Deck-Laufzeit mit SVC-Hauptgewicht, RMVPE und Whisper +Base aus fest hinterlegten Originalquellen. Studio auf **8138**, interne Brücke +**8139** nur am Host-Loopback. CPU-Proxy als registrierte Deck-Anwendung. + +Am 6. Oktober 2026 GPU-Test über die tatsächliche Studio-API erfolgreich: +6 Sekunden offizielles Demo-Audio umgewandelt, 32 Schritte, CFG 3, Ausgabe +6 Sekunden PCM-16-WAV/24 kHz, 17,4 Sekunden Verarbeitung. Das ist ein technischer +Funktionstest, keine zugesicherte Stimmqualität. Modell bleibt nach dem Auftrag +resident; initial ungefähr 3,3 GiB VRAM. Folgende Aufträge laden nicht neu. +Beim Profil-/GPU-/Betriebsartwechsel wird der Worker entladen. + +Ein eigener langlebiger Startthread hält den nativen Worker unabhängig von +kurzlebigen HTTP-/Aktivierungs-Threads am Leben (Linux PDEATHSIG). Profil, +GPU-Auswahl, Runtime-Quellen und UI-Rezept sind im Backup/Restore berücksichtigt; +Uploads und Ergebnisse sind Teil der verschlüsselten Nutzdatenübernahme. +[Einrichtung und Wiederherstellung](../deploy/soulx-singer-web/README.md). diff --git a/endpoint.py b/endpoint.py index 6482b04..2a25d80 100644 --- a/endpoint.py +++ b/endpoint.py @@ -95,6 +95,8 @@ class Endpoint: 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() + if row['kind']=='voice' and getattr(self,'seed_vc',None):self.seed_vc.unload_idle() + if row['kind']=='voice' and getattr(self,'soulx_singer',None):self.soulx_singer.unload_idle() with self.lock: if row['kind']=='voice' and self.voxcpm: job=self.voxcpm.status().get('job') or {} @@ -174,7 +176,8 @@ class Endpoint: from applio import applio_model from xvc import xvc_model from seed_vc import seed_vc_model - if applio_model(p.get('model')) or xvc_model(p.get('model')) or seed_vc_model(p.get('model')):continue + from soulx_singer import soulx_singer_model + if applio_model(p.get('model')) or xvc_model(p.get('model')) or seed_vc_model(p.get('model')) or soulx_singer_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',{}) diff --git a/execution_setup.py b/execution_setup.py index 8e3f521..d05e979 100644 --- a/execution_setup.py +++ b/execution_setup.py @@ -17,6 +17,11 @@ def _assess(model, installed, profile=None): result.update(family='Seed-VC',evidence='Originales 44,1-kHz-Gesangsmodell',runtime='Seed-VC · Python/PyTorch',route='#seed-vc-runtime',installed=bool(installed.get('seed_vc')),state='ready' if installed.get('seed_vc') else 'setup',label='Seed-VC Gesang',message='Gesangsaufnahme und Referenzstimme verwenden; kein Stimmtraining nötig.') if profile:result.update(state='ready' if profile.get('runnable') else 'profile_incomplete',blockers=profile.get('blockers',[])) return result + from soulx_singer import soulx_singer_model + if soulx_singer_model(model): + result.update(family='SoulX-Singer',evidence='Originales 24-kHz-Gesangsmodell',runtime='SoulX-Singer · Python/PyTorch',route='#soulx-singer-runtime',installed=bool(installed.get('soulx_singer')),state='ready' if installed.get('soulx_singer') else 'setup',label='SoulX-Singer Gesang',message='Gesangsaufnahme und Referenzstimme verwenden; kein Stimmtraining nötig.') + if profile:result.update(state='ready' if profile.get('runnable') else 'profile_incomplete',blockers=profile.get('blockers',[])) + return result from xvc import xvc_model if xvc_model(model): result.update(family='X-VC',evidence='Offizielles X-VC-Gewicht',runtime='X-VC · Python/PyTorch',route='#xvc-runtime',installed=bool(installed.get('xvc')),state='ready' if installed.get('xvc') else 'setup',label='X-VC erkannt',message='Quellaufnahme und Referenzstimme in der X-VC-Oberfläche verwenden. Die Laufzeit richtet alle Zusatzgewichte ein; keine einzelnen VAE-/Projektor-Zuordnungen.') @@ -86,6 +91,12 @@ def _assess_candidates(model, installed, profile=None): if profile:result.update(state='ready' if profile.get('runnable') else 'profile_incomplete',blockers=profile.get('blockers',[])) add('seed_vc','Seed-VC · Python/PyTorch','seed_vc','#seed-vc-runtime','Gesangsmodell und geprüfte Zusatzgewichte') return result + from soulx_singer import soulx_singer_model + if soulx_singer_model(model): + result.update(family='SoulX-Singer',evidence='Originales 24-kHz-Gesangsmodell',runtime='SoulX-Singer · Python/PyTorch',route='#soulx-singer-runtime',installed=bool(installed.get('soulx_singer')),state='ready' if installed.get('soulx_singer') else 'setup',label='SoulX-Singer Gesang',message='Gesangsaufnahme und Referenzstimme verwenden; kein Stimmtraining nötig.') + if profile:result.update(state='ready' if profile.get('runnable') else 'profile_incomplete',blockers=profile.get('blockers',[])) + add('soulx_singer','SoulX-Singer · Python/PyTorch','soulx_singer','#soulx-singer-runtime','Gesangsmodell und geprüfte Zusatzgewichte') + return result from xvc import xvc_model if xvc_model(model): add('xvc','X-VC · Python/PyTorch','xvc','#xvc-runtime','Offizielles X-VC-Paket mit geprüftem Deck-Worker') diff --git a/index.html b/index.html index 4c07f75..2d31b47 100644 --- a/index.html +++ b/index.html @@ -1 +1 @@ -Athena Deck
ATHENA CONTROL SURFACEv0.7 · Router
+Athena Deck
ATHENA CONTROL SURFACEv0.7 · Router
diff --git a/profiles.py b/profiles.py index 3f3793b..73b508f 100644 --- a/profiles.py +++ b/profiles.py @@ -229,6 +229,8 @@ class Profiles: if applio_model(p.get('model')):p['blockers']=getattr(self,'applio_blockers',lambda p:['Applio-Worker fehlt.'])(p) from seed_vc import seed_vc_model if seed_vc_model(p.get('model')):p['blockers']=getattr(self,'seed_vc_blockers',lambda p:['Seed-VC-Worker fehlt.'])(p) + from soulx_singer import soulx_singer_model + if soulx_singer_model(p.get('model')):p['blockers']=getattr(self,'soulx_singer_blockers',lambda p:['SoulX-Singer-Worker fehlt.'])(p) from xvc import xvc_model if xvc_model(p.get('model')):p['blockers']=getattr(self,'xvc_blockers',lambda p:['X-VC-Worker fehlt.'])(p) if p['kind']=='video' and self.video_blockers and p.get('model'):p['blockers']=self.video_blockers(p) @@ -354,6 +356,8 @@ class Profiles: model=self.catalog.entry(model_id) from seed_vc import seed_vc_model if seed_vc_model(model):return dict(supported=True,requirements=[],source='https://huggingface.co/Plachta/Seed-VC',license='gpl-3.0',runtime='Seed-VC · Python/PyTorch',runtime_route='#seed-vc-runtime',runtime_installed=not bool(getattr(self,'seed_vc_blockers',lambda p:['Laufzeit fehlt'])({'model':model})),worker_available=True,no_components=True,message='Gesangsdatei und Referenzstimme ohne Training umwandeln. Originales 44,1-kHz-Gesangsmodell; alle Zusatzgewichte gehören zum geprüften Laufzeitpaket. Originalprojekt archiviert.') + from soulx_singer import soulx_singer_model + if soulx_singer_model(model):return dict(supported=True,requirements=[],source='https://huggingface.co/Plachta/SoulX-Singer',license='apache-2.0',runtime='SoulX-Singer · Python/PyTorch',runtime_route='#soulx-singer-runtime',runtime_installed=not bool(getattr(self,'soulx_singer_blockers',lambda p:['Laufzeit fehlt'])({'model':model})),worker_available=True,no_components=True,message='Gesangsdatei und Referenzstimme ohne Training umwandeln. Originales 24-kHz-Gesangsmodell; alle Zusatzgewichte gehören zum geprüften Laufzeitpaket. ') from xvc import xvc_model if xvc_model(model):return dict(supported=True,requirements=[],source='https://huggingface.co/chenxie95/X-VC',license='mit',runtime='X-VC · Python/PyTorch',runtime_route='#xvc-runtime',runtime_installed=not bool(getattr(self,'xvc_blockers',lambda p:['Laufzeit fehlt'])({'model':model})),worker_available=True,no_components=True,message='Audio-zu-Audio-Stimmumwandlung. X-VC, Sprach-Tokenizer, Sprecherencoder und optionales Resemble Enhance werden als geprüftes Paket mit der Laufzeit installiert. Kein VAE oder Vision-Projektor erforderlich.') from applio import applio_model diff --git a/server.py b/server.py index 795426a..d7b99ba 100644 --- a/server.py +++ b/server.py @@ -99,6 +99,8 @@ class Server(ThreadingHTTPServer): self.xvc_runtime=XVCRuntime(self.catalog.root.parent/'xvc-runtime',self.image_runtime) from seed_vc_runtime import SeedVCRuntime self.seed_vc_runtime=SeedVCRuntime(self.catalog.root.parent/'seed_vc-runtime',self.image_runtime) + from soulx_singer_runtime import SoulXSingerRuntime + self.soulx_singer_runtime=SoulXSingerRuntime(self.catalog.root.parent/'soulx_singer-runtime',self.image_runtime) self.tts_runtime=TTSRuntime(self.catalog.root.parent/'tts-runtime') self.tts_tests=TTSTests(self.catalog.root.parent/'tts-tests',self.profiles,self.tts_runtime) self.profiles.tts_blockers=self.tts_tests.blockers @@ -153,8 +155,13 @@ class Server(ThreadingHTTPServer): self.profiles.seed_vc_blockers=self.seed_vc.blockers self.endpoint.seed_vc=self.seed_vc self.seed_vc.ensure() + from soulx_singer import SoulXSinger + self.soulx_singer=SoulXSinger(self.catalog.root.parent/'soulx_singer-data',self.soulx_singer_runtime,self.scheduler,self.profiles,lambda:self.endpoint.config['enabled_profiles']) + self.profiles.soulx_singer_blockers=self.soulx_singer.blockers + self.endpoint.soulx_singer=self.soulx_singer + self.soulx_singer.ensure() def evict_voice(): - self.voxcpm_tests.unload_idle();self.applio.unload_idle();self.xvc.unload_idle();self.seed_vc.unload_idle() + self.voxcpm_tests.unload_idle();self.applio.unload_idle();self.xvc.unload_idle();self.seed_vc.unload_idle();self.soulx_singer.unload_idle() self.scheduler.evict_voice=evict_voice self.applio.ensure() self.chat_tests=ChatTests(self.profiles,self.worker,self.scheduler) @@ -208,6 +215,41 @@ class Server(ThreadingHTTPServer): self.endpoint.video_browser_auth=video_browser_auth from backup import Backup self.backup=Backup(self) + # Explicit one-time request created during an authorized SoulX activation. + activate=self.catalog.root.parent/'soulx_singer-activate.json' + if activate.is_file(): + request=json.loads(activate.read_text());activate.unlink() + def activate_soulx(): + result={} + try: + row=next(p for p in self.profiles.status()['profiles'] if p['id']==request['profile_id']) + from soulx_singer import soulx_singer_model + if not soulx_singer_model(row.get('model')):raise ValueError('Kein SoulX-Profil.') + deadline=time.monotonic()+45 + while True: + try: + self.endpoint.enable({'id':row['id'],'enabled':True});break + except ValueError as exc: + if 'Worker konnte nicht entladen' not in str(exc) or time.monotonic()>deadline:raise + time.sleep(.5) + self.video.switch('voice') + deadline=time.monotonic()+90 + while self.scheduler.gpu_mode=='switching' and time.monotonic()deadline:raise ValueError('SoulX-Oberfläche nicht bereit.') + time.sleep(.5) + req=urllib.request.Request('http://127.0.0.1:8139/load',data=b'{}',headers={'X-SoulX-Singer-Bridge':self.soulx_singer.key,'Content-Type':'application/json'}) + with urllib.request.urlopen(req,timeout=120) as response:result=json.load(response) + except Exception as exc:result={'error':str(exc)};self.endpoint.error='SoulX-Aktivierung fehlgeschlagen: '+str(exc) + (self.soulx_singer.root/'activation.json').write_text(json.dumps(result)) + threading.Thread(target=activate_soulx,daemon=True).start() # A one-time, local maintenance request restores music after an authorized # update. No credentials or song prompts are stored in this request. preload=self.catalog.root.parent/'music-preload.json' @@ -224,6 +266,7 @@ class Server(ThreadingHTTPServer): def server_close(self): if getattr(self,'seed_vc',None):self.seed_vc.stop() + if getattr(self,'soulx_singer',None):self.soulx_singer.stop() if getattr(self,'xvc',None):self.xvc.stop() if getattr(self,'applio',None):self.applio.stop() super().server_close() @@ -381,7 +424,7 @@ class Handler(BaseHTTPRequestHandler): 'video':video_runtime.status().get('installed',False), 'acestep':self.server.acestep_runtime.status()['installed'], 'audio_cpp':self.server.audio_cpp_runtime.status()['installed'], - 'seed_vc':self.server.seed_vc_runtime.status()['installed'],'xvc':self.server.xvc_runtime.status()['installed'],'applio':self.server.applio_runtime.status()['installed'],'omnivoice':self.server.omnivoice_runtime.status()['installed'],'voxcpm':self.server.voxcpm_runtime.status()['installed'],'music_worker':True,'separator':self.server.separator_runtime.status()['installed']} + 'soulx_singer':self.server.soulx_singer_runtime.status()['installed'],'seed_vc':self.server.seed_vc_runtime.status()['installed'],'xvc':self.server.xvc_runtime.status()['installed'],'applio':self.server.applio_runtime.status()['installed'],'omnivoice':self.server.omnivoice_runtime.status()['installed'],'voxcpm':self.server.voxcpm_runtime.status()['installed'],'music_worker':True,'separator':self.server.separator_runtime.status()['installed']} def execution_setup(self, model, profile=None, installed=None): return execution_assess(model, self.execution_runtime_snapshot() if installed is None else installed, profile) @@ -397,7 +440,7 @@ class Handler(BaseHTTPRequestHandler): return self.respond({'error':'Anmeldung erforderlich.'},401) if not self.authenticated() and self.path == '/': return self.respond((ROOT/'login.html').read_bytes(), mime='text/html; charset=utf-8') - routes = {'/seed-vc-ui.js':('seed-vc-ui.js','text/javascript'),'/xvc-ui.js':('xvc-ui.js','text/javascript'),'/applio-ui.js':('applio-ui.js','text/javascript'),'/acestep-ui.js':('acestep-ui.js','text/javascript'),'/voice-ui.js':('voice-ui.js','text/javascript'),'/voxcpm-ui.js':('voxcpm-ui.js','text/javascript'),'/separator-ui.js':('separator-ui.js','text/javascript'),'/music-ui.js':('music-ui.js','text/javascript'),'/audio-cpp-ui.js':('audio-cpp-ui.js','text/javascript'),'/ltx-original-ui.js':('ltx-original-ui.js','text/javascript'),'/backup-ui.js':('backup-ui.js','text/javascript'),'/dashboard-ui.js':('dashboard-ui.js','text/javascript'),'/dashboard.css':('dashboard.css','text/css'),'/themes.css':('themes.css','text/css'),'/video-ui.js':('video-ui.js','text/javascript'),'/stt-ui.js':('stt-ui.js','text/javascript'),'/tts-ui.js':('tts-ui.js','text/javascript'),'/auto-test-ui.js':('auto-test-ui.js','text/javascript'),'/chat-test-ui.js':('chat-test-ui.js','text/javascript'),'/endpoint-ui.js':('endpoint-ui.js','text/javascript'),'/docker-ui.js': ('docker-ui.js','text/javascript'), '/': ('index.html', 'text/html; charset=utf-8'), '/app.js': ('app.js', 'text/javascript'), '/style.css': ('style.css', 'text/css'), '/network-ui.js': ('network-ui.js', 'text/javascript'), '/access-ui.js': ('access-ui.js', 'text/javascript'), '/studio.js': ('studio.js', 'text/javascript'), '/catalog-ui.js': ('catalog-ui.js','text/javascript'), '/runtime-ui.js': ('runtime-ui.js','text/javascript'), '/profiles-ui.js': ('profiles-ui.js','text/javascript'), '/image-test-ui.js': ('image-test-ui.js','text/javascript')} + routes = {'/soulx-singer-ui.js':('soulx-singer-ui.js','text/javascript'),'/seed-vc-ui.js':('seed-vc-ui.js','text/javascript'),'/xvc-ui.js':('xvc-ui.js','text/javascript'),'/applio-ui.js':('applio-ui.js','text/javascript'),'/acestep-ui.js':('acestep-ui.js','text/javascript'),'/voice-ui.js':('voice-ui.js','text/javascript'),'/voxcpm-ui.js':('voxcpm-ui.js','text/javascript'),'/separator-ui.js':('separator-ui.js','text/javascript'),'/music-ui.js':('music-ui.js','text/javascript'),'/audio-cpp-ui.js':('audio-cpp-ui.js','text/javascript'),'/ltx-original-ui.js':('ltx-original-ui.js','text/javascript'),'/backup-ui.js':('backup-ui.js','text/javascript'),'/dashboard-ui.js':('dashboard-ui.js','text/javascript'),'/dashboard.css':('dashboard.css','text/css'),'/themes.css':('themes.css','text/css'),'/video-ui.js':('video-ui.js','text/javascript'),'/stt-ui.js':('stt-ui.js','text/javascript'),'/tts-ui.js':('tts-ui.js','text/javascript'),'/auto-test-ui.js':('auto-test-ui.js','text/javascript'),'/chat-test-ui.js':('chat-test-ui.js','text/javascript'),'/endpoint-ui.js':('endpoint-ui.js','text/javascript'),'/docker-ui.js': ('docker-ui.js','text/javascript'), '/': ('index.html', 'text/html; charset=utf-8'), '/app.js': ('app.js', 'text/javascript'), '/style.css': ('style.css', 'text/css'), '/network-ui.js': ('network-ui.js', 'text/javascript'), '/access-ui.js': ('access-ui.js', 'text/javascript'), '/studio.js': ('studio.js', 'text/javascript'), '/catalog-ui.js': ('catalog-ui.js','text/javascript'), '/runtime-ui.js': ('runtime-ui.js','text/javascript'), '/profiles-ui.js': ('profiles-ui.js','text/javascript'), '/image-test-ui.js': ('image-test-ui.js','text/javascript')} if self.path in routes: name, mime = routes[self.path] return self.respond((ROOT/name).read_bytes(), mime=mime) @@ -430,8 +473,11 @@ class Handler(BaseHTTPRequestHandler): if self.path == '/api/v1/xvc-runtime':return self.respond(self.server.xvc_runtime.status()) if self.path == '/api/v1/xvc-runtime/log':return self.respond(self.server.xvc_runtime.log()) if self.path == '/api/v1/seed-vc':return self.respond(self.server.seed_vc.status()) + if self.path == '/api/v1/soulx-singer':return self.respond(self.server.soulx_singer.status()) if self.path == '/api/v1/seed-vc-runtime':return self.respond(self.server.seed_vc_runtime.status()) + if self.path == '/api/v1/soulx-singer-runtime':return self.respond(self.server.soulx_singer_runtime.status()) if self.path == '/api/v1/seed-vc-runtime/log':return self.respond(self.server.seed_vc_runtime.log()) + if self.path == '/api/v1/soulx-singer-runtime/log':return self.respond(self.server.soulx_singer_runtime.log()) if self.path == '/api/v1/applio':return self.respond(self.server.applio.status()) if self.path == '/api/v1/applio-runtime':return self.respond(self.server.applio_runtime.status()) if self.path == '/api/v1/applio-runtime/log':return self.respond(self.server.applio_runtime.log()) @@ -656,6 +702,13 @@ class Handler(BaseHTTPRequestHandler): if data:raise ValueError('Keine zusätzlichen Installationsfelder.') return self.respond(self.server.seed_vc_runtime.stop() if self.path.endswith('/cancel') else self.server.seed_vc_runtime.start()) except (ValueError,OSError) as exc:return self.respond({'error':str(exc)},400) + if self.path in ('/api/v1/soulx-singer-runtime/install','/api/v1/soulx-singer-runtime/cancel','/api/v1/soulx-singer/configure'): + try: + data=self.read_json() + if self.path.endswith('/configure'):return self.respond(self.server.soulx_singer.configure(data)) + if data:raise ValueError('Keine zusätzlichen Installationsfelder.') + return self.respond(self.server.soulx_singer_runtime.stop() if self.path.endswith('/cancel') else self.server.soulx_singer_runtime.start()) + except (ValueError,OSError) as exc:return self.respond({'error':str(exc)},400) if self.path in ('/api/v1/applio-runtime/install','/api/v1/applio-runtime/cancel','/api/v1/applio/configure'): try: data=self.read_json() @@ -923,7 +976,7 @@ def main(): server.video.close() server.endpoint.close() server.stt.stop() - server.seed_vc.stop();server.seed_vc_runtime.stop();server.applio.stop();server.applio_runtime.stop();server.voxcpm_tests.stop();server.tts_tests.stop() + server.soulx_singer.stop();server.soulx_singer_runtime.stop();server.seed_vc.stop();server.seed_vc_runtime.stop();server.applio.stop();server.applio_runtime.stop();server.voxcpm_tests.stop();server.tts_tests.stop() server.tts_runtime.stop();server.voxcpm_runtime.stop();server.omnivoice_runtime.stop() server.image_runtime.stop() server.ltx_original_runtime.stop() diff --git a/soulx-singer-ui.js b/soulx-singer-ui.js new file mode 100644 index 0000000..3b2bdde --- /dev/null +++ b/soulx-singer-ui.js @@ -0,0 +1,10 @@ +window.SoulXSingerUI=(()=>{ + function render(){const view=document.querySelector('#view');if(view.querySelector('#soulx-singer-page'))return; + view.innerHTML='

SoulX-Singer

Reinen Gesang anhand einer Referenzstimme umwandeln, ohne Stimmtraining; die native Laufzeit und GPU steuert Athena Deck.

SoulX-Singer einrichten

Installationsausgabe

Ausführung

Unsere SoulX-Singer-Oberfläche öffnen →

Vor einem Auftrag SoulX-Singer 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.

'; + const root=view.firstChild,el=id=>root.querySelector('#'+id);el('ap-link').href=DeckLinks.url(8138,'/');let dirty=false;el('ap-device').onchange=()=>dirty=true; + async function api(path,data){const r=await fetch('/api/v1/'+path,data?{method:'POST',headers:{'Content-Type':'application/json','X-Athena-Deck':'1'},body:JSON.stringify(data)}:{});const d=await r.json();if(!r.ok)throw Error(d.error||'Aktion fehlgeschlagen.');return d;} + async function poll(){if(!root.isConnected)return;try{const s=await api('soulx-singer-runtime'),a=await api('soulx-singer');if(!root.isConnected)return;el('ap-status').textContent=s.job?.phase||(s.installed?'SoulX-Singer installiert.':'Laufzeit fehlt.');el('ap-install').disabled=s.installed||s.job?.state==='running';el('ap-cancel').disabled=s.job?.state!=='running';el('ap-state').textContent=a.active?'SoulX-Singer-Auftrag läuft.':a.selected_profile?'Aktives Profil: '+a.selected_profile:'Noch kein SoulX-Singer-Profil aktiv.';if(!dirty)el('ap-device').value=a.device;if(s.job)el('ap-log').textContent=(await api('soulx-singer-runtime/log')).text;}catch(e){el('ap-error').textContent=e.message;}if(root.isConnected)setTimeout(poll,3000);} + for(const [id,path] of [['ap-install','soulx-singer-runtime/install'],['ap-cancel','soulx-singer-runtime/cancel']])el(id).onclick=async()=>{try{await api(path,{});}catch(e){el('ap-error').textContent=e.message;}}; + el('ap-save').onclick=async()=>{try{await api('soulx-singer/configure',{device:el('ap-device').value});dirty=false;}catch(e){el('ap-error').textContent=e.message;}};poll(); + }return {render}; +})(); diff --git a/soulx_singer.py b/soulx_singer.py new file mode 100644 index 0000000..e32a5b5 --- /dev/null +++ b/soulx_singer.py @@ -0,0 +1,61 @@ +"""Native SoulX-Singer UI backend, sharing Deck's voice-mode admission protocol.""" +import json,os,signal,subprocess,queue,threading +from pathlib import Path +from applio import Applio +def soulx_singer_model(model):return bool(model and model.get('kind')=='voice' and model.get('repo')=='Soul-AILab/SoulX-Singer' and model.get('file')=='model-svc.pt' and (model.get('runtime_metadata') or {}).get('architecture')=='soulx_singer') +class SoulXSinger(Applio): + label="SoulX-Singer" + def __init__(self,*args,**kwargs): + super().__init__(*args,**kwargs) + if not self.settings_path.exists():self.settings={'device':'5080'} + self.launch_queue=queue.Queue() + threading.Thread(target=self._launch_owner,daemon=True).start() + def _launch_owner(self): + # Linux PDEATHSIG follows the spawning thread. Keep that thread alive across + # HTTP handlers and one-time activation threads, for the whole Deck lifetime. + while not self.stop_event.is_set(): + try:args,kwargs,event,result=self.launch_queue.get(timeout=.2) + except queue.Empty:continue + try:result['process']=subprocess.Popen(args,**kwargs) + except Exception as exc:result['error']=exc + finally:event.set() + def _spawn(self,args,**kwargs): + event=threading.Event();result={};self.launch_queue.put((args,kwargs,event,result)) + if not event.wait(30):raise ValueError('SoulX-Prozessstart nicht bestätigt.') + if 'error' in result:raise result['error'] + return result['process'] + def selected(self):return next((p for p in self.profiles.status()['profiles'] if soulx_singer_model(p.get('model')) and p['id'] in self.enabled() and p['runnable']),None) + def blockers(self,p):return [] if self.runtime.status()['installed'] else ['SoulX-Singer-Laufzeit unter Laufzeiten installieren.'] + def status(self): + installed=self.runtime.status()['installed'] + if installed:self.ensure() + selected=self.selected() + return dict(installed=installed,device=self.settings['device'],active=self.active,backend_running=bool(self.process and self.process.poll() is None),selected_profile=selected['name'] if selected else None) + def unload_idle(self): + if self.active:raise ValueError('SoulX-Singer-Auftrag läuft; Wechsel erst danach möglich.') + if self.process and self.process.poll() is None: + try:os.killpg(self.process.pid,signal.SIGTERM);self.process.wait(10) + except subprocess.TimeoutExpired:os.killpg(self.process.pid,signal.SIGKILL);self.process.wait() + except ProcessLookupError:pass + self.process=None + self.ensure() # fresh CPU-only UI process; no weights load before the next lease + def configure(self,data): + if set(data)!={'device'} or data['device'] not in ('3060','5080'):raise ValueError('RTX 3060 oder RTX 5080 auswählen.') + with self.lock: + if self.active:raise ValueError('SoulX-Singer-Auftrag läuft; GPU erst danach ändern.') + self.settings=dict(data);temp=self.settings_path.with_suffix('.tmp');temp.write_text(json.dumps(data));temp.replace(self.settings_path) + self.unload_idle() + return self.status() + def ensure(self): + with self.lock: + if self.process and self.process.poll() is None:return + python,source=self.runtime.paths() + if not python.is_file():return + from image_test import probe + gpu=next((g for g in probe() if self.settings['device'] in g['name']),None) + if not gpu:return + for name in ('results','uploads','tmp'):(self.root/name).mkdir(exist_ok=True) + env={k:v for k,v in os.environ.items() if not k.startswith(('HF_','DECK_'))} + env.update(SOULX_SINGER_BIND=os.environ.get('DECK_BIND_HOST','127.0.0.1'),SOULX_WHISPER_PATH=str(source.parent/'assets/whisper-base'),SOULX_SINGER_SOURCE=str(source),SOULX_SINGER_ASSETS=str(source.parent/'assets'),SOULX_SINGER_OUTPUT=str(self.root/'results'),SOULX_SINGER_LEASE_SOCKET=str(self.socket),SOULX_SINGER_BRIDGE_KEY_FILE=str(self.root/'bridge-key'),CUDA_VISIBLE_DEVICES=gpu['uuid'],HF_HUB_OFFLINE='1',HF_HUB_DISABLE_TELEMETRY='1',GRADIO_ANALYTICS_ENABLED='False',GRADIO_TEMP_DIR=str(self.root/'uploads'),TMPDIR=str(self.root/'tmp'),OMP_NUM_THREADS='4',PYTHONPATH=str(source)) + script=Path(__file__).parent/'deploy/soulx-singer-web/native_ui.py';log=(self.root/'backend.log').open('a') + self.process=self._spawn([str(python),str(Path(__file__).parent/'applio_worker.py'),'--exec',str(python),str(script)],cwd=source,env=env,stdout=log,stderr=log,start_new_session=True);log.close() diff --git a/soulx_singer_runtime.py b/soulx_singer_runtime.py new file mode 100644 index 0000000..7e9b63b --- /dev/null +++ b/soulx_singer_runtime.py @@ -0,0 +1,42 @@ +"""Pinned SoulX SVC runtime; installation and restore do not use a GPU.""" +import hashlib,json,os,sys,time +from pathlib import Path +from ltx_original_runtime import LTXOriginalRuntime +REPO='Soul-AILab/SoulX-Singer' +REVISION='81aeb3ae772c70093c3de74dc23c92d983801ae4' +ASSETS=json.loads((Path(__file__).parent/'deploy/soulx-singer-svc/assets.json').read_text()) +MAIN=next(a for a in ASSETS if a['filename']=='model-svc.pt') +MODEL_REVISION=MAIN['revision'] +RECIPE_HASH=hashlib.sha256(json.dumps(ASSETS,sort_keys=True).encode()).hexdigest() +class SoulXSingerRuntime(LTXOriginalRuntime): + name='SoulX-Singer' + def paths(self): + try: + ready=json.loads((self.root/'ready.json').read_text()) + if ready['source_revision']==REVISION and (self.root/'ui-ready').is_file():return self.root/'python/bin/python',self.root/'source' + except (OSError,ValueError,KeyError):pass + return self.root/'missing-python',self.root/'missing-source' + def status(self): + python,source=self.paths() + return dict(installed=python.is_file() and (source/'cli/inference_svc.py').is_file(),revision=REVISION,model_revision=MODEL_REVISION,recipe_hash=RECIPE_HASH,job=dict(self.job) if self.job else None,required_disk_gib=20,origin=REPO,worker_available=True,message='Vorhandenen Gesang mit einer Referenzstimme umwandeln; 24 kHz, kein Training. Saubere Gesangsreferenz empfohlen.') + def ensure_library(self): + folder=self.root.parent/'models'/hashlib.sha256((REPO+MODEL_REVISION+MAIN['filename']).encode()).hexdigest();folder.mkdir(parents=True,exist_ok=True) + asset=self.root/'assets/soulx/model-svc.pt';target=folder/'model.pt';relative=os.path.relpath(asset,folder) + if target.is_symlink() and os.readlink(target)!=relative:raise ValueError('SoulX-Bibliothekslink zeigt auf fremde Datei.') + if not target.exists() and not target.is_symlink():target.symlink_to(relative) + if not target.is_symlink():raise ValueError('SoulX-Bibliotheksdatei ist kein verwalteter Link.') + (folder/'entry.json').write_text(json.dumps(dict(repo=REPO,revision=MODEL_REVISION,file=MAIN['filename'],kind='voice',size=MAIN['size'],sha256=MAIN['sha256'],upstream_hash_verified=True,downloaded_at=time.time(),runtime_metadata={'architecture':'soulx_singer'}))) + return folder.name + def _run(self): + state='failed';phase='SoulX-Einrichtung fehlgeschlagen.' + try: + env=dict(os.environ,CUDA_VISIBLE_DEVICES='',OMP_NUM_THREADS='2',MKL_NUM_THREADS='2') + recipe=Path(__file__).parent/'deploy/soulx-singer-svc/prepare.py' + self._phase('SoulX-Gewichte und isolierte Laufzeit vorbereiten') + self._command([sys.executable,recipe,self.root],env) + self._command([self.root/'python/bin/python','-c','import gradio,uvicorn,fastapi;assert gradio.__version__=="5.49.1"'],env) + (self.root/'ui-ready').write_text(REVISION);self.ensure_library();state='complete';phase='SoulX-Singer vorbereitet' + except InterruptedError:state='cancelled';phase='SoulX-Installation abgebrochen.' + except Exception as exc:phase=str(exc) + finally: + with self.lock:self.process=None;self.job.update(state=state,phase=phase,finished_at=time.time());self._save() diff --git a/studio.js b/studio.js index 41afbfe..555c996 100644 --- a/studio.js +++ b/studio.js @@ -8,7 +8,7 @@ const Studio=(()=>{ if(!force&&document.querySelector('#studio')?.dataset.page===page)return; if(category!==page){category=page;section='discover';} if(modelId)section='profiles'; - const body=page==='omnivoice-runtime'?VoxCPMUI.html().replaceAll('VoxCPM2','OmniVoice').replaceAll('VoxCPM','OmniVoice'):page==='voxcpm-runtime'?VoxCPMUI.html():page==='stt-runtime'?STTUI.html(true):page==='tts-runtime'?TTSUI.html(true):['docker-runtime','services'].includes(page)?DockerUI.html(page==='services'):page==='runtimes'?runtimeOverview():page==='image-runtime'?imageRuntime():page==='runtime'?RuntimeUI.html():`
ATHENA / MODELLVERWALTUNG

${labels[page]}

${audioDescriptions[page]||'Modelle entdecken, herunterladen und mit gespeicherten Profilen konfigurieren.'}

${page==='voice'?'

Seed-VC Gesang einrichten → · Applio / RVC einrichten → · Audio Separator einrichten → · Audio-Trennung →

Audio-Trennung nutzt die unterstützten Pakete im Audio-Separator-Bereich. Andere Hub-Dateien und Voice-Profile benötigen weiterhin eine geprüfte Anbindung.

':''}${audioDescriptions[page]&&!['audio','stt','music','voice','embeddings'].includes(page)?'

Entdecken und Downloads sind verfügbar. Für diese Audio-Bereiche ist noch keine ausführbare Laufzeit in Deck angebunden. Gespeicherte Profile sind vorbereitend.

':''}
${[['discover','Entdecken'],['library','Bibliothek'],['downloads','Downloads'],['profiles','Profile'],...(['audio','stt'].includes(page)?[['setup','Einrichten']]:[]),...(['image','chat','audio','stt','music','voice'].includes(page)?[['test','Testen'],...(page==='chat'?[['auto','Auto-Test']]:[])]:[])].map(([id,label])=>``).join('')}
${section==='setup'?(page==='stt'?STTUI.html(true):TTSUI.html(true)):['test','running'].includes(section)&&page==='music'?MusicUI.html():['test','running'].includes(section)&&page==='stt'?STTUI.html():['test','running'].includes(section)&&page==='audio'?TTSUI.html():section==='test'&&page==='voice'?VoiceUI.html():section==='auto'?AutoTestUI.html():section==='test'?(page==='chat'?ChatTestUI.html():ImageTestUI.html()):section==='running'&&page==='image'?ImageTestUI.html(true):section==='profiles'?ProfilesUI.html():section==='running'&&page==='chat'?EndpointUI.runningHTML():section==='running'?'

Keine von Deck gestarteten Modelle

Profile werden auf Athena gespeichert. Für diesen Bereich ist noch kein Modellworker angebunden. Fehlende Komponenten stehen beim jeweiligen Profil.

llama.cpp-Builds verwalten →
':CatalogUI.html(section==='library',section==='downloads')}
`; + const body=page==='omnivoice-runtime'?VoxCPMUI.html().replaceAll('VoxCPM2','OmniVoice').replaceAll('VoxCPM','OmniVoice'):page==='voxcpm-runtime'?VoxCPMUI.html():page==='stt-runtime'?STTUI.html(true):page==='tts-runtime'?TTSUI.html(true):['docker-runtime','services'].includes(page)?DockerUI.html(page==='services'):page==='runtimes'?runtimeOverview():page==='image-runtime'?imageRuntime():page==='runtime'?RuntimeUI.html():`
ATHENA / MODELLVERWALTUNG

${labels[page]}

${audioDescriptions[page]||'Modelle entdecken, herunterladen und mit gespeicherten Profilen konfigurieren.'}

${page==='voice'?'

SoulX-Singer einrichten → · Seed-VC Gesang einrichten → · Applio / RVC einrichten → · Audio Separator einrichten → · Audio-Trennung →

Audio-Trennung nutzt die unterstützten Pakete im Audio-Separator-Bereich. Andere Hub-Dateien und Voice-Profile benötigen weiterhin eine geprüfte Anbindung.

':''}${audioDescriptions[page]&&!['audio','stt','music','voice','embeddings'].includes(page)?'

Entdecken und Downloads sind verfügbar. Für diese Audio-Bereiche ist noch keine ausführbare Laufzeit in Deck angebunden. Gespeicherte Profile sind vorbereitend.

':''}
${[['discover','Entdecken'],['library','Bibliothek'],['downloads','Downloads'],['profiles','Profile'],...(['audio','stt'].includes(page)?[['setup','Einrichten']]:[]),...(['image','chat','audio','stt','music','voice'].includes(page)?[['test','Testen'],...(page==='chat'?[['auto','Auto-Test']]:[])]:[])].map(([id,label])=>``).join('')}
${section==='setup'?(page==='stt'?STTUI.html(true):TTSUI.html(true)):['test','running'].includes(section)&&page==='music'?MusicUI.html():['test','running'].includes(section)&&page==='stt'?STTUI.html():['test','running'].includes(section)&&page==='audio'?TTSUI.html():section==='test'&&page==='voice'?VoiceUI.html():section==='auto'?AutoTestUI.html():section==='test'?(page==='chat'?ChatTestUI.html():ImageTestUI.html()):section==='running'&&page==='image'?ImageTestUI.html(true):section==='profiles'?ProfilesUI.html():section==='running'&&page==='chat'?EndpointUI.runningHTML():section==='running'?'

Keine von Deck gestarteten Modelle

Profile werden auf Athena gespeichert. Für diesen Bereich ist noch kein Modellworker angebunden. Fehlende Komponenten stehen beim jeweiligen Profil.

llama.cpp-Builds verwalten →
':CatalogUI.html(section==='library',section==='downloads')}
`; document.querySelector('#view').innerHTML=`
${body}
`; document.querySelectorAll('[data-section]').forEach(b=>b.onclick=()=>{section=b.dataset.section;render(page,true);}); if(['docker-runtime','services'].includes(page)){DockerUI.bind(page==='services');return;} @@ -43,6 +43,7 @@ const Studio=(()=>{ ['VoxCPM','Stimmwerkzeuge','voxcpm-runtime','/api/v1/voxcpm-runtime','Originale VoxCPM-Python-Laufzeit installieren. Vorhandene CUDA-Pakete wiederverwenden; Modellkomponenten separat. Sprachausgabe und Stimmklonen unter Stimmwerkzeuge testen.'], ['OmniVoice','Stimmwerkzeuge','omnivoice-runtime','/api/v1/omnivoice-runtime','Originale OmniVoice-Laufzeit für Voice Design und Klonen. Profile und Komponenten in Stimmwerkzeuge.'], ['Seed-VC Gesang','Stimmwerkzeuge','seed-vc-runtime','/api/v1/seed-vc-runtime','Gesang in eine Referenzstimme umwandeln, ohne Training. 44,1 kHz; Originalprojekt archiviert.'], + ['SoulX-Singer Gesang','Stimmwerkzeuge','soulx-singer-runtime','/api/v1/soulx-singer-runtime','Gesang in eine Referenzstimme umwandeln, ohne Training. 24 kHz; vorhandenen Gesang umwandeln.'], ['X-VC','Stimmwerkzeuge','xvc-runtime','/api/v1/xvc-runtime','Audio-zu-Audio-Stimmumwandlung; native Laufzeit mit Resemble Enhance und bisheriger Oberfläche.'], ['Applio / RVC','Stimmwerkzeuge','applio-runtime','/api/v1/applio-runtime','Unsere eigene Oberfläche für Stimmen umwandeln, Live und Training. Native Applio-3.6.5-Laufzeit; GPU wird durch Deck gesteuert.'], ['Audio Separator','Audio-Trennung','separator-runtime','/api/v1/separator-runtime','Native CUDA-Laufzeit für BS-Roformer, MelBand und Demucs FT/6s. Vollständige Modellpakete mit überprüften Originalquellen und Prüfsummen.'] diff --git a/test_soulx_singer.py b/test_soulx_singer.py new file mode 100644 index 0000000..1ed90d7 --- /dev/null +++ b/test_soulx_singer.py @@ -0,0 +1,50 @@ +import copy,hashlib,json,tempfile,time,unittest,threading,subprocess,sys,os,signal +from pathlib import Path +from types import SimpleNamespace +from unittest.mock import patch +from test_applio import Tests as LeaseTests +from soulx_singer import SoulXSinger,soulx_singer_model +from soulx_singer_runtime import ASSETS,REVISION,MODEL_REVISION,REPO,RECIPE_HASH +from execution_setup import assess + +class Tests(LeaseTests): + def setUp(self): + super().setUp();self.a.stop() + self.profile.update(name='SoulX-Singer',model=dict(repo=REPO,file='model-svc.pt',kind='voice',runtime_metadata={'architecture':'soulx_singer'})) + self.a=SoulXSinger(Path(self.tmp.name),self.runtime,self.scheduler,self.profiles,lambda:self.active) + self.a.settings={'device':'3060'} + def test_real_profile_is_runnable_only_after_runtime_ready(self): + from catalog import Catalog + from profiles import Profiles + root=Path(self.tmp.name);catalog=Catalog(root/'models');ident=hashlib.sha256((REPO+MODEL_REVISION+'model-svc.pt').encode()).hexdigest();folder=catalog.root/ident;folder.mkdir(parents=True) + (folder/'model.pt').write_bytes(b'test');(folder/'entry.json').write_text(json.dumps(dict(repo=REPO,revision=MODEL_REVISION,file='model-svc.pt',kind='voice',size=4,sha256='b'*64,runtime_metadata={'architecture':'soulx_singer'}))) + profiles=Profiles(root/'profiles.json',catalog);profiles.save(dict(id=None,revision=0,name='SoulX-Singer Studio',api_id='soulx-singer-singing',kind='voice',model_id=ident,parameters={})) + profiles.soulx_singer_blockers=lambda p:['Laufzeit fehlt'];self.assertFalse(profiles.status()['profiles'][0]['runnable']) + profiles.soulx_singer_blockers=lambda p:[];self.assertTrue(profiles.status()['profiles'][0]['runnable']) + def test_rvc_recognition_does_not_guess_every_pth(self): + self.assertTrue(soulx_singer_model(self.profile['model']));self.assertFalse(soulx_singer_model(dict(kind='voice',file='model-svc.pt'))) + result=assess(self.profile['model'],{'soulx_singer':True});self.assertEqual(result['setup_steps'][1]['state'],'complete');self.assertEqual(result['components'],[]) + def test_worker_survives_short_lived_launching_thread(self): + result={} + def launch():result['p']=self.a._spawn([sys.executable,str(Path(__file__).parent/'applio_worker.py'),'--exec',sys.executable,'-c','import time;time.sleep(10)'],start_new_session=True) + thread=threading.Thread(target=launch);thread.start();thread.join();time.sleep(.2) + child=result['p'] + try:self.assertIsNone(child.poll()) + finally:os.killpg(child.pid,signal.SIGTERM);child.wait(5) + def test_assets_have_fixed_verified_sources(self): + self.assertEqual(len(ASSETS),6) + for item in ASSETS: + self.assertEqual(len(item['revision']),40);self.assertGreater(item['size'],0);self.assertTrue(item['sha256']) + self.assertNotIn('..',Path(item['filename']).parts) + self.assertEqual(len(RECIPE_HASH),64) + def test_apply_profile_refuses_running_deck(self): + from deploy.prepare_soulx_singer import apply_profile + with patch('deploy.prepare_soulx_singer.subprocess.run',return_value=SimpleNamespace(stdout=json.dumps([{'State':{'Running':True}}]))): + with self.assertRaisesRegex(ValueError,'Deck läuft'):apply_profile(self.tmp.name) + def test_container_backup_preserves_stopped_ui_and_rejects_unsafe_mount(self): + from deploy.docker_backup import validate + c=dict(name='athena-soulx-singer-web',image='athena-soulx-singer-web:0.1.0',registry=None,application='soulx-singer-web',labels={'io.athena-deck.managed':'true','io.athena-deck.role':'application','io.athena-deck.application':'soulx-singer-web'},env=[],entrypoint=None,cmd=None,user='65534:65534',uid=65534,workdir='/ui',network='host',ports={},restart='unless-stopped',memory=512*1024**2,nanocpus=10**9,running=False,build_recipe='soulx-singer-web',unsupported=False,mounts=[dict(index=0,target='/run/secrets/soulx-singer-bridge',read_only=True,deck_path='soulx_singer-data/bridge-key',was_file=True,files={})]) + self.assertFalse(validate(c)['running']);bad=copy.deepcopy(c);bad['mounts'][0]['read_only']=False + with self.assertRaises(ValueError):validate(bad) + +if __name__=='__main__':unittest.main() diff --git a/voice-ui.js b/voice-ui.js index 65b9e68..0678207 100644 --- a/voice-ui.js +++ b/voice-ui.js @@ -1,6 +1,6 @@ window.VoiceUI=(()=>{ const e=v=>String(v??'').replace(/[&<>"']/g,c=>({'&':'&','<':'<','>':'>','"':'"',"'":'''}[c])); - function html(){return `

Stimme ausprobieren · VoxCPM2 / OmniVoice

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 →

Ohne Transkript wählt OmniVoice aus langen Aufnahmen bei jedem Lauf einen zufälligen sprachhaltigen Ausschnitt. Mit eigenem Transkript bleibt die gesamte Aufnahme erhalten.

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.

`;} + function html(){return `

Stimme ausprobieren · VoxCPM2 / OmniVoice

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 → · SoulX-Singer öffnen → · X-VC Studio öffnen →

Ohne Transkript wählt OmniVoice aus langen Aufnahmen bei jedem Lauf einen zufälligen sprachhaltigen Ausschnitt. Mit eigenem Transkript bleibt die gesamte Aufnahme erhalten.

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.

`;} function bind(){const root=document.querySelector('#voice-panel');if(!root)return;const el=id=>root.querySelector('#'+id);let busy=false,lastResult='',ready=false; async function api(path='',body){const r=await fetch('/api/v1/voice'+path,body===undefined?{}:{method:'POST',headers:body instanceof FormData?{'X-Athena-Deck':'1'}:{'X-Athena-Deck':'1','Content-Type':'application/json'},body:body instanceof FormData?body:JSON.stringify(body)});const d=await r.json();if(!r.ok)throw Error(d.error||'Stimmgenerierung fehlgeschlagen');return d;} async function refresh(){try{const d=await api();if(!root.isConnected)return;const j=d.job;el('voice-status').textContent=(j?.phase||'Profil wählen und Text eingeben.')+(j?.gpu?' · '+j.gpu:'')+(Number.isInteger(j?.seed)?' · Seed '+j.seed:'')+(Number.isFinite(j?.reference_start_seconds)?' · Referenz '+j.reference_start_seconds.toFixed(1)+'–'+j.reference_end_seconds.toFixed(1)+' s':'');el('voice-progress').hidden=j?.state!=='running';el('voice-start').disabled=busy||!ready||!['llm','voice'].includes(d.mode)||j?.state==='running';el('voice-cancel').disabled=j?.state!=='running';if(j?.state==='complete'&&j.id!==lastResult){lastResult=j.id;el('voice-result').innerHTML=`

Ergebnis · ${Number(j.duration).toFixed(1)} Sekunden

WAV herunterladen

`;}}catch(err){if(root.isConnected)el('voice-error').textContent=err.message;}finally{if(root.isConnected)setTimeout(refresh,2000);}}