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

Fix bug in import data feature #1003

Merged
merged 7 commits into from
Apr 22, 2019
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
8 changes: 4 additions & 4 deletions docs/en_US/NNICTLDOC.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ Debug mode will disable version check function in Trialkeeper.
`update experiment's new search space with file dir 'examples/trials/mnist/search_space.json'`

```bash
nnictl update searchspace [experiment_id] --file examples/trials/mnist/search_space.json
nnictl update searchspace [experiment_id] --filename examples/trials/mnist/search_space.json
```

* __nnictl update concurrency__
Expand Down Expand Up @@ -388,15 +388,15 @@ Debug mode will disable version check function in Trialkeeper.
|Name, shorthand|Required|Default|Description|
|------|------|------ |------|
|id| False| |ID of the experiment |
|--file| True| |File path of the output file |
|--filename, -f| True| |File path of the output file |
|--type| True| |Type of output file, only support "csv" and "json"|

* Examples

> export all trial data in an experiment as json format

```bash
nnictl experiment export [experiment_id] --file [file_path] --type json
nnictl experiment export [experiment_id] --filename [file_path] --type json
```

* __nnictl experiment import__
Expand All @@ -415,7 +415,7 @@ Debug mode will disable version check function in Trialkeeper.
|Name, shorthand|Required|Default|Description|
|------|------|------|------|
|id| False| |The id of the experiment you want to import data into|
|--file, -f| True| |a file with data you want to import in json format|
|--filename, -f| True| |a file with data you want to import in json format|

* Details

Expand Down
17 changes: 12 additions & 5 deletions src/sdk/pynni/nni/bohb_advisor/bohb_advisor.py
Original file line number Diff line number Diff line change
Expand Up @@ -589,19 +589,26 @@ def handle_import_data(self, data):
"""
_completed_num = 0
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)))
_completed_num += 1
assert "parameter" in trial_info
_params = trial_info["parameter"]
assert "value" in trial_info
_value = trial_info['value']
if _KEY not in _params:
_params[_KEY] = self.max_budget
budget_exist_flag = False
barely_params = dict()
for keys in _params:
if keys == _KEY:
_budget = _params[keys]
budget_exist_flag = True
else:
barely_params[keys] = _params[keys]
if not budget_exist_flag:
_budget = self.max_budget
logger.info("Set \"TRIAL_BUDGET\" value to %s (max budget)" %self.max_budget)
if self.optimize_mode is OptimizeMode.Maximize:
reward = -_value
else:
reward = _value
_budget = _params[_KEY]
self.cg.new_result(loss=reward, budget=_budget, parameters=_params, update_model=True)
self.cg.new_result(loss=reward, budget=_budget, parameters=barely_params, update_model=True)
logger.info("Successfully import tuning data to BOHB advisor.")
2 changes: 1 addition & 1 deletion src/sdk/pynni/nni/gridsearch_tuner/gridsearch_tuner.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def import_data(self, data):
"""
_completed_num = 0
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)))
_completed_num += 1
assert "parameter" in trial_info
_params = trial_info["parameter"]
Expand Down
2 changes: 1 addition & 1 deletion src/sdk/pynni/nni/hyperopt_tuner/hyperopt_tuner.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ def import_data(self, data):
"""
_completed_num = 0
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)))
_completed_num += 1
if self.algorithm_name == 'random_search':
return
Expand Down
2 changes: 1 addition & 1 deletion src/sdk/pynni/nni/metis_tuner/metis_tuner.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ def import_data(self, data):
"""
_completed_num = 0
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)))
_completed_num += 1
assert "parameter" in trial_info
_params = trial_info["parameter"]
Expand Down