Make SDNQ not depended on quantization_config.json and fix invalid quantization_config getting attached to the model on load

This commit is contained in:
Disty0
2025-11-07 18:11:21 +03:00
parent 1d25c9761c
commit 93f28f07ac
5 changed files with 118 additions and 56 deletions
+7 -2
View File
@@ -559,11 +559,16 @@ def load_diffuser_file(model_type, pipeline, checkpoint_info, diffusers_load_con
def load_sdnq_module(fn: str, module_name: str, load_method: str):
from modules import sdnq
t0 = time.time()
quantization_config = None
quantization_config_path = os.path.join(fn, module_name, 'quantization_config.json')
if not os.path.exists(quantization_config_path):
model_config_path = os.path.join(fn, module_name, 'config.json')
if os.path.exists(quantization_config_path):
quantization_config = shared.readfile(quantization_config_path, silent=True)
elif os.path.exists(model_config_path):
quantization_config = shared.readfile(model_config_path, silent=True).get("quantization_config", None)
if quantization_config is None:
return None, module_name, 0
model_name = os.path.join(fn, module_name)
quantization_config = shared.readfile(quantization_config_path, silent=True)
try:
module = sdnq.load_sdnq_model(
model_path=model_name,