mirror of
https://github.com/vladmandic/automatic
synced 2026-09-18 16:54:33 +02:00
Complete Z-Image support
This commit is contained in:
@@ -162,6 +162,17 @@
|
||||
"extras": "sampler: Default, cfg_scale: 4.5"
|
||||
},
|
||||
|
||||
"Z-Image-Turbo": {
|
||||
"path": "Tongyi-MAI/Z-Image-Turbo",
|
||||
"preview": "Tongyi-MAI--Z-Image-Turbo.jpg",
|
||||
"desc": "Z-Image-Turbo, a distilled version of Z-Image that matches or exceeds leading competitors with only 8 NFEs (Number of Function Evaluations). It offers sub-second inference latency on enterprise-grade H800 GPUs and fits comfortably within 16G VRAM consumer devices. It excels in photorealistic image generation, bilingual text rendering (English & Chinese), and robust instruction adherence.",
|
||||
"tags": "distilled",
|
||||
"skip": true,
|
||||
"extras": "sampler: Default, cfg_scale: 1.0, steps: 9",
|
||||
"size": 20.3,
|
||||
"date": "2025 November"
|
||||
},
|
||||
|
||||
"Qwen-Image": {
|
||||
"path": "Qwen/Qwen-Image",
|
||||
"preview": "Qwen--Qwen-Image.jpg",
|
||||
@@ -1008,6 +1019,16 @@
|
||||
"size": 23.55,
|
||||
"extras": ""
|
||||
},
|
||||
"Z-Image-Turbo sdnq-svd-uint4": {
|
||||
"path": "Disty0/Z-Image-Turbo-SDNQ-uint4-svd-r32",
|
||||
"preview": "Tongyi-MAI--Z-Image-Turbo.jpg",
|
||||
"desc": "Quantization of Tongyi-MAI/Z-Image-Turbo using SDNQ: sdnq-svd 4-bit uint with svd rank 32",
|
||||
"skip": true,
|
||||
"tags": "quantized",
|
||||
"extras": "sampler: Default, cfg_scale: 1.0, steps: 9",
|
||||
"size": 6.5,
|
||||
"date": "2025 November"
|
||||
},
|
||||
"Qwen-Image sdnq-svd-uint4": {
|
||||
"path": "Disty0/Qwen-Image-SDNQ-uint4-svd-r32",
|
||||
"preview": "Qwen--Qwen-Image.jpg",
|
||||
|
||||
+1
-1
@@ -619,7 +619,7 @@ def check_diffusers():
|
||||
t_start = time.time()
|
||||
if args.skip_all:
|
||||
return
|
||||
sha = 'c8656ed73c638e51fc2e777a5fd355d69fa5220f' # diffusers commit hash
|
||||
sha = '6bf668c4d217ebc96065e673d8a257fd79950d34' # diffusers commit hash
|
||||
# if args.use_rocm or args.use_zluda or args.use_directml:
|
||||
# sha = '043ab2520f6a19fce78e6e060a68dbc947edb9f9' # lock diffusers versions for now
|
||||
pkg = pkg_resources.working_set.by_key.get('diffusers', None)
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 51 KiB |
@@ -36,6 +36,8 @@ def get_model_type(pipe):
|
||||
model_type = 'f2'
|
||||
elif "Flux" in name or "Flex1" in name or "Flex2" in name:
|
||||
model_type = 'f1'
|
||||
elif "ZImage" in name or "Z-Image" in name:
|
||||
model_type = 'z_image'
|
||||
elif "Lumina2" in name:
|
||||
model_type = 'lumina2'
|
||||
elif "Lumina" in name:
|
||||
|
||||
@@ -9,7 +9,7 @@ from modules import shared, devices, processing, images, sd_vae_approx, sd_vae_t
|
||||
|
||||
SamplerData = namedtuple('SamplerData', ['name', 'constructor', 'aliases', 'options'])
|
||||
approximation_indexes = { "Simple": 0, "Approximate": 1, "TAESD": 2, "Full VAE": 3 }
|
||||
flow_models = ['f1', 'f2', 'sd3', 'lumina', 'auraflow', 'sana', 'lumina2', 'cogview4', 'h1', 'cosmos', 'chroma', 'omnigen', 'omnigen2']
|
||||
flow_models = ['f1', 'f2', 'sd3', 'lumina', 'auraflow', 'sana', 'z_image', 'lumina2', 'cogview4', 'h1', 'cosmos', 'chroma', 'omnigen', 'omnigen2']
|
||||
warned = False
|
||||
queue_lock = threading.Lock()
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ hf_decode_endpoints['auraflow'] = hf_decode_endpoints['sdxl']
|
||||
hf_decode_endpoints['omnigen'] = hf_decode_endpoints['sdxl']
|
||||
hf_decode_endpoints['h1'] = hf_decode_endpoints['f1']
|
||||
hf_decode_endpoints['chroma'] = hf_decode_endpoints['f1']
|
||||
hf_decode_endpoints['z_image'] = hf_decode_endpoints['f1']
|
||||
hf_decode_endpoints['lumina2'] = hf_decode_endpoints['f1']
|
||||
|
||||
hf_encode_endpoints = {
|
||||
@@ -35,6 +36,7 @@ hf_encode_endpoints['hunyuandit'] = hf_encode_endpoints['sdxl']
|
||||
hf_encode_endpoints['auraflow'] = hf_encode_endpoints['sdxl']
|
||||
hf_encode_endpoints['omnigen'] = hf_encode_endpoints['sdxl']
|
||||
hf_encode_endpoints['h1'] = hf_encode_endpoints['f1']
|
||||
hf_encode_endpoints['z_image'] = hf_encode_endpoints['f1']
|
||||
hf_encode_endpoints['lumina2'] = hf_encode_endpoints['f1']
|
||||
|
||||
dtypes = {
|
||||
@@ -91,7 +93,7 @@ def remote_decode(latents: torch.Tensor, width: int = 0, height: int = 0, model_
|
||||
params["output_type"] = "pt"
|
||||
params["output_tensor_type"] = "binary"
|
||||
headers["Accept"] = "tensor/binary"
|
||||
if model_type in {'f1', 'h1', 'lumina2', 'chroma'} and (width > 0) and (height > 0):
|
||||
if model_type in {'f1', 'h1', 'z_image', 'lumina2', 'chroma'} and (width > 0) and (height > 0):
|
||||
params['width'] = width
|
||||
params['height'] = height
|
||||
if shared.sd_model.vae is not None and shared.sd_model.vae.config is not None:
|
||||
|
||||
@@ -38,7 +38,7 @@ prev_cls = ''
|
||||
prev_type = ''
|
||||
prev_model = ''
|
||||
lock = threading.Lock()
|
||||
supported = ['sd', 'sdxl', 'sd3', 'f1', 'h1', 'lumina2', 'hunyuanvideo', 'wanai', 'chrono', 'mochivideo', 'pixartsigma', 'pixartalpha', 'hunyuandit', 'omnigen', 'qwen']
|
||||
supported = ['sd', 'sdxl', 'sd3', 'f1', 'h1', 'z_image', 'lumina2', 'hunyuanvideo', 'wanai', 'chrono', 'mochivideo', 'pixartsigma', 'pixartalpha', 'hunyuandit', 'omnigen', 'qwen']
|
||||
|
||||
|
||||
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', 'lumina2', 'chroma'}:
|
||||
elif model_cls in {'h1', 'z_image', 'lumina2', 'chroma'}:
|
||||
model_cls = 'f1'
|
||||
elif model_cls in {'wanai', 'qwen', 'chrono'}:
|
||||
variant = variant or 'TAE WanVideo'
|
||||
|
||||
@@ -35,5 +35,5 @@ def load_flux2(checkpoint_info, diffusers_load_config=None):
|
||||
sd_hijack_te.init_hijack(pipe)
|
||||
sd_hijack_vae.init_hijack(pipe)
|
||||
|
||||
devices.torch_gc()
|
||||
devices.torch_gc(force=True, reason='load')
|
||||
return pipe
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import transformers
|
||||
import diffusers
|
||||
from modules import shared, sd_models, sd_hijack_te, devices, model_quant
|
||||
from modules import shared, devices, sd_models, model_quant, sd_hijack_te
|
||||
from pipelines import generic
|
||||
|
||||
|
||||
@@ -9,18 +10,22 @@ def load_z_image(checkpoint_info, diffusers_load_config=None):
|
||||
repo_id = sd_models.path_to_repo(checkpoint_info)
|
||||
sd_models.hf_auth_check(checkpoint_info)
|
||||
|
||||
load_args, _quant_args = model_quant.get_dit_args(diffusers_load_config, allow_quant=False)
|
||||
shared.log.debug(f'Load model: type=Z-Image repo="{repo_id}" config={diffusers_load_config} offload={shared.opts.diffusers_offload_mode} dtype={devices.dtype} args={diffusers_load_config}')
|
||||
transformer = generic.load_transformer(repo_id, cls_name=diffusers.ZImageTransformer2DModel, load_config=diffusers_load_config)
|
||||
|
||||
load_config, _quant_args = model_quant.get_dit_args(diffusers_load_config, allow_quant=False)
|
||||
transformer = generic.load_transformer(repo_id, cls_name=diffusers.ZImageTransformer2DModel, load_config=diffusers_load_config)
|
||||
text_encoder = generic.load_text_encoder(repo_id, cls_name=transformers.Qwen3ForCausalLM, load_config=diffusers_load_config)
|
||||
|
||||
pipe = diffusers.ZImagePipeline.from_pretrained(
|
||||
repo_id,
|
||||
cache_dir=shared.opts.diffusers_dir,
|
||||
transformer=transformer,
|
||||
**load_config,
|
||||
text_encoder=text_encoder,
|
||||
**load_args,
|
||||
)
|
||||
|
||||
del transformer
|
||||
del text_encoder
|
||||
sd_hijack_te.init_hijack(pipe)
|
||||
|
||||
devices.torch_gc(force=True, reason='load')
|
||||
|
||||
Reference in New Issue
Block a user