91
91
"text-classification" : ("glue" , "sst2" , "sentence" ),
92
92
}
93
93
94
-
94
+ pattern_prefix = "^__module.model.model" if is_transformers_version ( ">=" , "4.49" ) else "^__module.model"
95
95
class OVQuantizerTest (unittest .TestCase ):
96
96
SUPPORTED_ARCHITECTURES_TORCH_MODEL = (
97
97
(OVModelForSequenceClassification , "bert" , 32 , 35 ),
@@ -158,12 +158,12 @@ class OVQuantizerTest(unittest.TestCase):
158
158
dtype = "nf4" ,
159
159
group_size = 16 ,
160
160
ratio = 0.5 ,
161
- ignored_scope = {"patterns" : ["^__module.model.model .layers.0.self_attn" ]},
161
+ ignored_scope = {"patterns" : [f" { pattern_prefix } .layers.0.self_attn" ]},
162
162
),
163
163
full_quantization_config = OVQuantizationConfig (
164
- dtype = "f8e4m3" , ignored_scope = {"patterns" : ["^__module.model.model .layers.0.mlp" ]}
164
+ dtype = "f8e4m3" , ignored_scope = {"patterns" : [f" { pattern_prefix } .layers.0.mlp" ]}
165
165
),
166
- ignored_scope = {"patterns" : ["^__module.model.model .layers.1.self_attn" ]},
166
+ ignored_scope = {"patterns" : [f" { pattern_prefix } .layers.1.self_attn" ]},
167
167
dataset = "wikitext2" ,
168
168
num_samples = 1 ,
169
169
),
@@ -183,12 +183,12 @@ class OVQuantizerTest(unittest.TestCase):
183
183
dtype = "nf4" ,
184
184
group_size = 16 ,
185
185
ratio = 0.5 ,
186
- ignored_scope = {"patterns" : ["^__module.model .layers.0.self_attn" ]},
186
+ ignored_scope = {"patterns" : [f" { pattern_prefix } .layers.0.self_attn" ]},
187
187
),
188
188
full_quantization_config = OVQuantizationConfig (
189
- dtype = "f8e5m2" , ignored_scope = {"patterns" : ["^__module.model .layers.0.mlp" ]}
189
+ dtype = "f8e5m2" , ignored_scope = {"patterns" : [f" { pattern_prefix } .layers.0.mlp" ]}
190
190
),
191
- ignored_scope = {"patterns" : ["^__module.model .layers.1.self_attn" ]},
191
+ ignored_scope = {"patterns" : [f" { pattern_prefix } .layers.1.self_attn" ]},
192
192
dataset = "wikitext2" ,
193
193
num_samples = 1 ,
194
194
),
0 commit comments