mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 17:24:32 +02:00
add GLM-Image pipeline support
- Add GLM-Image (zai-org/GLM-Image) model detection and loading - Custom pipeline loader with proper component handling: - ByT5 text encoder (cannot use shared T5 due to different hidden size) - Vision-language encoder (9B AR model) - DiT transformer (7B) - Fix EOS token early stopping in AR generation - Add AR token generation progress tracking with terminal progress bar - Fix uninitialized audio variable in processing - Add TAESD support for GLM-Image (using f1 variant)
This commit is contained in:
@@ -78,6 +78,8 @@ def get_model_type(pipe):
|
||||
model_type = 'prx'
|
||||
elif 'LongCat' in name:
|
||||
model_type = 'longcat'
|
||||
elif 'GlmImage' in name:
|
||||
model_type = 'glm_image'
|
||||
elif 'Ovis-Image' in name:
|
||||
model_type = 'ovis'
|
||||
# video models
|
||||
|
||||
@@ -400,6 +400,7 @@ def process_images_inner(p: StableDiffusionProcessing) -> Processed:
|
||||
infotexts = []
|
||||
output_images = []
|
||||
output_binary = None
|
||||
audio = None
|
||||
|
||||
process_init(p)
|
||||
if p.scripts is not None and isinstance(p.scripts, scripts_manager.ScriptRunner):
|
||||
|
||||
@@ -156,6 +156,8 @@ def task_specific_kwargs(p, model):
|
||||
task_args['reference_images'] = p.init_images
|
||||
if ('GoogleNanoBananaPipeline' in model_cls) and (p.init_images is not None) and (len(p.init_images) > 0):
|
||||
task_args['image'] = p.init_images[0]
|
||||
if ('GlmImagePipeline' in model_cls) and (p.init_images is not None) and (len(p.init_images) > 0):
|
||||
task_args['image'] = p.init_images
|
||||
if 'BlipDiffusionPipeline' in model_cls:
|
||||
if len(p.init_images) == 0:
|
||||
shared.log.error('BLiP diffusion requires init image')
|
||||
|
||||
@@ -143,6 +143,8 @@ def guess_by_name(fn, current_guess):
|
||||
new_guess = 'LongCat'
|
||||
elif 'ovis-image' in fn.lower():
|
||||
new_guess = 'Ovis-Image'
|
||||
elif 'glm-image' in fn.lower():
|
||||
new_guess = 'GLM-Image'
|
||||
if debug_load:
|
||||
shared.log.trace(f'Autodetect: method=name file="{fn}" previous="{current_guess}" current="{new_guess}"')
|
||||
return new_guess or current_guess
|
||||
|
||||
@@ -483,6 +483,10 @@ def load_diffuser_force(detected_model_type, checkpoint_info, diffusers_load_con
|
||||
from pipelines.model_ovis import load_ovis
|
||||
sd_model = load_ovis(checkpoint_info, diffusers_load_config)
|
||||
allow_post_quant = False
|
||||
elif model_type in ['GLM-Image']:
|
||||
from pipelines.model_glm import load_glm_image
|
||||
sd_model = load_glm_image(checkpoint_info, diffusers_load_config)
|
||||
allow_post_quant = False
|
||||
except Exception as e:
|
||||
shared.log.error(f'Load {op}: path="{checkpoint_info.path}" {e}')
|
||||
if debug_load:
|
||||
|
||||
@@ -38,7 +38,7 @@ prev_cls = ''
|
||||
prev_type = ''
|
||||
prev_model = ''
|
||||
lock = threading.Lock()
|
||||
supported = ['sd', 'sdxl', 'sd3', 'f1', 'h1', 'z_image', 'lumina2', 'hunyuanvideo', 'wanai', 'chrono', 'mochivideo', 'pixartsigma', 'pixartalpha', 'hunyuandit', 'omnigen', 'qwen', 'longcat']
|
||||
supported = ['sd', 'sdxl', 'sd3', 'f1', 'h1', 'z_image', 'lumina2', 'hunyuanvideo', 'wanai', 'chrono', 'mochivideo', 'pixartsigma', 'pixartalpha', 'hunyuandit', 'omnigen', 'qwen', 'longcat', 'glm_image']
|
||||
|
||||
|
||||
def warn_once(msg, variant=None):
|
||||
@@ -59,7 +59,7 @@ def get_model(model_type = 'decoder', variant = None):
|
||||
model_cls = 'sd'
|
||||
elif model_cls in {'pixartsigma', 'hunyuandit', 'omnigen', 'auraflow'}:
|
||||
model_cls = 'sdxl'
|
||||
elif model_cls in {'h1', 'z_image', 'lumina2', 'chroma', 'longcat'}:
|
||||
elif model_cls in {'h1', 'z_image', 'lumina2', 'chroma', 'longcat', 'glm_image'}:
|
||||
model_cls = 'f1'
|
||||
elif model_cls in {'wanai', 'qwen', 'chrono'}:
|
||||
variant = variant or 'TAE WanVideo'
|
||||
|
||||
@@ -49,6 +49,7 @@ pipelines = {
|
||||
'HunyuanImage': getattr(diffusers, 'HunyuanImagePipeline', None),
|
||||
'Z-Image': getattr(diffusers, 'ZImagePipeline', None),
|
||||
'LongCat': getattr(diffusers, 'LongCatImagePipeline', None),
|
||||
'GLM-Image': getattr(diffusers, 'GlmImagePipeline', None),
|
||||
# dynamically imported and redefined later
|
||||
'Meissonic': getattr(diffusers, 'DiffusionPipeline', None),
|
||||
'Monetico': getattr(diffusers, 'DiffusionPipeline', None),
|
||||
|
||||
Reference in New Issue
Block a user