Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
nni
Commits
d48ad027
Unverified
Commit
d48ad027
authored
Jun 20, 2019
by
SparkSnail
Committed by
GitHub
Jun 20, 2019
Browse files
Merge pull request #184 from microsoft/master
merge master
parents
9352cc88
22993e5d
Changes
187
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
50 additions
and
50 deletions
+50
-50
src/sdk/pynni/nni/platform/local.py
src/sdk/pynni/nni/platform/local.py
+3
-3
src/sdk/pynni/nni/smac_tuner/convert_ss_to_scenario.py
src/sdk/pynni/nni/smac_tuner/convert_ss_to_scenario.py
+15
-15
src/sdk/pynni/nni/smac_tuner/smac_tuner.py
src/sdk/pynni/nni/smac_tuner/smac_tuner.py
+8
-8
src/sdk/pynni/tests/test_multi_phase_tuner.py
src/sdk/pynni/tests/test_multi_phase_tuner.py
+1
-1
src/sdk/pynni/tests/test_trial.py
src/sdk/pynni/tests/test_trial.py
+1
-1
src/webui/src/App.css
src/webui/src/App.css
+1
-1
src/webui/src/components/TrialsDetail.tsx
src/webui/src/components/TrialsDetail.tsx
+1
-1
src/webui/src/components/overview/Progress.tsx
src/webui/src/components/overview/Progress.tsx
+1
-1
src/webui/src/components/public-child/TrialLog.tsx
src/webui/src/components/public-child/TrialLog.tsx
+1
-1
src/webui/src/index.css
src/webui/src/index.css
+3
-3
src/webui/src/static/function.ts
src/webui/src/static/function.ts
+1
-1
src/webui/src/static/interface.ts
src/webui/src/static/interface.ts
+1
-1
src/webui/src/static/style/openRow.scss
src/webui/src/static/style/openRow.scss
+1
-1
src/webui/src/static/style/overview.scss
src/webui/src/static/style/overview.scss
+1
-1
src/webui/src/static/style/overviewTitle.scss
src/webui/src/static/style/overviewTitle.scss
+1
-1
src/webui/src/static/style/para.scss
src/webui/src/static/style/para.scss
+3
-3
src/webui/src/static/style/progress.scss
src/webui/src/static/style/progress.scss
+1
-1
src/webui/src/static/style/table.scss
src/webui/src/static/style/table.scss
+4
-4
test/async_sharing_test/config.yml
test/async_sharing_test/config.yml
+1
-1
test/config_test/multi_phase/search_space.json
test/config_test/multi_phase/search_space.json
+1
-1
No files found.
src/sdk/pynni/nni/platform/local.py
View file @
d48ad027
...
...
@@ -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"
:
...
...
src/sdk/pynni/nni/smac_tuner/convert_ss_to_scenario.py
View file @
d48ad027
...
...
@@ -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.
...
...
src/sdk/pynni/nni/smac_tuner/smac_tuner.py
View file @
d48ad027
...
...
@@ -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
...
...
src/sdk/pynni/tests/test_multi_phase_tuner.py
View file @
d48ad027
...
...
@@ -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
):
...
...
src/sdk/pynni/tests/test_trial.py
View file @
d48ad027
...
...
@@ -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
(),
{
...
...
src/webui/src/App.css
View file @
d48ad027
...
...
@@ -10,7 +10,7 @@
left
:
0
;
top
:
0
;
width
:
100%
;
height
:
56px
;
height
:
56px
;
background
:
#0071BC
;
border-right
:
1px
solid
#ccc
;
z-index
:
1000
;
...
...
src/webui/src/components/TrialsDetail.tsx
View file @
d48ad027
...
...
@@ -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
{
...
...
src/webui/src/components/overview/Progress.tsx
View file @
d48ad027
...
...
@@ -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
;
...
...
src/webui/src/components/public-child/TrialLog.tsx
View file @
d48ad027
...
...
@@ -15,7 +15,7 @@ class TrialLog extends React.Component<TrialLogProps, {}> {
render
()
{
const
{
logStr
}
=
this
.
props
;
return
(
<
div
>
<
LogPathChild
...
...
src/webui/src/index.css
View file @
d48ad027
...
...
@@ -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')
;
}
}
src/webui/src/static/function.ts
View file @
d48ad027
...
...
@@ -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
)
{
...
...
src/webui/src/static/interface.ts
View file @
d48ad027
...
...
@@ -109,7 +109,7 @@ interface FinalResult {
}
export
{
TableObj
,
Parameters
,
Experiment
,
TableObj
,
Parameters
,
Experiment
,
AccurPoint
,
TrialNumber
,
TrialJob
,
DetailAccurPoint
,
TooltipForAccuracy
,
ParaObj
,
Dimobj
,
FinalResult
,
FinalType
,
...
...
src/webui/src/static/style/openRow.scss
View file @
d48ad027
...
...
@@ -41,7 +41,7 @@ $bgColor: #f2f2f2;
color
:
#212121
;
background-color
:
#fff
;
cursor
:
pointer
;
border
:
none
;
border
:
none
;
}
.logcontent
{
height
:
100%
;
...
...
src/webui/src/static/style/overview.scss
View file @
d48ad027
...
...
@@ -5,7 +5,7 @@
}
.overGraph
{
height
:
362px
;
.accuracy
{
width
:
100%
;
height
:
324px
;
...
...
src/webui/src/static/style/overviewTitle.scss
View file @
d48ad027
...
...
@@ -53,7 +53,7 @@ $titleBgcolor: #b3b3b3;
.minTitle
{
border-right
:
2px
solid
#fff
;
}
.title
:hover
{
cursor
:
pointer
;
}
...
...
src/webui/src/static/style/para.scss
View file @
d48ad027
.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 */
...
...
src/webui/src/static/style/progress.scss
View file @
d48ad027
...
...
@@ -26,7 +26,7 @@
border-top-left-radius
:
12px
;
border-bottom-left-radius
:
12px
;
}
.showProgress
{
height
:
30px
;
}
...
...
src/webui/src/static/style/table.scss
View file @
d48ad027
...
...
@@ -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
;
...
...
test/async_sharing_test/config.yml
View file @
d48ad027
...
...
@@ -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
...
...
test/config_test/multi_phase/search_space.json
View file @
d48ad027
...
...
@@ -3,5 +3,5 @@
{
"_type"
:
"choice"
,
"_value"
:
[
1
,
100
]
}
}
}
\ No newline at end of file
Prev
1
…
4
5
6
7
8
9
10
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment