20
20
21
21
import nncf
22
22
import torch
23
+ from nncf .parameters import StrEnum
23
24
from nncf .quantization .advanced_parameters import OverflowFix
24
25
from transformers import PretrainedConfig
25
26
from transformers .utils .quantization_config import QuantizationConfigMixin , QuantizationMethod
@@ -351,11 +352,12 @@ def __init__(
351
352
"Please check your configuration."
352
353
)
353
354
super ().__init__ (ignored_scope , num_samples , False )
354
- # TODO: remove checks below once NNCF is updated to 2.10
355
- if isinstance (overflow_fix , str ):
356
- overflow_fix = OverflowFix (overflow_fix )
357
- if isinstance (preset , str ):
358
- preset = nncf .QuantizationPreset (preset )
355
+ # TODO: remove code below once NNCF < 2.10 support is dropped
356
+ if OverflowFix is not StrEnum :
357
+ if isinstance (overflow_fix , str ):
358
+ overflow_fix = OverflowFix (overflow_fix )
359
+ if isinstance (preset , str ):
360
+ preset = nncf .QuantizationPreset (preset )
359
361
360
362
self .preset = preset
361
363
self .model_type = model_type
@@ -364,8 +366,8 @@ def __init__(
364
366
self .post_init ()
365
367
366
368
def to_dict (self ) -> Dict [str , Any ]:
367
- # TODO: remove code below once NNCF is updated to 2.10
368
- if isinstance ( self . overflow_fix , Enum ) or isinstance ( self . preset , Enum ) :
369
+ # TODO: remove code below once NNCF < 2.10 support is dropped
370
+ if OverflowFix is not StrEnum :
369
371
overflow_fix_value = (
370
372
None
371
373
if self .overflow_fix is None
0 commit comments