File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change 2020import pytest
2121
2222# Local
23+ from fms_mo import qconfig_init
2324from fms_mo .utils .qconfig_utils import qconfig_load , qconfig_save
2425from tests .models .test_model_utils import (
2526 delete_file ,
@@ -298,3 +299,31 @@ def test_load_config_required_pair(
298299
299300 loaded_config = qconfig_load ("qcfg.json" )
300301 assert loaded_config .get (key ) == default_val
302+
303+
304+ def test_save_init_recipe (
305+ config_int8 : dict ,
306+ ):
307+ """
308+ Change a config, save it,
309+
310+ Args:
311+ config_fp32 (dict): Config for fp32 quantization
312+ """
313+ # Change some elements of config to ensure its being saved/loaded properly
314+ config_int8 ["qa_mode" ] = "minmax"
315+ config_int8 ["qa_mode" ] = "pertokenmax"
316+ config_int8 ["qmodel_calibration" ] = 17
317+ config_int8 ["qskip_layer_name" ] = ["lm_head" ]
318+
319+ qconfig_save (config_int8 )
320+ recipe_config = qconfig_init (recipe = "qcfg.json" )
321+
322+ # Remove date field from recipe_config - only added at save
323+ del recipe_config ["date" ]
324+
325+ assert len (recipe_config ) == len (config_int8 )
326+
327+ for key , val in config_int8 .items ():
328+ assert key in recipe_config
329+ assert recipe_config .get (key ) == val
You can’t perform that action at this time.
0 commit comments