Complete X-VC, YuE2 audio remix and ClearVoice integration

This commit is contained in:
Mikei386 committed 2026-10-05 22:09:13 +02:00
1 parent 83cd31878c
commit b99abaea25
52 files changed
+1973 -122

No files matched your search

+21 -2
View File
@@ -14,11 +14,13 @@ def verify_package(directory,name):
for chunk in iter(lambda:stream.read(1024**2),b''):digest.update(chunk)
if digest.hexdigest()!=item['sha256']:return False
return True
CLEARVOICE='MossFormer2_SE_48K'
MODELS={
'vocals_mel_band_roformer.ckpt':('MelBand RoFormer · Gesang / Instrumental','vocals_mel_band_roformer.yaml'),
'model_bs_roformer_ep_317_sdr_12.9755.ckpt':('BS-RoFormer · Gesang / Instrumental','model_bs_roformer_ep_317_sdr_12.9755.yaml'),
'htdemucs_ft.yaml':('Demucs FT · Gesang / Schlagzeug / Bass / Rest','htdemucs_ft.yaml'),
'htdemucs_6s.yaml':('Demucs 6s · zusätzlich Gitarre / Piano','htdemucs_6s.yaml')}
'htdemucs_6s.yaml':('Demucs 6s · zusätzlich Gitarre / Piano','htdemucs_6s.yaml'),
CLEARVOICE:('ClearVoice · Sprache / Hintergrund','clearvoice/MossFormer2_SE_48K/last_best_checkpoint')}
class SeparatorRuntime(LTXOriginalRuntime):
name='Audio Separator'
def __init__(self,root):super().__init__(root,None)
@@ -30,11 +32,26 @@ class SeparatorRuntime(LTXOriginalRuntime):
base=self.root/ident
if (base/'ready').is_file():return base/'python/bin/python',base
return self.root/'missing-python',self.root/'missing-runtime'
def worker_python(self,name):
if name==CLEARVOICE:return self.paths()[1]/'clearvoice-python/bin/python'
return self.paths()[0]
def ensure_clearvoice(self):
python,base=self.paths();target=base/'clearvoice-python/bin/python'
if target.is_file() and (base/'clearvoice-ready').is_file():return
self._phase('ClearVoice · eigene Python-Umgebung mit geteilter CUDA-Laufzeit')
self._command([python,'-m','venv',base/'clearvoice-python'])
from cuda_overlay import share_cuda
share_cuda(target,base/'clearvoice-python',python,self._command)
self._command([target,'-m','pip','install','--no-cache-dir','clearvoice==0.1.2','numpy==1.26.4','huggingface-hub==0.36.0','torch==2.11.0','torchaudio==2.11.0','torchvision==0.26.0'])
self._command([target,'-m','pip','check'])
self._command([target,'-c','import torch,clearvoice,numpy;assert torch.version.cuda;assert numpy.__version__=="1.26.4"'])
(base/'clearvoice-ready').write_text('clearvoice==0.1.2\n numpy==1.26.4')
def status(self):
python,base=self.paths()
return dict(installed=python.is_file() and (base/'ready').is_file(),version=VERSION,required_disk_gib=15,job=dict(self.job) if self.job else None,models=[dict(id=name,name=label,configuration=config,source=SOURCES[name],installed=self.model_ready(name)) for name,(label,config) in MODELS.items()])
def model_ready(self,name):
if name not in MODELS:return False
if name==CLEARVOICE and not (self.paths()[1]/'clearvoice-ready').is_file():return False
directory=self.root/'models';marker=directory/(name+'.ready')
try:
recorded=json.loads(marker.read_text())
@@ -60,10 +77,12 @@ class SeparatorRuntime(LTXOriginalRuntime):
base=self.root/self.job['id'];state='failed';phase='Einrichtung fehlgeschlagen.';model=getattr(self,'requested_model',None)
try:
if model:
if model==CLEARVOICE:self.ensure_clearvoice()
directory=base;directory.mkdir(mode=0o700)
import urllib.request
for item in SOURCES[model]['files']:
self._phase('Modellpaket: '+item['file'])
(directory/item['file']).parent.mkdir(parents=True,exist_ok=True)
succeeded=False
for url in item['urls']:
try:
@@ -87,7 +106,7 @@ class SeparatorRuntime(LTXOriginalRuntime):
digest=hashlib.sha256()
with (directory/f).open('rb') as source:
for chunk in iter(lambda:source.read(1024**2),b''):digest.update(chunk)
hashes[f]=digest.hexdigest();(directory/f).replace(destination/f)
hashes[f]=digest.hexdigest();(destination/f).parent.mkdir(parents=True,exist_ok=True);(directory/f).replace(destination/f)
(destination/(model+'.ready')).write_text(json.dumps(hashes))
state='complete';phase='Modell und passende Konfiguration heruntergeladen. Kein Modell geladen.'
else: