Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

fix generate parameter format #3175

Merged
merged 3 commits into from
Dec 11, 2020
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
4 changes: 2 additions & 2 deletions nni/algorithms/hpo/gridsearch_tuner/gridsearch_tuner.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def generate_parameters(self, parameter_id, **kwargs):
"""
self.count += 1
while self.count <= len(self.expanded_search_space) - 1:
_params_tuple = convert_dict2tuple(self.expanded_search_space[self.count])
_params_tuple = convert_dict2tuple(copy.deepcopy(self.expanded_search_space[self.count]))
if _params_tuple in self.supplement_data:
self.count += 1
else:
Expand Down Expand Up @@ -203,6 +203,6 @@ def import_data(self, data):
if not _value:
logger.info("Useless trial data, value is %s, skip this trial data.", _value)
continue
_params_tuple = convert_dict2tuple(_params)
_params_tuple = convert_dict2tuple(copy.deepcopy(_params))
self.supplement_data[_params_tuple] = True
logger.info("Successfully import data to grid search tuner.")
1 change: 1 addition & 0 deletions nni/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ def extract_scalar_history(trial_history, scalar_key='default'):
def convert_dict2tuple(value):
"""
convert dict type to tuple to solve unhashable problem.
NOTE: this function will change original data.
"""
if isinstance(value, dict):
for _keys in value:
Expand Down