Commit 642967b8 authored by Shufan Huang's avatar Shufan Huang Committed by QuanluZhang
Browse files

Fix bug in import data feature (#1003)

fix bug in import data function
parent 32744774
......@@ -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__
......@@ -388,7 +388,7 @@ 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
......@@ -396,7 +396,7 @@ Debug mode will disable version check function in Trialkeeper.
> 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__
......@@ -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
......
......@@ -589,19 +589,26 @@ class BOHB(MsgDispatcherBase):
"""
_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.")
......@@ -160,7 +160,7 @@ class GridSearchTuner(Tuner):
"""
_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"]
......
......@@ -365,7 +365,7 @@ class HyperoptTuner(Tuner):
"""
_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
......
......@@ -411,7 +411,7 @@ class MetisTuner(Tuner):
"""
_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"]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment