Add version-bound LTX 2.5 video component recipe

This commit is contained in:
Mikei386
2026-09-29 12:13:54 +02:00
parent 7f38286f72
commit 7910307cfb
6 changed files with 84 additions and 17 deletions
+10 -6
View File
@@ -58,6 +58,8 @@ def file_role(filename):
role,label='text_encoder','Textencoder'
elif 'vae' in parts or re.search(r'(?:^|[/_-])vae(?:[/_.-]|$)',name):
role,label='vae','VAE'
elif any(p in ('latent_upscale_models','model_patches','loras') for p in parts):
role,label='auxiliary','Zusatzkomponente'
elif re.search(r'(?:^|[/_-])(?:lora|adapter)(?:[/_.-]|$)',name):
role,label='auxiliary','Zusatzkomponente'
elif name.endswith(('.gguf','.safetensors')):
@@ -154,12 +156,14 @@ class Catalog:
scanned=len(rows)
if base_only:rows=[x for x in rows if not is_derived_model(x)]
return {'models':[dict(repo=x['id'],downloads=x.get('downloads'),gated=x.get('gated',False),created_at=x.get('createdAt'),capabilities=capabilities(x)) for x in rows[:20]],'base_only':base_only,'scanned':scanned,'notice':notice}
def files(self,repo):
def files(self,repo,revision=None):
repo=repo_id(repo)
if revision is not None and (not isinstance(revision,str) or not re.fullmatch("[a-f0-9]{40}",revision)):raise ValueError("Ungültige Quellversion.")
cache_key=(repo,revision)
with self.cache_lock:
cached=self.cache.get(repo)
cached=self.cache.get(cache_key)
if cached and time.monotonic()-cached[0]<300:return cached[1]
data=self._metadata('/api/models/'+repo+'?blobs=true')
data=self._metadata('/api/models/'+repo+('/revision/'+revision if revision else '')+'?blobs=true')
revision=data.get('sha','')
if not re.fullmatch('[a-f0-9]{40}',revision):raise ValueError('Keine feste Repository-Version verfügbar.')
files=[]
@@ -172,7 +176,7 @@ class Catalog:
result=dict(auth_configured=self.hub_auth.status()['configured'],capabilities=capabilities(data),repo=repo,revision=revision,files=files,gated=data.get('gated',False),license=(data.get('cardData') or {}).get('license'),url='https://huggingface.co/'+repo)
with self.cache_lock:
if len(self.cache)>=64:self.cache.pop(next(iter(self.cache)))
self.cache[repo]=(time.monotonic(),result)
self.cache[cache_key]=(time.monotonic(),result)
return result
def status(self):
with self.lock:
@@ -188,8 +192,8 @@ class Catalog:
with self.lock:
if self.closing:raise ValueError('Deck wird beendet.')
if len(self.pending)>=20:raise ValueError('Warteschlange voll (20 Dateien).')
with self.cache_lock:self.cache.pop(repo,None)
data=self.files(repo)
with self.cache_lock:self.cache.pop((repo,revision),None)
data=self.files(repo,revision)
if data['gated'] and not self.hub_auth.token():raise ValueError('Dieses Repository benötigt eine Freigabe und einen Hugging-Face-Token unter Einstellungen → Zugang.')
if revision!=data['revision']:raise ValueError('Repository wurde geändert. Dateiliste neu laden.')
item=next((x for x in data['files'] if x['name']==filename),None)