@@ -180,14 +180,16 @@ def _dtype_cases() -> list:
180180 ]
181181
182182
183- def _vgf_dtype_cases () -> list :
183+ def _vgf_no_quant_dtype_cases () -> list :
184+ return [
185+ pytest .param (torch .float32 , id = "fp32" ),
186+ pytest .param (torch .bfloat16 , id = "bf16" ),
187+ ]
188+
189+
190+ def _vgf_quant_dtype_cases () -> list :
184191 return [
185192 pytest .param (torch .float32 , id = "fp32" ),
186- pytest .param (
187- torch .bfloat16 ,
188- marks = pytest .mark .xfail (reason = "BF16 runtime support not ready for VGF." ),
189- id = "bf16" ,
190- ),
191193 ]
192194
193195
@@ -233,12 +235,14 @@ def test_phi3_tosa_INT_layers(name, module_factory, input_factory):
233235
234236
235237@common .SkipIfNoModelConverter
236- @pytest .mark .parametrize ("dtype" , _vgf_dtype_cases ())
238+ @pytest .mark .parametrize ("dtype" , _vgf_no_quant_dtype_cases ())
237239@pytest .mark .parametrize ("name,module_factory,input_factory" , _module_cases ())
238240def test_phi3_vgf_no_quant_layers (name , module_factory , input_factory , dtype ):
239241 config = _phi3_config ()
240242 module = module_factory (config ).to (dtype )
241243 inputs = input_factory (config , dtype )
244+ atol = 1e-02 if dtype == torch .bfloat16 else 1e-03
245+ rtol = 1e-02 if dtype == torch .bfloat16 else 1e-03
242246
243247 pipeline = VgfPipeline [input_t1 if len (inputs ) == 1 else input_t2 ](
244248 module ,
@@ -250,12 +254,14 @@ def test_phi3_vgf_no_quant_layers(name, module_factory, input_factory, dtype):
250254 InsertInt32CastsAfterInt64PlaceholdersPass (),
251255 ],
252256 quantize = False ,
257+ atol = atol ,
258+ rtol = rtol ,
253259 )
254260 pipeline .run ()
255261
256262
257263@common .SkipIfNoModelConverter
258- @pytest .mark .parametrize ("dtype" , _vgf_dtype_cases ())
264+ @pytest .mark .parametrize ("dtype" , _vgf_quant_dtype_cases ())
259265@pytest .mark .parametrize ("name,module_factory,input_factory" , _module_cases ())
260266def test_phi3_vgf_quant_layers (name , module_factory , input_factory , dtype ):
261267 config = _phi3_config ()
0 commit comments