Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fixed the empty options
Signed-off-by: yiliu30 <[email protected]>
  • Loading branch information
yiliu30 committed Jun 11, 2024
commit 3aca403b8d4fd9de18952d6f90c13c9e2b03eaef
1 change: 1 addition & 0 deletions neural_compressor/common/base_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@ def expand(self) -> List[BaseConfig]:
if len(tuning_param_list) == 0:
config_list = [config]
else:
tuning_param_list = list(filter(lambda x: len(x.options) > 0, tuning_param_list))
tuning_param_name_lst = [tuning_param.name for tuning_param in tuning_param_list]
for params_values in product(*[tuning_param.options for tuning_param in tuning_param_list]):
tuning_param_pair = dict(zip(tuning_param_name_lst, params_values))
Expand Down
5 changes: 5 additions & 0 deletions test/3x/common/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,11 @@ def test_config_expand_complex_tunable_type(self):
for i in range(len(configs_list)):
self.assertEqual(configs_list[i].target_op_type_list, target_op_type_list_options[i])

def test_config_expand_with_empty_options(self):
configs = FakeAlgoConfig(weight_dtype=["int", "float32"], weight_bits=[])
configs_list = configs.expand()
self.assertEqual(len(configs_list), 2)

def test_mixed_two_algos(self):
model = FakeModel()
OP1_NAME = "OP1_NAME"
Expand Down