refactor pipeline loaders to generic methods and introduce te_shared_t5 option

Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
Vladimir Mandic
2025-08-10 20:49:58 -04:00
parent f45e3342e6
commit 2a85c05689
22 changed files with 347 additions and 811 deletions
+56 -46
View File
@@ -20,39 +20,47 @@ models = [
"sdxl-base-v10-vaefix",
"tempest-by-vlad-0.1",
"icbinpXL_v6",
"briaai/BRIA-3.2",
"Freepik/F-Lite",
"Freepik/F-Lite-Texture",
"ostris/Flex.2-preview",
"stabilityai/stable-diffusion-3.5-medium",
"stabilityai/stable-diffusion-3.5-large",
"fal/AuraFlow-v0.3",
"THUDM/CogView3-Plus-3B",
"THUDM/CogView4-6B",
"nvidia/Cosmos-Predict2-2B-Text2Image",
"nvidia/Cosmos-Predict2-14B-Text2Image",
"Qwen/Qwen-Image",
"Qwen/Qwen-Lightning",
"Shitao/OmniGen-v1-diffusers",
"OmniGen2/OmniGen2",
"HiDream-ai/HiDream-I1-Full",
"Kwai-Kolors/Kolors-diffusers",
"vladmandic/chroma-unlocked-v50",
"vladmandic/chroma-unlocked-v50-annealed",
"Alpha-VLLM/Lumina-Next-SFT-diffusers",
"Alpha-VLLM/Lumina-Image-2.0",
"MeissonFlow/Meissonic",
"Efficient-Large-Model/SANA1.5_1.6B_1024px_diffusers",
"Efficient-Large-Model/SANA1.5_4.8B_1024px_diffusers",
"PixArt-alpha/PixArt-XL-2-1024-MS",
"PixArt-alpha/PixArt-Sigma-XL-2-1024-MS",
"Wan-AI/Wan2.1-T2V-1.3B-Diffusers",
"Wan-AI/Wan2.1-T2V-14B-Diffusers",
"stabilityai/stable-cascade",
]
models_tbd = [
"black-forest-labs/FLUX.1-dev",
"black-forest-labs/FLUX.1-Kontext-dev",
"black-forest-labs/FLUX.1-Krea-dev",
"vladmandic/chroma-unlocked-v50",
"vladmandic/chroma-unlocked-v50-annealed",
"Qwen/Qwen-Image",
"briaai/BRIA-3.2",
"stabilityai/stable-cascade",
"ostris/Flex.2-preview",
"OmniGen2/OmniGen2",
"Freepik/F-Lite",
"Freepik/F-Lite-Texture",
"HiDream-ai/HiDream-I1-Full",
"nvidia/Cosmos-Predict2-2B-Text2Image",
"nvidia/Cosmos-Predict2-14B-Text2Image",
"Wan-AI/Wan2.1-T2V-1.3B-Diffusers",
"Wan-AI/Wan2.1-T2V-14B-Diffusers",
"Efficient-Large-Model/SANA1.5_1.6B_1024px_diffusers",
"Efficient-Large-Model/SANA1.5_4.8B_1024px_diffusers",
"fal/AuraFlow-v0.3",
"PixArt-alpha/PixArt-XL-2-1024-MS",
"PixArt-alpha/PixArt-Sigma-XL-2-1024-MS",
"Tencent-Hunyuan/HunyuanDiT-v1.2-Diffusers",
"Alpha-VLLM/Lumina-Next-SFT-diffusers",
"Alpha-VLLM/Lumina-Image-2.0",
"Kwai-Kolors/Kolors-diffusers",
"THUDM/CogView4-6B",
"kandinsky-community/kandinsky-3",
"Tencent-Hunyuan/HunyuanDiT-v1.2-Diffusers", # TODO
"kandinsky-community/kandinsky-3", # TODO
]
styles = [
'Fixed Astronaut',
]
styles_tbd = [
'Fixed Bear',
'Fixed Steampunk City',
'Fixed Road sign',
@@ -89,27 +97,29 @@ def generate(): # pylint: disable=redefined-outer-name
model_name = pathvalidate.sanitize_filename(model, replacement_text='_')
log.info(f'model: name="{model}" n={m+1}/{len(models)}')
for s, style in enumerate(styles):
model_name = pathvalidate.sanitize_filename(model, replacement_text='_')
style_name = pathvalidate.sanitize_filename(style, replacement_text='_')
fn = os.path.join(output_folder, f'{model_name}__{style_name}.jpg')
if os.path.exists(fn):
continue
request(f'/sdapi/v1/checkpoint?sd_model_checkpoint={model}', method='POST')
loaded = request('/sdapi/v1/checkpoint', method='GET')
if not (model in loaded.get('checkpoint') or model in loaded.get('title') or model in loaded.get('name')):
log.error(f' model: error="{model}"')
continue
log.info(f' style: name="{style}" n={s+1}/{len(styles)} fn="{fn}"')
t0 = time.time()
data = request('/sdapi/v1/txt2img', { 'styles': [style] })
t1 = time.time()
if 'images' in data and len(data['images']) > 0:
b64 = data['images'][0].split(',',1)[0]
image = Image.open(io.BytesIO(base64.b64decode(b64)))
info = data['info']
log.info(f' image: size={image.size} time={t1-t0:.2f} info="{len(info)}" fn="{fn}"')
image.save(fn)
try:
model_name = pathvalidate.sanitize_filename(model, replacement_text='_')
style_name = pathvalidate.sanitize_filename(style, replacement_text='_')
fn = os.path.join(output_folder, f'{model_name}__{style_name}.jpg')
if os.path.exists(fn):
continue
request(f'/sdapi/v1/checkpoint?sd_model_checkpoint={model}', method='POST')
loaded = request('/sdapi/v1/checkpoint', method='GET')
if not loaded or not (model in loaded.get('checkpoint') or model in loaded.get('title') or model in loaded.get('name')):
log.error(f' model: error="{model}"')
continue
log.info(f' style: name="{style}" n={s+1}/{len(styles)} fn="{fn}"')
t0 = time.time()
data = request('/sdapi/v1/txt2img', { 'styles': [style] })
t1 = time.time()
if 'images' in data and len(data['images']) > 0:
b64 = data['images'][0].split(',',1)[0]
image = Image.open(io.BytesIO(base64.b64decode(b64)))
info = data['info']
log.info(f' image: size={image.size} time={t1-t0:.2f} info="{len(info)}" fn="{fn}"')
image.save(fn)
except Exception as e:
log.error(f' model: error="{model}" style="{style}" exception="{e}"')
if __name__ == "__main__":
log.info('test-all-models')