lint and safeguard glm

Signed-off-by: vladmandic <mandic00@live.com>
pull/4555/head
vladmandic 2026-01-16 09:40:48 +01:00
parent a8b9719e5e
commit 0d90d95bf6
8 changed files with 40 additions and 17 deletions

View File

@ -1,22 +1,36 @@
# Change Log for SD.Next
## Update for 2025-01-15
## Update for 2025-01-16
### Highlights for 2025-01-16
First release of 2026 brings quite a few new models: **Flux.2-Klein, Qwen-Image-2512, LTX-2-Dev, GLM-Image**
There are also improvements to SDNQ quantization engine, updated Prompt Enhance and many others
Plus some significant under-the-hood changes to improve code coverage and quality which resulted in more than usual levels of bug-fixes!
[ReadMe](https://github.com/vladmandic/automatic/blob/master/README.md) | [ChangeLog](https://github.com/vladmandic/automatic/blob/master/CHANGELOG.md) | [Docs](https://vladmandic.github.io/sdnext-docs/) | [WiKi](https://github.com/vladmandic/automatic/wiki) | [Discord](https://discord.com/invite/sd-next-federal-batch-inspectors-1101998836328697867) | [Sponsor](https://github.com/sponsors/vladmandic)
### Details for 2025-01-16
- **Models**
- [Qwen-Image-2512](https://huggingface.co/Qwen/Qwen-Image-2512)
- [Flux.2 Klein](https://bfl.ai/blog/flux2-klein-towards-interactive-visual-intelligence)
Flux.2-Klein is a new family of compact models from BFL in *4B and 9B sizes* and avaialable as *destilled and base* variants
also includes are *SDNQ prequantized variants*
- [Qwen-Image-2512](https://qwen.ai/blog?id=qwen-image-2512)
Qwen-Image successor, significantly reduces the AI-generated look and adds finer natural detailils and improved text rendering
available in both *original*, *sdnq-svd prequantized* and *sdnq-dynamic prequantized* variants
- [LTX-2 19B Dev](https://huggingface.co/Lightricks/LTX-2)
- [LTX-2 19B Dev](https://ltx.io/model/ltx-2)
LTX-2 is a new very large 19B parameter video generation model from Lightricks using Gemma-3 text encoder
available for T2I/I2I workflows in original and SDNQ prequantized variants
*note*: audio generation and upsampling are not yet supported (soon)
- [GLM-Image](https://huggingface.co/zai-org/GLM-Image)
- [GLM-Image](https://z.ai/blog/glm-image)
GLM-image is a new image generation model that adopts a hybrid autoregressive with diffusion decoder architecture
available in both *original* and *sdnq-dynamic prequantized* variants, thanks @CalamitousFelicitousness
*note*: model requires pre-release versions of `transformers` package:
> pip install --upgrade git+https://github.com/huggingface/transformers.git
> ./webui.sh --experimental
- [Nunchaku Z-Image Turbo](https://huggingface.co/nunchaku-tech/nunchaku-z-image-turbo)
nunchaku optimized z-image turbo
- **Feaures**
- **SDNQ**: add *dynamic* quantization method
sdnq can dynamically determine best quantization method for each module layer

View File

@ -9,10 +9,19 @@ if __name__ == "__main__":
keyword = sys.argv[0] if len(sys.argv) > 0 else ''
hf.logging.set_verbosity_info()
hf_api = hf.HfApi()
res = hf_api.list_models(model_name=keyword, full=True, limit=100, sort="downloads", direction=-1)
res = hf_api.list_models(
model_name=keyword,
full=True,
limit=100,
sort="downloads",
direction=-1,
)
res = sorted(res, key=lambda x: x.id)
exact = [m for m in res if keyword.lower() in m.id.lower()]
if len(exact) > 0:
res = exact
for m in res:
meta = hf_api.model_info(m.id, files_metadata=True)
m.files = [f.rfilename for f in meta.siblings if f.rfilename.endswith('.bin') or f.rfilename.endswith('.safetensors')]
m.size = sum([f.size for f in meta.siblings]) / 1024 / 1024 / 1024 # in GB
print({ 'name': m.id, 'files': len(m.files), 'size': m.size, 'downloads': m.downloads, 'mtime': m.lastModified, 'url': f'https://huggingface.co/{m.id}', 'pipeline': m.pipeline_tag })
m.size = round(sum([f.size for f in meta.siblings]) / 1024 / 1024 / 1024, 2)
print({ 'name': m.id, 'files': len(m.files), 'size': m.size, 'downloads': m.downloads, 'ctime': m.created_at.isoformat(), 'url': f'https://huggingface.co/{m.id}', 'pipeline': m.pipeline_tag })

View File

@ -56,7 +56,7 @@
"skip": true,
"extras": "sampler: Default, cfg_scale: 4.0, steps: 50",
"tags": "quantized",
"size": 8.5,
"size": 5.1,
"date": "2025 January"
},
"Black Forest Labs FLUX.2 Klein Base 9B sdnq-uint4-dynamic-svd": {
@ -66,10 +66,9 @@
"skip": true,
"extras": "sampler: Default, cfg_scale: 4.0, steps: 50",
"tags": "quantized",
"size": 18.5,
"size": 11.7,
"date": "2025 January"
},
"Chroma1-HD sdnq-svd-uint4": {
"path": "Disty0/Chroma1-HD-SDNQ-uint4-svd-r32",
"preview": "Disty0--Chroma1-HD-SDNQ-uint4-svd-r32.jpg",
@ -137,7 +136,7 @@
"skip": true,
"tags": "quantized",
"extras": "",
"size": 16.10,
"size": 17.2,
"date": "2026 January"
},
"Qwen-Image-Edit sdnq-svd-uint4": {
@ -233,7 +232,7 @@
"desc": "Quantization of ZAI GLM-Image using SDNQ: sdnq-dynamic 4-bit uint",
"skip": true,
"extras": "sampler: Default, cfg_scale: 1.5, steps: 50",
"size": 15.3,
"size": 11.6,
"tags": "quantized",
"date": "2025 January"
}

View File

@ -1,7 +1,6 @@
import os
import re
import random
import threading
import numpy as np
import torch
import gradio as gr

View File

@ -1,6 +1,5 @@
import os
import time
import threading
import torch
from PIL import Image

View File

@ -314,7 +314,6 @@ def create_ui(_blocks: gr.Blocks=None):
result_txt,
output_html_log,
]
global control_dict # pylint: disable=global-statement
control_dict = dict(
fn=generate_click,
_js="submit_control",

View File

@ -1,6 +1,6 @@
from typing import TYPE_CHECKING, cast
import os
import gradio as gr
from typing import TYPE_CHECKING, cast
from modules import errors
from modules.ui_components import ToolButton

View File

@ -86,6 +86,10 @@ def load_glm_image(checkpoint_info, diffusers_load_config=None):
repo_id = sd_models.path_to_repo(checkpoint_info)
sd_models.hf_auth_check(checkpoint_info)
if not hasattr(transformers, 'GlmImageForConditionalGeneration'):
shared.log.error(f'Load model: type=GLM-Image repo="{repo_id}" transformers={transformers.__version__} not supported')
return None
load_args, _quant_args = model_quant.get_dit_args(diffusers_load_config, allow_quant=False)
shared.log.debug(f'Load model: type=GLM-Image repo="{repo_id}" offload={shared.opts.diffusers_offload_mode} dtype={devices.dtype} args={load_args}')
@ -108,7 +112,7 @@ def load_glm_image(checkpoint_info, diffusers_load_config=None):
# Note: This is a conditional generation model, different from typical text encoders
vision_language_encoder = generic.load_text_encoder(
repo_id,
cls_name=transformers.GlmImageForConditionalGeneration,
cls_name=transformers.GlmImageForConditionalGeneration, # pylint: disable=no-member
subfolder="vision_language_encoder",
load_config=diffusers_load_config,
allow_shared=False