1
0
mirror of https://github.com/huggingface/diffusers.git synced 2026-01-29 07:22:12 +03:00

add __repr__ for better printing of configs.

This commit is contained in:
sayakpaul
2025-04-29 22:39:13 +08:00
parent 58431f102c
commit 8464ddf12c

View File

@@ -428,6 +428,10 @@ class GGUFQuantizationConfig(QuantizationConfigMixin):
if self.compute_dtype is None:
self.compute_dtype = torch.float32
def __repr__(self):
config_dict = self.to_dict()
return f"{self.__class__.__name__} {json.dumps(config_dict, indent=2, sort_keys=True)}\n"
@dataclass
class TorchAoConfig(QuantizationConfigMixin):
@@ -722,3 +726,7 @@ class QuantoConfig(QuantizationConfigMixin):
accepted_weights = ["float8", "int8", "int4", "int2"]
if self.weights_dtype not in accepted_weights:
raise ValueError(f"Only support weights in {accepted_weights} but found {self.weights_dtype}")
def __repr__(self):
config_dict = self.to_dict()
return f"{self.__class__.__name__} {json.dumps(config_dict, indent=2, sort_keys=True)}\n"