Unverified Commit d48ad027 authored by SparkSnail's avatar SparkSnail Committed by GitHub
Browse files

Merge pull request #184 from microsoft/master

merge master
parents 9352cc88 22993e5d
......@@ -67,7 +67,7 @@ def get_next_parameter():
params_file_name = 'parameter.cfg'
else:
raise AssertionError('_param_index value ({}) should >=0'.format(_param_index))
params_filepath = os.path.join(_sysdir, params_file_name)
if not os.path.isfile(params_filepath):
request_next_parameter()
......@@ -81,11 +81,11 @@ def get_next_parameter():
def send_metric(string):
if _nni_platform != 'local':
data = (string).encode('utf8')
assert len(data) < 1000000, 'Metric too long'
assert len(data) < 1000000, 'Metric too long'
print('NNISDK_ME%s' % (data), flush=True)
else:
data = (string + '\n').encode('utf8')
assert len(data) < 1000000, 'Metric too long'
assert len(data) < 1000000, 'Metric too long'
_metric_file.write(b'ME%06d%b' % (len(data), data))
_metric_file.flush()
if sys.platform == "win32":
......
......@@ -24,12 +24,12 @@ import numpy as np
def get_json_content(file_path):
"""Load json file content
Parameters
----------
file_path:
path to the file
Raises
------
TypeError
......@@ -43,9 +43,9 @@ def get_json_content(file_path):
return None
def generate_pcs(nni_search_space_content):
"""Generate the Parameter Configuration Space (PCS) which defines the
"""Generate the Parameter Configuration Space (PCS) which defines the
legal ranges of the parameters to be optimized and their default values.
Generally, the format is:
# parameter_name categorical {value_1, ..., value_N} [default value]
# parameter_name ordinal {value_1, ..., value_N} [default value]
......@@ -53,14 +53,14 @@ def generate_pcs(nni_search_space_content):
# parameter_name integer [min_value, max_value] [default value] log
# parameter_name real [min_value, max_value] [default value]
# parameter_name real [min_value, max_value] [default value] log
Reference: https://automl.github.io/SMAC3/stable/options.html
Parameters
----------
nni_search_space_content: search_space
The search space in this experiment in nni
Returns
-------
Parameter Configuration Space (PCS)
......@@ -81,8 +81,8 @@ def generate_pcs(nni_search_space_content):
if search_space[key]['_type'] == 'choice':
choice_len = len(search_space[key]['_value'])
pcs_fd.write('%s categorical {%s} [%s]\n' % (
key,
json.dumps(list(range(choice_len)))[1:-1],
key,
json.dumps(list(range(choice_len)))[1:-1],
json.dumps(0)))
if key in categorical_dict:
raise RuntimeError('%s has already existed, please make sure search space has no duplicate key.' % key)
......@@ -90,19 +90,19 @@ def generate_pcs(nni_search_space_content):
elif search_space[key]['_type'] == 'randint':
# TODO: support lower bound in randint
pcs_fd.write('%s integer [0, %d] [%d]\n' % (
key,
search_space[key]['_value'][0],
key,
search_space[key]['_value'][0],
search_space[key]['_value'][0]))
elif search_space[key]['_type'] == 'uniform':
pcs_fd.write('%s real %s [%s]\n' % (
key,
key,
json.dumps(search_space[key]['_value']),
json.dumps(search_space[key]['_value'][0])))
elif search_space[key]['_type'] == 'loguniform':
# use np.round here to ensure that the rounded defaut value is in the range, which will be rounded in configure_space package
search_space[key]['_value'] = list(np.round(np.log(search_space[key]['_value']), 10))
pcs_fd.write('%s real %s [%s]\n' % (
key,
key,
json.dumps(search_space[key]['_value']),
json.dumps(search_space[key]['_value'][0])))
elif search_space[key]['_type'] == 'quniform' \
......@@ -122,9 +122,9 @@ def generate_pcs(nni_search_space_content):
return None
def generate_scenario(ss_content):
"""Generate the scenario. The scenario-object (smac.scenario.scenario.Scenario) is used to configure SMAC and
"""Generate the scenario. The scenario-object (smac.scenario.scenario.Scenario) is used to configure SMAC and
can be constructed either by providing an actual scenario-object, or by specifing the options in a scenario file.
Reference: https://automl.github.io/SMAC3/stable/options.html
The format of the scenario file is one option per line:
......@@ -135,7 +135,7 @@ def generate_scenario(ss_content):
Parameters
----------
abort_on_first_run_crash: bool
If true, SMAC will abort if the first run of the target algorithm crashes. Default: True,
If true, SMAC will abort if the first run of the target algorithm crashes. Default: True,
because trials reported to nni tuner would always in success state
algo: function
Specifies the target algorithm call that SMAC will optimize. Interpreted as a bash-command.
......
......@@ -64,7 +64,7 @@ class SMACTuner(Tuner):
def _main_cli(self):
"""Main function of SMAC for CLI interface
Returns
-------
instance
......@@ -153,7 +153,7 @@ class SMACTuner(Tuner):
def receive_trial_result(self, parameter_id, parameters, value):
"""receive_trial_result
Parameters
----------
parameter_id: int
......@@ -162,7 +162,7 @@ class SMACTuner(Tuner):
parameters
value:
value
Raises
------
RuntimeError
......@@ -185,7 +185,7 @@ class SMACTuner(Tuner):
Also, we convert categorical:
categorical values in search space are changed to list of numbers before,
those original values will be changed back in this function
Parameters
----------
challenger_dict: dict
......@@ -211,12 +211,12 @@ class SMACTuner(Tuner):
def generate_parameters(self, parameter_id):
"""generate one instance of hyperparameters
Parameters
----------
parameter_id: int
parameter id
Returns
-------
list
......@@ -234,12 +234,12 @@ class SMACTuner(Tuner):
def generate_multiple_parameters(self, parameter_id_list):
"""generate mutiple instances of hyperparameters
Parameters
----------
parameter_id_list: list
list of parameter id
Returns
-------
list
......
......@@ -32,7 +32,7 @@ from nni.multi_phase.multi_phase_dispatcher import MultiPhaseMsgDispatcher
from unittest import TestCase, main
class NaiveMultiPhaseTuner(MultiPhaseTuner):
'''
'''
supports only choices
'''
def __init__(self):
......
......@@ -40,7 +40,7 @@ class TrialTestCase(TestCase):
def test_get_sequence_id(self):
self.assertEqual(nni.get_sequence_id(), 0)
def test_report_intermediate_result(self):
nni.report_intermediate_result(123)
self.assertEqual(test_platform.get_last_metric(), {
......
......@@ -10,7 +10,7 @@
left: 0;
top: 0;
width: 100%;
height: 56px;
height: 56px;
background: #0071BC;
border-right: 1px solid #ccc;
z-index: 1000;
......
......@@ -139,7 +139,7 @@ class TrialsDetail extends React.Component<{}, TrialDetailState> {
const items = metricSource[key];
if (items.trialJobId === id) {
// succeed trial, last intermediate result is final result
// final result format may be object
// final result format may be object
if (typeof JSON.parse(items.data) === 'object') {
mediate.push(JSON.parse(items.data).default);
} else {
......
......@@ -78,7 +78,7 @@ class Progressed extends React.Component<ProgressProps, ProgressState> {
}).then(res => {
if (res.status === 200) {
message.destroy();
message.success(`Update ${CONTROLTYPE[1].toLocaleLowerCase()}
message.success(`Update ${CONTROLTYPE[1].toLocaleLowerCase()}
successfully`);
// rerender trial profile message
const { updateFile } = this.props;
......
......@@ -15,7 +15,7 @@ class TrialLog extends React.Component<TrialLogProps, {}> {
render() {
const { logStr } = this.props;
return (
<div>
<LogPathChild
......
......@@ -49,8 +49,8 @@ table {
border-collapse: collapse;
border-spacing: 0;
}
@font-face {
font-family: 'Segoe';
@font-face {
font-family: 'Segoe';
src: url('./static/font/SegoePro-Regular.ttf');
}
}
......@@ -50,7 +50,7 @@ const getFinalResult = (final: Array<FinalResult>) => {
}
};
// get final result value // acc obj
// get final result value // acc obj
const getFinal = (final: Array<FinalResult>) => {
let showDefault: FinalType;
if (final) {
......
......@@ -109,7 +109,7 @@ interface FinalResult {
}
export {
TableObj, Parameters, Experiment,
TableObj, Parameters, Experiment,
AccurPoint, TrialNumber, TrialJob,
DetailAccurPoint, TooltipForAccuracy,
ParaObj, Dimobj, FinalResult, FinalType,
......
......@@ -41,7 +41,7 @@ $bgColor: #f2f2f2;
color: #212121;
background-color: #fff;
cursor: pointer;
border: none;
border: none;
}
.logcontent{
height: 100%;
......
......@@ -5,7 +5,7 @@
}
.overGraph{
height: 362px;
.accuracy{
width: 100%;
height: 324px;
......
......@@ -53,7 +53,7 @@ $titleBgcolor: #b3b3b3;
.minTitle{
border-right: 2px solid #fff;
}
.title:hover{
cursor: pointer;
}
......
.parameter{
height: 100%;
height: 100%;
}
.meline{
......@@ -15,14 +15,14 @@
.searcHyper{
position: relative;
margin: 0 19px;
.noneData{
position: absolute;
left: 49%;
top: 2.5%;
font-size: 13px;
color: #999;
}
}
}
/* Intermediate Result Style */
......
......@@ -26,7 +26,7 @@
border-top-left-radius: 12px;
border-bottom-left-radius: 12px;
}
.showProgress{
height: 30px;
}
......
......@@ -27,7 +27,7 @@
/* add the brother selector to increase the priority */
#succeTable .commonTableStyle, #tableList .commonTableStyle {
tr{
tr{
text-align: center;
color:#212121;
font-family: 'Segoe';
......@@ -43,14 +43,14 @@
border-bottom: 1px solid #d0d0d0;
text-align: center;
}
.ant-table-expanded-row{
/* background-color: #f2f2f2 */
background-color: transparent;
background-color: transparent;
}
tr:hover{
tr:hover{
/* cancel antd table default hover style */
td{
background-color: transparent;
......
......@@ -4,7 +4,7 @@ trialConcurrency: 3
maxExecDuration: 1h
maxTrialNum: 10
#choice: local, remote, pai
trainingServicePlatform: remote
trainingServicePlatform: remote
#choice: true, false
useAnnotation: false
multiThread: true
......
......@@ -3,5 +3,5 @@
{
"_type" : "choice",
"_value" : [1, 100]
}
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment