44
55from shared .StrEnum import StrEnum
66
7+ logger = logging .getLogger (__name__ )
8+
79
810class QuantizationFormat (StrEnum ):
911 normal_float_4bit = auto ()
@@ -12,7 +14,6 @@ class QuantizationFormat(StrEnum):
1214 NONE = brain_floating_point_16bit
1315 DEFAULT = NONE
1416
15- __logger = logging .getLogger (__name__ )
1617
1718 @staticmethod
1819 def supported_values () -> list [str ]:
@@ -22,19 +23,19 @@ def supported_values() -> list[str]:
2223 @staticmethod
2324 def safe_parse (value : "str | QuantizationFormat" ) -> "QuantizationFormat" :
2425 if find_spec ("bitsandbytes" ) is None :
25- QuantizationFormat . __logger .error (
26+ logger .error (
2627 "bitsandbytes not found, defaulting to no quantization. https://docs.framepackstudio.com/help"
2728 )
2829 # If bitsandbytes is not installed, we can not quantize, so return NONE
2930 return QuantizationFormat .NONE
3031
31- QuantizationFormat . __logger .debug (f"QuantizationFormat: { value } " )
32+ logger .debug (f"QuantizationFormat: { value } " )
3233 if isinstance (value , QuantizationFormat ):
3334 return value
3435 try :
3536 return QuantizationFormat (value )
3637 except ValueError :
37- QuantizationFormat . __logger .exception (
38+ logger .exception (
3839 f"Invalid QuantizationFormat value: { value } , defaulting to { QuantizationFormat .DEFAULT } ."
3940 )
4041 return QuantizationFormat .DEFAULT
@@ -45,7 +46,6 @@ class LoraLoader(StrEnum):
4546 LORA_READY = "lora_ready"
4647 DEFAULT = LORA_READY
4748
48- __logger = logging .getLogger (__name__ )
4949
5050 @staticmethod
5151 def supported_values () -> list [str ]:
@@ -59,7 +59,7 @@ def safe_parse(value: "str | LoraLoader") -> "LoraLoader":
5959 try :
6060 return LoraLoader (value )
6161 except ValueError :
62- LoraLoader . __logger .exception (
62+ logger .exception (
6363 f"Invalid LoraLoader value: { value } , defaulting to { LoraLoader .DEFAULT } ."
6464 )
6565 return LoraLoader .DEFAULT
0 commit comments