You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
NVIDIAModelOptConfig.to_dict() crashes from_pretrained/save_pretrained when forward_loop is set #15122
forward_loop is a documented NVIDIAModelOptConfig constructor parameter. NVIDIAModelOptConfig has no to_dict() override, so it inherits QuantizationConfigMixin.to_dict(), which returns copy.deepcopy(self.__dict__) — including the raw forward_loop callable.
src/diffusers/models/modeling_utils.py calls json.dumps(hf_quantizer.quantization_config.to_dict(), sort_keys=True) for telemetry during from_pretrained, with no error handling around it. Any model loaded (or saved) with a NVIDIAModelOptConfig(forward_loop=...) crashes with TypeError: Object of type function is not JSON serializable.
Traceback (most recent call last):
File "<string>", line 1, in <module>
TypeError: Object of type function is not JSON serializable
This is the same call modeling_utils.py makes internally during from_pretrained:
File ".../diffusers/src/diffusers/models/modeling_utils.py", line 1206, in from_pretrained
serialized_quant_config = json.dumps(hf_quantizer.quantization_config.to_dict(), sort_keys=True)
TypeError: Object of type function is not JSON serializable
System Info
diffusers @ main, commit aaf57d0
Python 3.12, Linux
Who can help?
(leaving blank — no specific quantization reviewer listed in the template's tag guide)
Activity