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

Commit

Permalink
Fix bug introduced in customized trial (#1779)
Browse files Browse the repository at this point in the history
  • Loading branch information
liuzhe-lz authored and chicm-ms committed Nov 25, 2019
1 parent 48084d8 commit 31b2b88
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/sdk/pynni/nni/msg_dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def _handle_final_metric_data(self, data):
"""
id_ = data['parameter_id']
value = data['value']
if not id_ or id_ in _customized_parameter_ids:
if id_ is None or id_ in _customized_parameter_ids:
if not hasattr(self.tuner, '_accept_customized'):
self.tuner._accept_customized = False
if not self.tuner._accept_customized:
Expand Down
5 changes: 5 additions & 0 deletions test/config_test/multi_thread/multi_thread_tuner.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import logging
import time
from nni.tuner import Tuner

Expand All @@ -7,14 +8,18 @@ def __init__(self):
self.parent_done = False

def generate_parameters(self, parameter_id, **kwargs):
logging.debug('generate_parameters: %s %s', parameter_id, kwargs)
if parameter_id == 0:
return {'x': 0}
else:
while not self.parent_done:
logging.debug('parameter_id %s sleeping', parameter_id)
time.sleep(2)
logging.debug('parameter_id %s waked up', parameter_id)
return {'x': 1}

def receive_trial_result(self, parameter_id, parameters, value, **kwargs):
logging.debug('receive_trial_result: %s %s %s %s', parameter_id, parameters, value, kwargs)
if parameter_id == 0:
self.parent_done = True

Expand Down

0 comments on commit 31b2b88

Please sign in to comment.