@@ -295,7 +295,6 @@ def __init__(
295
295
tokenizer : Optional [str ] = None ,
296
296
processor : Optional [str ] = None ,
297
297
trust_remote_code : Optional [bool ] = False ,
298
- init_kwargs : Optional [dict ] = None ,
299
298
** kwargs ,
300
299
):
301
300
"""
@@ -315,8 +314,6 @@ def __init__(
315
314
Allows to use custom code for the modeling hosted in the model repository. This option should only be
316
315
set for repositories you trust and in which you have read the code, as it will execute on your local
317
316
machine arbitrary code present in the model repository.
318
- init_kwargs ('dict', *optional*):
319
- Additional parameters for NNCF calls. This explicit argument is needed for deserialization from dict.
320
317
"""
321
318
self .num_samples = num_samples
322
319
self .dataset = dataset
@@ -326,7 +323,7 @@ def __init__(
326
323
if isinstance (ignored_scope , nncf .IgnoredScope ):
327
324
ignored_scope = ignored_scope .__dict__
328
325
self .ignored_scope = ignored_scope
329
- self .init_kwargs = ( init_kwargs or {}) | kwargs
326
+ self .init_kwargs = kwargs
330
327
331
328
def post_init (self ):
332
329
try :
@@ -346,6 +343,12 @@ def get_ignored_scope_instance(self) -> "nncf.IgnoredScope":
346
343
def clone (self ):
347
344
return copy .deepcopy (self )
348
345
346
+ def to_dict (self ) -> Dict [str , Any ]:
347
+ # Unpack init kwargs back into kwargs
348
+ result = super ().to_dict ()
349
+ result = result | result .pop ("init_kwargs" , {})
350
+ return result
351
+
349
352
350
353
@dataclass
351
354
class OVWeightQuantizationConfig (OVQuantizationConfigBase ):
@@ -431,8 +434,6 @@ class OVWeightQuantizationConfig(OVQuantizationConfigBase):
431
434
retained in their original precision without any quantization.
432
435
- "int8_sym" stands for 8-bit integer symmetric quantization without zero point.
433
436
- "int8_asym" stands for 8-bit integer asymmetric quantization with zero points per each quantization group.
434
- init_kwargs ('dict', *optional*):
435
- Additional parameters for nncf.compress_weights() call. This explicit argument is needed for deserialization from dict.
436
437
kwargs: Additional parameters for nncf.compress_weights() call.
437
438
"""
438
439
@@ -456,7 +457,6 @@ def __init__(
456
457
processor : Optional [str ] = None ,
457
458
lora_correction : bool = None ,
458
459
backup_precision : Optional [str ] = None ,
459
- init_kwargs : Optional [dict ] = None ,
460
460
** kwargs ,
461
461
):
462
462
weight_format = kwargs .pop ("weight_format" , None )
@@ -473,7 +473,6 @@ def __init__(
473
473
tokenizer = tokenizer ,
474
474
processor = processor ,
475
475
trust_remote_code = trust_remote_code ,
476
- init_kwargs = init_kwargs ,
477
476
** kwargs ,
478
477
)
479
478
self .bits = bits
@@ -678,7 +677,6 @@ def __init__(
678
677
trust_remote_code : bool = False ,
679
678
smooth_quant_alpha : Optional [float ] = None ,
680
679
dtype : Optional [str ] = "int8" ,
681
- init_kwargs : Optional [dict ] = None ,
682
680
** kwargs ,
683
681
):
684
682
"""
@@ -725,8 +723,6 @@ def __init__(
725
723
reduces quantization error.
726
724
dtype (`str`, defaults to "int8"):
727
725
Data type activations are compressed to. Possible values: ['int8', 'f8e4m3', 'f8e5m2'].
728
- init_kwargs ('dict', *optional*):
729
- Additional parameters for nncf.quantize() call. This explicit argument is needed for deserialization from dict.
730
726
kwargs: Additional parameters for nncf.quantize() call.
731
727
"""
732
728
activation_format = kwargs .pop ("activation_format" , None )
@@ -743,7 +739,6 @@ def __init__(
743
739
tokenizer = tokenizer ,
744
740
processor = processor ,
745
741
trust_remote_code = trust_remote_code ,
746
- init_kwargs = init_kwargs ,
747
742
** kwargs ,
748
743
)
749
744
self .bits = bits
@@ -946,6 +941,7 @@ def __init__(
946
941
Allows to use custom code for the modeling hosted in the model repository. This option should only be
947
942
set for repositories you trust and in which you have read the code, as it will execute on your local
948
943
machine arbitrary code present in the model repository.
944
+ **kwargs:
949
945
"""
950
946
self .weight_quantization_config = self ._initialize_quantization_config (
951
947
weight_quantization_config , OVWeightQuantizationConfig
@@ -980,6 +976,7 @@ def __init__(
980
976
tokenizer = tokenizer ,
981
977
processor = processor ,
982
978
trust_remote_code = trust_remote_code ,
979
+ ** kwargs ,
983
980
)
984
981
985
982
self .post_init ()
0 commit comments