Preserve verified mirror sources for reproducible model restore
This commit is contained in:
1 parent
03961e823a
commit
5b25237166
6 files changed
+210
-5
No files matched your search
@@ -1,5 +1,13 @@
|
|||||||
Preset embeddings copied unchanged from the retained old Athena Qwen TTS container.
|
Preset embeddings copied unchanged from the retained old Athena Qwen TTS container.
|
||||||
Source: https://huggingface.co/datasets/malaiwah/qwen3-tts-preset-voices
|
Source: https://huggingface.co/datasets/malaiwah/qwen3-tts-preset-voices
|
||||||
|
Verified upstream revision: c88ba0791733dcfb8b0c98cf5e456b026897a9a0 (2026-10-06).
|
||||||
|
Direct originals:
|
||||||
|
- https://huggingface.co/datasets/malaiwah/qwen3-tts-preset-voices/resolve/c88ba0791733dcfb8b0c98cf5e456b026897a9a0/bundle.safetensors
|
||||||
|
SHA-256: 206e7cc20ad2f067f7a0f5b60efc9823ff61917a48c7f01a54fbb0ac923364ca
|
||||||
|
- https://huggingface.co/datasets/malaiwah/qwen3-tts-preset-voices/resolve/c88ba0791733dcfb8b0c98cf5e456b026897a9a0/bundle.json
|
||||||
|
SHA-256: faae521f33055590166a12ada88c2d1d0c5c0111bc2207ef112e1dbf009f56b7
|
||||||
|
Both files were freshly downloaded and compared byte-for-byte with this bundle.
|
||||||
|
They are included in the application image, so recovery does not need the old router.
|
||||||
These rows originate from Qwen/Qwen3-TTS-12Hz-1.7B-CustomVoice (Apache-2.0).
|
These rows originate from Qwen/Qwen3-TTS-12Hz-1.7B-CustomVoice (Apache-2.0).
|
||||||
The accompanying bundle.json records speaker IDs and tensor provenance.
|
The accompanying bundle.json records speaker IDs and tensor provenance.
|
||||||
Used with Qwen3-TTS-12Hz-1.7B-Base as VoiceClonePromptItem, x_vector_only_mode=True,
|
Used with Qwen3-TTS-12Hz-1.7B-Base as VoiceClonePromptItem, x_vector_only_mode=True,
|
||||||
|
|||||||
@@ -30,11 +30,11 @@ def validate(doc):
|
|||||||
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) 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 local:
|
||||||
if not m['repo'].startswith('local/') or m['revision']!=m['sha256']:raise ValueError('Ungültige lokale Modellherkunft.')
|
if not m['repo'].startswith('local/') or m['revision']!=m['sha256']:raise ValueError('Ungültige lokale Modellherkunft.')
|
||||||
source=m.get('download_source')
|
source=m.get('download_source')
|
||||||
if source is not None:
|
if source is not None:
|
||||||
if not isinstance(source,dict) or set(source)!={'repo','revision','file'}:raise ValueError('Ungültige Ersatzquelle.')
|
if not isinstance(source,dict) or set(source)!={'repo','revision','file'}:raise ValueError('Ungültige Ersatzquelle.')
|
||||||
repo_id(source['repo'])
|
repo_id(source['repo']);sf=source['file']
|
||||||
if not re.fullmatch('[a-f0-9]{40}',source['revision']) or source['file'].startswith('/') or '..' in PurePosixPath(source['file']).parts or '\\' in source['file'] or any(ord(c)<32 for c in source['file']):raise ValueError('Ungültige Ersatzquelle.')
|
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')
|
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'}):raise ValueError('Ungültige Stimm-Modellmetadaten.')
|
||||||
ids.add(m['id'])
|
ids.add(m['id'])
|
||||||
@@ -173,6 +173,7 @@ class Backup:
|
|||||||
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'):item['runtime_metadata']={'architecture':architecture}
|
||||||
if m['repo'].startswith('local/'):
|
if m['repo'].startswith('local/'):
|
||||||
item['source']='local';item['download_source']=m.get('download_source') or LOCAL_SOURCES.get(m['sha256'])
|
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'])
|
||||||
models.append(item)
|
models.append(item)
|
||||||
state=s.runtime.status();active=next((b for b in state['builds'] if b['id']==state['active']),None)
|
state=s.runtime.status();active=next((b for b in state['builds'] if b['id']==state['active']),None)
|
||||||
llama={'commit':active['commit'],'backend':active['backend']} if active else None
|
llama={'commit':active['commit'],'backend':active['backend']} if active else None
|
||||||
|
|||||||
@@ -0,0 +1,101 @@
|
|||||||
|
"""Read-only public source audit. Input contains profiles and catalogue entries only.
|
||||||
|
|
||||||
|
Usage: python3 deploy/audit_model_sources.py catalogue.json report.json
|
||||||
|
No tokens, credentials, weight deletion, or model loading. Large files are checked
|
||||||
|
against upstream LFS SHA-256/size; small Git files are downloaded and hashed.
|
||||||
|
"""
|
||||||
|
import concurrent.futures
|
||||||
|
import datetime
|
||||||
|
import hashlib
|
||||||
|
import json
|
||||||
|
from pathlib import Path
|
||||||
|
import sys
|
||||||
|
import urllib.parse
|
||||||
|
import urllib.request
|
||||||
|
|
||||||
|
|
||||||
|
def fetch(url):
|
||||||
|
with urllib.request.urlopen(url, timeout=30) as response:
|
||||||
|
return response.read(8 * 1024 * 1024 + 1)
|
||||||
|
|
||||||
|
|
||||||
|
def audit(document):
|
||||||
|
referenced = set()
|
||||||
|
owners = {}
|
||||||
|
for profile in document['profiles']:
|
||||||
|
ids = [profile['model_id'], *profile.get('components', {}).values()]
|
||||||
|
ids.append(profile.get('parameters', {}).get('vision_projector'))
|
||||||
|
for preset in profile.get('presets', []):
|
||||||
|
ids += [preset['model_id'], preset.get('parameters', {}).get('vision_projector')]
|
||||||
|
for ident in filter(None, ids):
|
||||||
|
referenced.add(ident)
|
||||||
|
owners.setdefault(ident, set()).add(profile['name'])
|
||||||
|
keys = {(s['repo'], s['revision']) for entry in document['entries']
|
||||||
|
if not (s := entry.get('download_source') or entry)['repo'].startswith('local/')}
|
||||||
|
|
||||||
|
def metadata(key):
|
||||||
|
repo, revision = key
|
||||||
|
try:
|
||||||
|
data = json.loads(fetch(f'https://huggingface.co/api/models/{repo}/revision/{revision}?blobs=true'))
|
||||||
|
if data['sha'] != revision:
|
||||||
|
raise ValueError('Upstream revision differs')
|
||||||
|
return key, {item['rfilename']: item for item in data['siblings']}
|
||||||
|
except Exception as exc:
|
||||||
|
return key, str(exc)
|
||||||
|
|
||||||
|
with concurrent.futures.ThreadPoolExecutor(max_workers=4) as pool:
|
||||||
|
upstream = dict(pool.map(metadata, sorted(keys)))
|
||||||
|
|
||||||
|
def check(entry):
|
||||||
|
source = entry.get('download_source') or {k: entry[k] for k in ('repo', 'revision', 'file')}
|
||||||
|
result = {k: entry[k] for k in ('id', 'repo', 'revision', 'file', 'size', 'sha256')}
|
||||||
|
result.update(profiles=sorted(owners.get(entry['id'], [])), referenced=entry['id'] in referenced,
|
||||||
|
download_source=source)
|
||||||
|
if source['repo'].startswith('local/'):
|
||||||
|
return dict(result, status='private_backup_required', url=None)
|
||||||
|
url = f"https://huggingface.co/{source['repo']}/resolve/{source['revision']}/" + urllib.parse.quote(source['file'], safe='/')
|
||||||
|
result['url'] = url
|
||||||
|
try:
|
||||||
|
files = upstream[(source['repo'], source['revision'])]
|
||||||
|
if isinstance(files, str):
|
||||||
|
raise ValueError(files)
|
||||||
|
info = files[source['file']]
|
||||||
|
if info['size'] != entry['size']:
|
||||||
|
raise ValueError('Size differs')
|
||||||
|
if info.get('lfs'):
|
||||||
|
digest = info['lfs']['sha256']
|
||||||
|
method = 'fixed_revision_lfs_sha256_and_size'
|
||||||
|
elif info['size'] <= 8 * 1024 * 1024:
|
||||||
|
data = fetch(url)
|
||||||
|
digest = hashlib.sha256(data).hexdigest()
|
||||||
|
if len(data) != entry['size']:
|
||||||
|
raise ValueError('Downloaded size differs')
|
||||||
|
method = 'downloaded_sha256_and_size'
|
||||||
|
else:
|
||||||
|
raise ValueError('Large Git file cannot be verified without a full download')
|
||||||
|
if digest != entry['sha256']:
|
||||||
|
raise ValueError('SHA-256 differs')
|
||||||
|
return dict(result, status='verified', verification=method)
|
||||||
|
except Exception as exc:
|
||||||
|
return dict(result, status='unverified', error=str(exc))
|
||||||
|
|
||||||
|
with concurrent.futures.ThreadPoolExecutor(max_workers=4) as pool:
|
||||||
|
entries = list(pool.map(check, document['entries']))
|
||||||
|
missing = sorted(referenced - {entry['id'] for entry in entries})
|
||||||
|
return dict(checked_at=datetime.datetime.now(datetime.timezone.utc).isoformat(),
|
||||||
|
profiles=len(document['profiles']), referenced_files=len(referenced),
|
||||||
|
missing_references=missing, entries=entries,
|
||||||
|
scope='Profiles, components, vision projectors, presets, and entire catalogue; no full restore performed')
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
result = audit(json.loads(Path(sys.argv[1]).read_text()))
|
||||||
|
Path(sys.argv[2]).write_text(json.dumps(result, indent=2, ensure_ascii=False) + '\n')
|
||||||
|
for group, rows in [('profiles', [e for e in result['entries'] if e['referenced']]), ('catalogue', result['entries'])]:
|
||||||
|
print(group, {status: sum(e['status'] == status for e in rows)
|
||||||
|
for status in ('verified', 'private_backup_required', 'unverified')})
|
||||||
|
for entry in result['entries']:
|
||||||
|
if entry['status'] == 'unverified':
|
||||||
|
print(entry['repo'], entry['file'], entry.get('error'))
|
||||||
|
if result['missing_references']:
|
||||||
|
print('Missing references:', result['missing_references'])
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
# Modellquellen – 6. Oktober 2026
|
||||||
|
|
||||||
|
20 Profile; 75 referenzierte Dateien einschließlich Komponenten, Vision-Projektoren und Presets.
|
||||||
|
74 öffentlich verifiziert, eine private Stimme. Gesamte Bibliothek: 115 Dateien; 83 öffentlich verifiziert, 32 private Applio-Trainingsstände.
|
||||||
|
|
||||||
|
Prüfung: feste Hugging-Face-Revision, Dateiname, Größe und SHA-256. Kleine Git-Dateien wurden frisch geladen und gehasht; große Gewichte anhand der veröffentlichten LFS-Prüfsummen geprüft. Kein vollständiger Restore und kein erneuter Download aller großen Gewichte.
|
||||||
|
|
||||||
|
## Reparaturen
|
||||||
|
|
||||||
|
Die alte Quelle `abenzerps/Qwen-Image-2.1-Uncensored-GGUF` ist unter der gespeicherten Revision nicht mehr erreichbar. Die ursprüngliche Herkunft und Modell-ID bleiben erhalten; `download_source` speichert eine bytegleiche, verifizierte Ersatzquelle. Backup-Export und Restore berücksichtigen diese nun auch bei ursprünglich öffentlichen Dateien.
|
||||||
|
|
||||||
|
| Datei | Verifizierte Quelle |
|
||||||
|
|---|---|
|
||||||
|
| text_encoders/qwen3vl_8b_int8_convrot.safetensors | [Comfy-Org/Qwen3-VL](https://huggingface.co/Comfy-Org/Qwen3-VL/resolve/02f0d3eefb59528799653d16735818801177ef1f/text_encoders/qwen3vl_8b_int8_convrot.safetensors) |
|
||||||
|
| qwen-image-2.1-UC-Q8_0.gguf | [KasugaiSakura/Qwen-Image-2.1-Uncensored-Abenzerps-GGUF](https://huggingface.co/KasugaiSakura/Qwen-Image-2.1-Uncensored-Abenzerps-GGUF/resolve/240ef1d68f778115f8ff69965eca9ad6d3ccdcf1/qwen-image-2.1-UC-Q8_0.gguf) |
|
||||||
|
| mmproj-BF16.gguf | [unsloth/Qwen3.8-27B-GGUF](https://huggingface.co/unsloth/Qwen3.8-27B-GGUF/resolve/4ca720788d1e01f1bff70c033e0d0028fd02e502/mmproj-BF16.gguf) |
|
||||||
|
| vae/qwen_image_2.1_vae_bf16.safetensors | [Comfy-Org/Qwen-Image-2.1](https://huggingface.co/Comfy-Org/Qwen-Image-2.1/resolve/cb504a4090723e43f17ad01cec0359490e2de613/vae/qwen_image_2.1_vae_bf16.safetensors) |
|
||||||
|
|
||||||
|
## Private Stimmen
|
||||||
|
|
||||||
|
Private Applio-Gewichte besitzen keine behauptete öffentliche Quelle. Dazu gehören die im Profil verwendete Stimme und weitere Trainingsstände. Decks Konfigurationsbackup enthält keine Gewichte und warnt vor diesen Dateien; ein Restore bei fehlenden privaten Dateien wird blockiert.
|
||||||
|
|
||||||
|
Separat sichern: `runtime/state/models/` (insbesondere Einträge mit `repo=local/mikes-applio`) und `runtime/state/applio-data/` mit eigenen Stimmen, Indizes, Datensätzen und Trainingsständen. Diese Daten liegen bereits auf Athena; der alte Router ist dafür nicht erforderlich.
|
||||||
|
|
||||||
|
## Wiederholbare Prüfung
|
||||||
|
|
||||||
|
`deploy/audit_model_sources.py` akzeptiert einen JSON-Auszug mit ausschließlich `profiles` und `entries`. Es liest öffentliche Quellen ohne Token, lädt keine Modelle in die GPU und ändert keine Profile. Der vollständige Prüfbericht liegt lokal unter `Pruefberichte/Modellquellen-2026-10-06.json` und auf Athena unter `runtime/state/source-audit/`.
|
||||||
|
|
||||||
|
54 isolierte Tests: Backup, Katalog, Separator-Quellen und X-VC. Darunter ein Restore in eine leere Testbibliothek über eine Ersatzquelle mit unveränderter Profil-ID.
|
||||||
|
|
||||||
|
## Zusätzliche Laufzeitgewichte
|
||||||
|
|
||||||
|
78 Einträge von X-VC, Applio-Basisgewichten, SheetSage2/MERT-Remix und Separator/ClearVoice geprüft. 67 Hub-Dateien anhand fester Revision, SHA-256 bzw. Git-Blob und Größe verifiziert; 11 Separator-Release-Dateien sind per HTTP HEAD erreichbar. Bei diesen wird die bereits hinterlegte SHA-256 beim vollständigen Restore-Download geprüft; die großen Release-Gewichte wurden für dieses Audit nicht erneut geladen.
|
||||||
|
|
||||||
|
Die beiden mitgelieferten TTS-Stimmbündel wurden frisch von ihrem Original-Dataset geladen und bytegenau verglichen. Original-URLs, fester Commit und SHA-256 stehen in `assets/tts-presets/README.md`.
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
{
|
||||||
|
"3266897f6961d4d8988a0dfc942c5e574c579f5f4b9bdfed771bc3ae5776420d": {
|
||||||
|
"sha256": "8bfd0f6e12abf2d2d697ecc888e5e90b0d6741d6708f05799f53afa560452e8f",
|
||||||
|
"download_source": {
|
||||||
|
"repo": "Comfy-Org/Qwen3-VL",
|
||||||
|
"revision": "02f0d3eefb59528799653d16735818801177ef1f",
|
||||||
|
"file": "text_encoders/qwen3vl_8b_int8_convrot.safetensors"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"8378d0f48fcf27658246f8f07427f2e30f258e86a8e13408df05670ae2db8840": {
|
||||||
|
"sha256": "cde456c72ea3ecebfc1be783300e972711d875e0c5f1bed33d42b66b156affa8",
|
||||||
|
"download_source": {
|
||||||
|
"repo": "KasugaiSakura/Qwen-Image-2.1-Uncensored-Abenzerps-GGUF",
|
||||||
|
"revision": "240ef1d68f778115f8ff69965eca9ad6d3ccdcf1",
|
||||||
|
"file": "qwen-image-2.1-UC-Q8_0.gguf"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ed5fc51f01226df5c4f8820353193f3e1405a1172b504f61dbdf89db5906c916": {
|
||||||
|
"sha256": "83ee4f4f205fa514161778c41df1ea14144faa0f713510893b63c2395f5c2d53",
|
||||||
|
"download_source": {
|
||||||
|
"repo": "unsloth/Qwen3.8-27B-GGUF",
|
||||||
|
"revision": "4ca720788d1e01f1bff70c033e0d0028fd02e502",
|
||||||
|
"file": "mmproj-BF16.gguf"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"5c332f8730eaa793c0960108e8aa438a0844e237af618364fd3684d882c0493a": {
|
||||||
|
"sha256": "bb21f7473051e1ac368515dd3f2e15cd44d7a11748ee8823e1ddca3e4876b7c9",
|
||||||
|
"download_source": {
|
||||||
|
"repo": "Comfy-Org/Qwen-Image-2.1",
|
||||||
|
"revision": "cb504a4090723e43f17ad01cec0359490e2de613",
|
||||||
|
"file": "vae/qwen_image_2.1_vae_bf16.safetensors"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -170,6 +170,32 @@ class RestoreTests(unittest.TestCase):
|
|||||||
self.assertEqual(job['state'],'complete',job)
|
self.assertEqual(job['state'],'complete',job)
|
||||||
self.assertEqual(self.server.profiles.rows[0]['model_id'],ident)
|
self.assertEqual(self.server.profiles.rows[0]['model_id'],ident)
|
||||||
self.assertEqual(json.loads((self.root/'models'/ident/'entry.json').read_text())['download_source'],model['download_source'])
|
self.assertEqual(json.loads((self.root/'models'/ident/'entry.json').read_text())['download_source'],model['download_source'])
|
||||||
|
def test_public_mirror_export_and_empty_restore_preserve_original_identity(self):
|
||||||
|
ident=self.model();self.profile(ident);path=self.root/'models'/ident/'entry.json'
|
||||||
|
entry=json.loads(path.read_text());source=dict(repo='test/mirror',revision='b'*40,file='mirror.gguf')
|
||||||
|
entry['download_source']=source;path.write_text(json.dumps(entry))
|
||||||
|
doc=self.server.backup.snapshot(include_history=False);validate(doc)
|
||||||
|
self.assertEqual(doc['models'][0]['download_source'],source)
|
||||||
|
for invalid in (dict(source,revision='main'),dict(source,file='../escape'),dict(source,file=42)):
|
||||||
|
bad=copy.deepcopy(doc);bad['models'][0]['download_source']=invalid
|
||||||
|
with self.assertRaises(ValueError):validate(bad)
|
||||||
|
data=(path.parent/'model.gguf').read_bytes()
|
||||||
|
import shutil
|
||||||
|
shutil.rmtree(path.parent)
|
||||||
|
source_id=hashlib.sha256((source['repo']+source['revision']+source['file']).encode()).hexdigest()
|
||||||
|
def download(repo,filename,revision,kind):
|
||||||
|
self.assertEqual((repo,filename,revision),(source['repo'],source['file'],source['revision']))
|
||||||
|
folder=self.root/'models'/source_id;folder.mkdir();(folder/'model.gguf').write_bytes(data)
|
||||||
|
(folder/'entry.json').write_text(json.dumps(dict(repo=repo,revision=revision,file=filename,size=len(data),sha256=entry['sha256'],kind=kind,state='downloaded')))
|
||||||
|
self.server.catalog.job={'state':'complete'}
|
||||||
|
with patch.object(self.server.catalog,'start',side_effect=download):
|
||||||
|
summary=self.server.backup.inspect(seal(doc,'backup secure password'),'backup secure password')
|
||||||
|
self.assertFalse(summary['blockers'])
|
||||||
|
self.server.backup.start(dict(id=summary['id'],services=[],confirm=True,restore_credentials=False));job=self.wait()
|
||||||
|
self.assertEqual(job['state'],'complete',job)
|
||||||
|
restored=self.server.catalog.entry(ident)
|
||||||
|
self.assertEqual(restored['repo'],entry['repo']);self.assertEqual(restored['revision'],entry['revision'])
|
||||||
|
self.assertEqual(restored['download_source'],source);self.assertEqual(self.server.profiles.rows[0]['model_id'],ident)
|
||||||
def test_buildable_local_container_does_not_warn_about_missing_source(self):
|
def test_buildable_local_container_does_not_warn_about_missing_source(self):
|
||||||
doc=self.server.backup.snapshot(include_history=False);c=ContainerTests().config()
|
doc=self.server.backup.snapshot(include_history=False);c=ContainerTests().config()
|
||||||
c.update(name='athena-ladypoly',image='athena-ladypoly:3960afc-deck1',registry=None,network='host',build_recipe='ladypoly')
|
c.update(name='athena-ladypoly',image='athena-ladypoly:3960afc-deck1',registry=None,network='host',build_recipe='ladypoly')
|
||||||
|
|||||||
Reference in new issue
Block a user