Fix Qwen voice alias backup and restore with version-bound maintenance export
This commit is contained in:
1 parent
4d39fc8d22
commit
33ad9ed3ff
11 files changed
+193
-14
No files matched your search
@@ -6,13 +6,16 @@ from pathlib import Path,PurePosixPath
|
||||
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
|
||||
from profiles import SCHEMAS,CHAT_GPU_DEFAULTS,chat_parameters,FLOAT_PARAMETERS,ACE_COMPONENTS,qwen_clone_model
|
||||
SETTINGS=('soulx_singer-data/settings.json','xvc-data/settings.json','applio-data/settings.json','separator-profiles.json','profiles.json','reasoning-budget.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.
|
||||
LOCAL_SOURCES={'83ee4f4f205fa514161778c41df1ea14144faa0f713510893b63c2395f5c2d53':dict(repo='unsloth/Qwen3.8-27B-GGUF',revision='4ca720788d1e01f1bff70c033e0d0028fd02e502',file='mmproj-BF16.gguf')}
|
||||
|
||||
def qwen_voice_alias(model):
|
||||
return qwen_clone_model(model) and model.get('id')==hashlib.sha256((model['repo']+model['revision']+'voice-clone').encode()).hexdigest()
|
||||
|
||||
def validate(doc):
|
||||
if not isinstance(doc,dict) or doc.get('format')!='athena-deck' or doc.get('version')!=VERSION:raise ValueError('Backup-Version nicht unterstützt.')
|
||||
if set(doc)-{'format','version','created_at','settings','models','credentials','theme','network','services','runtimes','warnings','history','runtime_versions'}:raise ValueError('Unbekannte Backup-Felder.')
|
||||
@@ -27,7 +30,7 @@ def validate(doc):
|
||||
local=m.get('source')=='local'
|
||||
if not re.fullmatch('[a-f0-9]{64}' if local else '[a-f0-9]{40}',m.get('revision','')) or m.get('kind') not in KINDS or type(m.get('size')) is not int or not 0<m['size']<4*1024**4:raise ValueError('Ungültige Modellquelle.')
|
||||
ident=hashlib.sha256((m['repo']+m['revision']+f).encode()).hexdigest()
|
||||
if (not local and m.get('id')!=ident) or not re.fullmatch('[a-f0-9]{64}',m.get('id','')) or m['id'] in ids or not re.fullmatch('[a-f0-9]{64}',m.get('sha256','')):raise ValueError('Ungültige Modell-ID oder Prüfsumme.')
|
||||
if (not local and m.get('id')!=ident and not qwen_voice_alias(m)) or not re.fullmatch('[a-f0-9]{64}',m.get('id','')) or m['id'] in ids or not re.fullmatch('[a-f0-9]{64}',m.get('sha256','')):raise ValueError('Ungültige Modell-ID oder Prüfsumme.')
|
||||
if local:
|
||||
if not m['repo'].startswith('local/') or m['revision']!=m['sha256']:raise ValueError('Ungültige lokale Modellherkunft.')
|
||||
source=m.get('download_source')
|
||||
@@ -118,6 +121,7 @@ def validate(doc):
|
||||
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','soulx_singer','music_remix','strata'} or not {'llama','llama_builds','image','tts','enhancers','swarm_nodes'}<=set(runtimes):raise ValueError('Ungültiges Laufzeitrezept.')
|
||||
if any(qwen_voice_alias(m) for m in models) and runtimes.get('tts') is not True:raise ValueError('Qwen-Stimmklon benötigt das vollständige TTS-Laufzeitrezept.')
|
||||
if 'separator' in runtimes:
|
||||
from separator_runtime import MODELS
|
||||
value=runtimes['separator']
|
||||
@@ -414,6 +418,10 @@ class Backup:
|
||||
self._runtimes(doc)
|
||||
for m in doc['models']:
|
||||
self._check();self._phase('Gewichte: '+m['file'])
|
||||
if qwen_voice_alias(m) and not (s.catalog.root/m['id']/'entry.json').exists():
|
||||
# Recreate the voice view of the complete Base package. Never rename the
|
||||
# canonical audio entry or download an isolated, unusable weight file.
|
||||
if not s.tts_runtime.status()['installed'] or s.tts_runtime.ensure_voice_library()!=m['id']:raise ValueError('Qwen-Stimmklon konnte nicht aus der TTS-Laufzeit rekonstruiert werden.')
|
||||
try:
|
||||
entry=s.catalog.entry(m['id']);path=s.catalog.root/m['id']/('model'+PurePosixPath(m['file']).suffix)
|
||||
digest=hashlib.sha256()
|
||||
|
||||
Reference in new issue
Block a user