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
be2f3c71
Unverified
Commit
be2f3c71
authored
Feb 19, 2020
by
QuanluZhang
Committed by
GitHub
Feb 19, 2020
Browse files
fix bug in NaN support (#2077)
parent
914cc1fe
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
2 deletions
+10
-2
src/sdk/pynni/nni/bohb_advisor/bohb_advisor.py
src/sdk/pynni/nni/bohb_advisor/bohb_advisor.py
+4
-1
src/sdk/pynni/nni/hyperband_advisor/hyperband_advisor.py
src/sdk/pynni/nni/hyperband_advisor/hyperband_advisor.py
+2
-0
src/sdk/pynni/nni/msg_dispatcher.py
src/sdk/pynni/nni/msg_dispatcher.py
+4
-1
No files found.
src/sdk/pynni/nni/bohb_advisor/bohb_advisor.py
View file @
be2f3c71
...
@@ -557,7 +557,8 @@ class BOHB(MsgDispatcherBase):
...
@@ -557,7 +557,8 @@ class BOHB(MsgDispatcherBase):
Data type not supported
Data type not supported
"""
"""
logger
.
debug
(
'handle report metric data = %s'
,
data
)
logger
.
debug
(
'handle report metric data = %s'
,
data
)
if
'value'
in
data
:
data
[
'value'
]
=
json_tricks
.
loads
(
data
[
'value'
])
if
data
[
'type'
]
==
MetricType
.
REQUEST_PARAMETER
:
if
data
[
'type'
]
==
MetricType
.
REQUEST_PARAMETER
:
assert
multi_phase_enabled
()
assert
multi_phase_enabled
()
assert
data
[
'trial_job_id'
]
is
not
None
assert
data
[
'trial_job_id'
]
is
not
None
...
@@ -627,6 +628,8 @@ class BOHB(MsgDispatcherBase):
...
@@ -627,6 +628,8 @@ class BOHB(MsgDispatcherBase):
AssertionError
AssertionError
data doesn't have required key 'parameter' and 'value'
data doesn't have required key 'parameter' and 'value'
"""
"""
for
entry
in
data
:
entry
[
'value'
]
=
json_tricks
.
loads
(
entry
[
'value'
])
_completed_num
=
0
_completed_num
=
0
for
trial_info
in
data
:
for
trial_info
in
data
:
logger
.
info
(
"Importing data, current processing progress %s / %s"
,
_completed_num
,
len
(
data
))
logger
.
info
(
"Importing data, current processing progress %s / %s"
,
_completed_num
,
len
(
data
))
...
...
src/sdk/pynni/nni/hyperband_advisor/hyperband_advisor.py
View file @
be2f3c71
...
@@ -380,6 +380,8 @@ class Hyperband(MsgDispatcherBase):
...
@@ -380,6 +380,8 @@ class Hyperband(MsgDispatcherBase):
ValueError
ValueError
Data type not supported
Data type not supported
"""
"""
if
'value'
in
data
:
data
[
'value'
]
=
json_tricks
.
loads
(
data
[
'value'
])
if
data
[
'type'
]
==
MetricType
.
REQUEST_PARAMETER
:
if
data
[
'type'
]
==
MetricType
.
REQUEST_PARAMETER
:
assert
multi_phase_enabled
()
assert
multi_phase_enabled
()
assert
data
[
'trial_job_id'
]
is
not
None
assert
data
[
'trial_job_id'
]
is
not
None
...
...
src/sdk/pynni/nni/msg_dispatcher.py
View file @
be2f3c71
...
@@ -113,6 +113,8 @@ class MsgDispatcher(MsgDispatcherBase):
...
@@ -113,6 +113,8 @@ class MsgDispatcher(MsgDispatcherBase):
"""Import additional data for tuning
"""Import additional data for tuning
data: a list of dictionaries, each of which has at least two keys, 'parameter' and 'value'
data: a list of dictionaries, each of which has at least two keys, 'parameter' and 'value'
"""
"""
for
entry
in
data
:
entry
[
'value'
]
=
json_tricks
.
loads
(
entry
[
'value'
])
self
.
tuner
.
import_data
(
data
)
self
.
tuner
.
import_data
(
data
)
def
handle_add_customized_trial
(
self
,
data
):
def
handle_add_customized_trial
(
self
,
data
):
...
@@ -128,7 +130,8 @@ class MsgDispatcher(MsgDispatcherBase):
...
@@ -128,7 +130,8 @@ class MsgDispatcher(MsgDispatcherBase):
- 'type': report type, support {'FINAL', 'PERIODICAL'}
- 'type': report type, support {'FINAL', 'PERIODICAL'}
"""
"""
# metrics value is dumped as json string in trial, so we need to decode it here
# metrics value is dumped as json string in trial, so we need to decode it here
data
[
'value'
]
=
json_tricks
.
loads
(
data
[
'value'
])
if
'value'
in
data
:
data
[
'value'
]
=
json_tricks
.
loads
(
data
[
'value'
])
if
data
[
'type'
]
==
MetricType
.
FINAL
:
if
data
[
'type'
]
==
MetricType
.
FINAL
:
self
.
_handle_final_metric_data
(
data
)
self
.
_handle_final_metric_data
(
data
)
elif
data
[
'type'
]
==
MetricType
.
PERIODICAL
:
elif
data
[
'type'
]
==
MetricType
.
PERIODICAL
:
...
...
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