update reference displays

Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
Vladimir Mandic
2026-07-03 12:51:28 +02:00
parent 022d7ca481
commit 5cda0aeeb2
6 changed files with 60 additions and 17 deletions
+33 -13
View File
@@ -16,13 +16,19 @@ version_map = {
"FluxKontext": "Flux",
"SDXL 1.0": "SD XL",
"SDXL Hyper": "SD XL",
"StableDiffusion": "SD 1.5",
"StableDiffusion3": "SD 3",
"StableDiffusionXL": "SD XL",
"WanToVideo": "Wan",
"WanVACE": "Wan",
"Z": "Z-Image",
"Glm": "GLM-Image",
"Krea2": "Krea 2",
"AnimaTextTo": "Anima",
"Ideogram4": "Ideogram 4",
"Flux2": "Flux 2",
"Flux2Klein": "Flux 2 Klein",
"Flux2KleinKV": "Flux 2 Klein",
}
class ExtraNetworksPageCheckpoints(ui_extra_networks.ExtraNetworksPage):
@@ -51,7 +57,10 @@ class ExtraNetworksPageCheckpoints(ui_extra_networks.ExtraNetworksPage):
dct = readfile(fn, as_type="dict", silent=True)
for k, v in dct.items():
v['skip'] = 'safetensors' not in v.get('path', '')
v['tags'] = tag
v['tags'] = [tag.capitalize()]
size = v.get('size', 0)
if size > 0:
v['tags'].append(f'Size: {size} GB')
shared.reference_models[k] = v
for k, v in shared.reference_models.items():
@@ -72,33 +81,44 @@ class ExtraNetworksPageCheckpoints(ui_extra_networks.ExtraNetworksPage):
name = os.path.normpath(os.path.join(paths.reference_path, k)).replace('\\', '/')
size = int(float(v.get('size', 0)) * 1024 * 1024 * 1024)
mtime = v.get('date', None)
_size, _mtime = modelstats.stat(preview_file)
if mtime is None:
_size, mtime = modelstats.stat(preview_file)
mtime = _mtime
else:
try:
mtime = datetime.strptime(mtime, '%Y %B') # 2025 January
mtime = datetime.strptime(_mtime, '%Y %B') # 2025 January
except Exception:
_size, mtime = modelstats.stat(preview_file)
pass
if size == 0:
size = _size
if len(v.get("subfolder", "")) > 0:
path = f'{v.get("path", "")}+{v.get("subfolder", "")}'
else:
path = f'{v.get("path", "")}'
tag = v.get('tags', '')
tag = tag.split(',')[0].strip() # take first tag if multiple
if tag == 'nunchaku' and (devices.backend != 'cuda' and not shared.cmd_opts.experimental):
tag = v.get('tags', [])
if isinstance(tag, list):
tag = ', '.join(tag)
if isinstance(tag, list) and len(tag) > 0:
primary = tag[0].strip()
elif isinstance(tag, str):
primary = tag.split(',')[0].strip() if len(tag) > 0 else ''
else:
primary = ''
if ('nunchaku' in tag) and (devices.backend != 'cuda' and not shared.cmd_opts.experimental):
count['hidden'] += 1
continue
if tag in count:
count[tag] += 1
elif tag != '':
count[tag] = 1
if primary in count:
count[primary] += 1
elif primary != '':
count[primary] = 1
else:
count['base'] += 1
ready = reference_downloaded(url)
version = "ready" if ready else "download"
if tag == 'cloud':
if 'cloud' in tag :
version = 'Cloud'
if not ready and shared.opts.offline_mode:
count['hidden'] += 1
@@ -121,7 +141,7 @@ class ExtraNetworksPageCheckpoints(ui_extra_networks.ExtraNetworksPage):
"metadata": {},
"description": v.get('desc', ''),
"version": version,
"tags": tag,
"tags": v.get('tags', []),
}
log.debug(f'Networks: type="reference" {count}')