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

Fix metrics decode error on non-local platform #2152

Merged
merged 2 commits into from
Mar 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 2 additions & 3 deletions src/sdk/pynni/nni/platform/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,8 @@ def get_next_parameter():

def send_metric(string):
if _nni_platform != 'local':
data = (string).encode('utf8')
assert len(data) < 1000000, 'Metric too long'
print('NNISDK_ME%s' % (data), flush=True)
assert len(string) < 1000000, 'Metric too long'
print("NNISDK_MEb'%s'" % (string), flush=True)
else:
data = (string + '\n').encode('utf8')
assert len(data) < 1000000, 'Metric too long'
Expand Down
5 changes: 3 additions & 2 deletions src/sdk/pynni/nni/trial.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,9 @@ def report_final_result(metric):

Parameters
----------
metric:
serializable object.
metric: serializable object
Usually (for built-in tuners to work), it should be a number, or
a dict with key "default" (a number), and any other extra keys.
"""
assert _params or trial_env_vars.NNI_PLATFORM is None, \
'nni.get_next_parameter() needs to be called before report_final_result'
Expand Down