Add Seed-VC singing conversion runtime and studio

This commit is contained in:
Mikei386 committed 2026-10-06 18:41:57 +02:00
1 parent b5697912a7
commit ff69a75f72
30 files changed
+754 -28

No files matched your search

+22 -6
View File
@@ -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=('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=('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'}):raise ValueError('Ungültige Stimm-Modellmetadaten.')
if metadata is not None and metadata not in ({'architecture':'rvc'},{'architecture':'xvc'},{'architecture':'seed_vc'}):raise ValueError('Ungültige Stimm-Modellmetadaten.')
ids.add(m['id'])
pids=set();names=set();api_names=set()
for p in profiles:
@@ -97,6 +97,9 @@ def validate(doc):
if 'xvc-data/settings.json' in settings:
v=settings['xvc-data/settings.json']
if not isinstance(v,dict) or set(v)!={'device'} or v['device'] not in ('3060','5080'):raise ValueError('Ungültige X-VC-GPU.')
if '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 '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.')
@@ -105,7 +108,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','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','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']
@@ -115,6 +118,7 @@ def validate(doc):
if value['sources']!={name:SOURCES[name] for name in value['models']}:raise ValueError('Audio-Separator-Quellen stimmen nicht mit dem geprüften Rezept überein.')
if 'music_remix' in runtimes and type(runtimes['music_remix']) is not bool:raise ValueError('Ungültige Audio-Remix-Laufzeit.')
if 'xvc' in runtimes and type(runtimes['xvc']) is not bool:raise ValueError('Ungültige X-VC-Laufzeit.')
if 'seed_vc' in runtimes and type(runtimes['seed_vc']) is not bool:raise ValueError('Ungültige Seed-VC-Laufzeit.')
if 'applio' in runtimes and type(runtimes['applio']) is not bool:raise ValueError('Ungültige Applio-Laufzeit.')
if 'acestep' in runtimes and type(runtimes['acestep']) is not bool:raise ValueError('Ungültige ACE-Step-Laufzeit.')
if 'omnivoice' in runtimes and type(runtimes['omnivoice']) is not bool:raise ValueError('Ungültige OmniVoice-Laufzeit.')
@@ -170,7 +174,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'):item['runtime_metadata']={'architecture':architecture}
if (architecture:=(m.get('runtime_metadata') or {}).get('architecture')) in ('rvc','xvc','seed_vc'):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'])
@@ -198,6 +202,9 @@ class Backup:
if getattr(s,'xvc_runtime',None):
from xvc_runtime import RECIPE_HASH
document['runtimes']['xvc']=s.xvc_runtime.status()['installed'];document['runtime_versions']['xvc']=dict(code=s.xvc_runtime.status()['revision'],assets=RECIPE_HASH)
if getattr(s,'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,'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.')
@@ -263,10 +270,13 @@ class Backup:
if versions.get('xvc'):
from xvc_runtime import REVISION as XVC_REVISION,RECIPE_HASH
if versions['xvc']!=dict(code=XVC_REVISION,assets=RECIPE_HASH):blockers.append('Backup verlangt eine andere X-VC-Version oder Komponentenquelle.')
if versions.get('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('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','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','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
@@ -293,8 +303,9 @@ class Backup:
s=self.server
if getattr(getattr(s,'remix',None),'active',False):raise ValueError('Audio-Remix-Analyse zuerst abschließen.')
if getattr(getattr(s,'xvc',None),'active',False):raise ValueError('X-VC-Auftrag zuerst abschließen.')
if getattr(getattr(s,'seed_vc',None),'active',False):raise ValueError('Seed-VC-Auftrag zuerst abschließen.')
if getattr(getattr(s,'applio',None),'active',False):raise ValueError('Applio-Auftrag zuerst abschließen.')
if s.catalog.pending or s.catalog.job and s.catalog.job['state']=='downloading' or s.runtime.busy or any((getattr(o,'job',None) or {}).get('state')=='running' for o in (s.image_runtime,s.tts_runtime,s.ltx_original_runtime,getattr(s,'audio_cpp_runtime',None),getattr(s,'acestep_runtime',None),getattr(s,'applio_runtime',None),getattr(s,'xvc_runtime',None),getattr(s,'music',None),getattr(s,'remix_runtime',None),getattr(s,'remix',None),getattr(s,'separator_runtime',None),getattr(s,'separator_tests',None),s.prompt_enhancer,s.auto_tests,s.chat_tests,s.image_tests,s.tts_tests,s.stt)):raise ValueError('Zuerst laufende Downloads, Builds und Tests abschließen oder abbrechen.')
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.')
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()
@@ -322,6 +333,8 @@ class Backup:
self._phase('TTS-Laufzeit und Zusatzdateien installieren');s.tts_runtime.start();self._wait(s.tts_runtime.status)
if r.get('xvc') and not s.xvc_runtime.status()['installed']:
self._phase('X-VC-Laufzeit und geprüfte Zusatzgewichte installieren');s.xvc_runtime.start();self._wait(s.xvc_runtime.status)
if r.get('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('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']:
@@ -364,6 +377,7 @@ class Backup:
# Recovery key stays on this server in a separate protected file, never in status responses.
(rollback.with_suffix('.key')).write_text(key);rollback.with_suffix('.key').chmod(0o600)
if getattr(s,'xvc',None):s.xvc.unload_idle()
if getattr(s,'seed_vc',None):s.seed_vc.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
@@ -462,6 +476,7 @@ class Backup:
path=self.root/name;path.parent.mkdir(parents=True,exist_ok=True);path.write_text(value+'\n');path.chmod(0o600)
else:atomic_write(self.root/name,value)
if getattr(s,'xvc',None):s.xvc.settings=copy.deepcopy(doc['settings'].get('xvc-data/settings.json',{'device':'5080'}))
if getattr(s,'seed_vc',None):s.seed_vc.settings=copy.deepcopy(doc['settings'].get('seed_vc-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
@@ -496,6 +511,7 @@ class Backup:
if getattr(self.server,'omnivoice_runtime',None):self.server.omnivoice_runtime.stop()
if getattr(self.server,'voxcpm_runtime',None):self.server.voxcpm_runtime.stop()
if getattr(self.server,'xvc_runtime',None):self.server.xvc_runtime.stop()
if getattr(self.server,'seed_vc_runtime',None):self.server.seed_vc_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()