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

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Shinai Yang (FA TALENT) committed Nov 23, 2018
1 parent 8103ff0 commit 5b9278c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/sdk/pynni/nni/batch_tuner/batch_tuner.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class BatchTuner(Tuner):
}
'''

def __init__(self, optimize_mode):
def __init__(self):
self.count = -1
self.values = []

Expand Down
2 changes: 1 addition & 1 deletion src/sdk/pynni/nni/gridsearch_tuner/gridsearch_tuner.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class GridSearchTuner(Tuner):
and sample and then change the sampled value back.
'''

def __init__(self, optimize_mode):
def __init__(self):
self.count = -1
self.expanded_search_space = []

Expand Down
17 changes: 11 additions & 6 deletions test/sdk_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
RED = '\33[31m'
CLEAR = '\33[0m'

TUNER_LIST = ['BatchTuner', 'TPE', 'Random', 'Anneal', 'Evolution']
TUNER_LIST = ['GridSearch', 'BatchTuner', 'TPE', 'Random', 'Anneal', 'Evolution']
ASSESSOR_LIST = ['Medianstop']
EXPERIMENT_URL = 'http://localhost:8080/api/v1/nni/experiment'

Expand All @@ -38,12 +38,17 @@ def switch(dispatch_type, dispatch_name):
'''Change dispatch in config.yml'''
config_path = 'sdk_test/local.yml'
experiment_config = get_yml_content(config_path)
experiment_config[dispatch_type.lower()] = {
'builtin' + dispatch_type + 'Name': dispatch_name,
'classArgs': {
'optimize_mode': 'maximize'
if dispatch_name in ['GridSearch', 'BatchTuner']:
experiment_config[dispatch_type.lower()] = {
'builtin' + dispatch_type + 'Name': dispatch_name
}
else:
experiment_config[dispatch_type.lower()] = {
'builtin' + dispatch_type + 'Name': dispatch_name,
'classArgs': {
'optimize_mode': 'maximize'
}
}
}
dump_yml_content(config_path, experiment_config)

def test_builtin_dispatcher(dispatch_type, dispatch_name):
Expand Down
14 changes: 11 additions & 3 deletions tools/nni_cmd/config_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,13 @@
Optional('multiThread'): bool,
'useAnnotation': bool,
'tuner': Or({
'builtinTunerName': Or('TPE', 'Random', 'Anneal', 'Evolution', 'SMAC', 'BatchTuner', 'GridSearch'),
Optional('classArgs'): dict,
'builtinTunerName': Or('TPE', 'Random', 'Anneal', 'SMAC', 'Evolution'),
Optional('classArgs'): {
'optimize_mode': Or('maximize', 'minimize')
},
Optional('gpuNum'): And(int, lambda x: 0 <= x <= 99999),
},{
'builtinTunerName': Or('BatchTuner', 'GridSearch'),
Optional('gpuNum'): And(int, lambda x: 0 <= x <= 99999),
},{
'codeDir': os.path.exists,
Expand All @@ -46,7 +51,10 @@
}),
Optional('assessor'): Or({
'builtinAssessorName': lambda x: x in ['Medianstop'],
Optional('classArgs'): dict,
Optional('classArgs'): {
Optional('optimize_mode'): Or('maximize', 'minimize'),
Optional('start_step'): And(int, lambda x: 0 <= x <= 9999)
},
Optional('gpuNum'): And(int, lambda x: 0 <= x <= 99999)
},{
'codeDir': os.path.exists,
Expand Down

0 comments on commit 5b9278c

Please sign in to comment.