update nunchaku

Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
Vladimir Mandic
2025-09-05 10:11:44 -04:00
parent c210c93444
commit 64edb0787b
4 changed files with 27 additions and 22 deletions
+12 -9
View File
@@ -1,20 +1,20 @@
# Change Log for SD.Next
## Update for 2025-09-03
## Update for 2025-09-05
- **Models**
- **Models**
- **Chroma** final versions: [Chroma1-HD](https://huggingface.co/lodestones/Chroma1-HD), [Chroma1-Base](https://huggingface.co/lodestones/Chroma1-Base) and [Chroma1-Flash](https://huggingface.co/lodestones/Chroma1-Flash)
- **Qwen-Image** [InstantX ControlNet Union](https://huggingface.co/InstantX/Qwen-Image-ControlNet-Union) support
*note* qwen-image is already a very large model and controlnet adds 3.5GB on top of that so quantization and offloading are highly recommended!
- [Nunchaku-Qwen-Image-Lightning](https://huggingface.co/nunchaku-tech/nunchaku-qwen-image)
if you have a compatible nVidia GPU, Nunchaku is the fastest quantization engine, currently available for Flux.1, SANA and Qwen-Image models
*note*: release version of `nunchaku==0.3.2` does NOT include support, so you need to build [nunchaku](https://nunchaku.tech/docs/nunchaku/installation/installation.html) from source
- [Nunchaku-Qwen-Image-Lightning](https://huggingface.co/nunchaku-tech/nunchaku-qwen-image) and [Nunchaku-Flux.1-Krea-Dev](https://huggingface.co/nunchaku-tech/nunchaku-flux.1-krea-dev)
if you have a compatible nVidia GPU, Nunchaku is the fastest quantization engine,
- [HunyuanDiT ControlNet](https://huggingface.co/Tencent-Hunyuan/HYDiT-ControlNet-v1.2) Canny, Depth, Pose
- [KBlueLeaf/HDM-xut-340M-anime](https://huggingface.co/KBlueLeaf/HDM-xut-340M-anime)
highly experimental: HDM *Home-made-Diffusion-Model* is a project to investigate specialized training recipe/scheme for pretraining T2I model at home based on super-light architecture
highly experimental: HDM *Home-made-Diffusion-Model* is a project to investigate specialized training recipe/scheme
for pretraining T2I model at home based on super-light architecture
requires: generator=cpu, dtype=float16, offload=none
- updated [SD.Next Model Samples Gallery](https://vladmandic.github.io/sd-samples/compare.html)
- **UI**
- **UI**
- default to **ModernUI**
standard ui is still available via *settings -> user interface -> theme type*
- mobile-friendly!
@@ -41,8 +41,11 @@
- improve offloading of models with impliciy vae processing
- improve offloading of models with controlnet
- more aggressive offloading of controlnets with lowvram flag
- **SDNQ**
- add quantized matmul support for all quantization types and group sizes
- **Quantization**
- **sdnq**: add quantized matmul support for all quantization types and group sizes
- **nunchaku**: update to `nunchaku==1.0.0`
*note*: nunchaku updated the repo which will trigger re-download of nunchaku models when first used
nunchaku is currently available for: *Flux.1 Dev/Schnell/Kontext/Krea/Depth/Fill*, *Qwen-Image/Qwen-Lightning*, *SANA-1.6B*
- **Other**
- refactor reuse-seed and add functionality to all tabs
- refactor modernui js codebase
+2 -3
View File
@@ -4,7 +4,7 @@ from installer import log, pip
from modules import devices
ver = '0.3.2'
ver = '1.0.0'
ok = False
@@ -46,7 +46,7 @@ def install_nunchaku():
log.error(f'Nunchaku: backend={devices.backend} unsupported')
return False
torch_ver = torch.__version__[:3]
if torch_ver not in ['2.5', '2.6', '2.7', '2.8']:
if torch_ver not in ['2.5', '2.6', '2.7', '2.8', '2.9']:
log.error(f'Nunchaku: torch={torch.__version__} unsupported')
suffix = 'x86_64' if arch == 'linux' else 'win_amd64'
url = os.environ.get('NUNCHAKU_COMMAND', None)
@@ -55,7 +55,6 @@ def install_nunchaku():
url = f'https://huggingface.co/nunchaku-tech/nunchaku/resolve/main/nunchaku-{ver}'
url += f'+torch{torch_ver}-cp{python_ver}-cp{python_ver}-{arch}{suffix}.whl'
cmd = f'install --upgrade {url}'
# pip install https://huggingface.co/mit-han-lab/nunchaku/resolve/main/nunchaku-0.2.0+torch2.6-cp311-cp311-linux_x86_64.whl
log.debug(f'Nunchaku: install="{url}"')
pip(cmd, ignore=False, uv=False)
importlib.reload(pkg_resources)
+10 -8
View File
@@ -6,18 +6,20 @@ def load_flux_nunchaku(repo_id):
nunchaku_precision = nunchaku.utils.get_precision()
nunchaku_repo = None
transformer = None
if 'flux.1-kontext' in repo_id.lower():
nunchaku_repo = f"mit-han-lab/nunchaku-flux.1-kontext-dev/svdq-{nunchaku_precision}_r32-flux.1-kontext-dev.safetensors"
elif 'flux.1-dev' in repo_id.lower():
nunchaku_repo = f"mit-han-lab/nunchaku-flux.1-dev/svdq-{nunchaku_precision}_r32-flux.1-dev.safetensors"
if 'flux.1-dev' in repo_id.lower():
nunchaku_repo = f"nunchaku-tech/nunchaku-flux.1-dev/svdq-{nunchaku_precision}_r32-flux.1-dev.safetensors"
elif 'flux.1-schnell' in repo_id.lower():
nunchaku_repo = f"mit-han-lab/nunchaku-flux.1-schnell/svdq-{nunchaku_precision}_r32-flux.1-schnell.safetensors"
nunchaku_repo = f"nunchaku-tech/nunchaku-flux.1-schnell/svdq-{nunchaku_precision}_r32-flux.1-schnell.safetensors"
elif 'flux.1-kontext' in repo_id.lower():
nunchaku_repo = f"nunchaku-tech/nunchaku-flux.1-kontext-dev/svdq-{nunchaku_precision}_r32-flux.1-kontext-dev.safetensors"
elif 'flux.1-krea' in repo_id.lower():
nunchaku_repo = f"nunchaku-tech/nunchaku-flux.1-krea-dev/svdq-{nunchaku_precision}_r32-flux.1-krea-dev.safetensors"
elif 'flux.1-fill' in repo_id.lower():
nunchaku_repo = f"mit-han-lab/svdq-fp4-flux.1-fill-dev/svdq-{nunchaku_precision}_r32-flux.1-schnell.safetensors"
nunchaku_repo = f"nunchaku-tech/nunchaku-flux.1-fill-dev/svdq-{nunchaku_precision}-flux.1-fill-dev.safetensors"
elif 'flux.1-depth' in repo_id.lower():
nunchaku_repo = f"mit-han-lab/svdq-int4-flux.1-depth-dev/svdq-{nunchaku_precision}_r32-flux.1-schnell.safetensors"
nunchaku_repo = f"nunchaku-tech/nunchaku-flux.1-depth-dev/svdq-{nunchaku_precision}-flux.1-depth-dev.safetensors"
elif 'shuttle' in repo_id.lower():
nunchaku_repo = f"mit-han-lab/nunchaku-shuttle-jaguar/svdq-{nunchaku_precision}_r32-shuttle-jaguar.safetensors"
nunchaku_repo = f"nunchaku-tech/nunchaku-shuttle-jaguar/svdq-{nunchaku_precision}-shuttle-jaguar.safetensors"
else:
shared.log.error(f'Load module: quant=Nunchaku module=transformer repo="{repo_id}" unsupported')
if nunchaku_repo is not None:
+3 -2
View File
@@ -6,10 +6,11 @@ from modules import shared, sd_models, sd_hijack_te, devices, model_quant
def load_quants(kwargs, repo_id, cache_dir):
kwargs_copy = kwargs.copy()
if 'Sana_1600M' in repo_id and model_quant.check_nunchaku('Model'): # only sana-1600m
if 'Sana_1600M_1024px' in repo_id and model_quant.check_nunchaku('Model'): # only available model
import nunchaku
nunchaku_precision = nunchaku.utils.get_precision()
nunchaku_repo = f"mit-han-lab/svdq-{nunchaku_precision}-sana-1600m"
nunchaku_repo = "nunchaku-tech/nunchaku-sana/svdq-int4_r32-sana1.6b.safetensors"
# https://huggingface.co/nunchaku-tech/nunchaku-sana/blob/main/svdq-int4_r32-sana1.6b.safetensors
shared.log.debug(f'Load module: quant=Nunchaku module=transformer repo="{nunchaku_repo}" precision={nunchaku_precision} attention={shared.opts.nunchaku_attention}')
kwargs['transformer'] = nunchaku.NunchakuSanaTransformer2DModel.from_pretrained(nunchaku_repo, torch_dtype=devices.dtype)
elif model_quant.check_quant('Model'):