Unverified Commit 94e98240 authored by QuanluZhang's avatar QuanluZhang Committed by GitHub
Browse files

[bug fix] fix the bug in update search space (#4438)

parent 3f6a8274
......@@ -11,7 +11,6 @@ import colorama
import psutil
import nni.runtime.log
from nni.common import dump
from .config import ExperimentConfig
from .data import TrialJob, TrialMetricData, TrialResult
......@@ -463,7 +462,6 @@ class Experiment:
value: dict
New search_space.
"""
value = dump(value)
self._update_experiment_profile('searchSpace', value)
def update_max_trial_number(self, value: int):
......
......@@ -41,7 +41,7 @@ def validate_dispatcher(args):
def load_search_space(path):
'''load search space content'''
content = json.dumps(get_json_content(path))
content = get_json_content(path)
if not content:
raise ValueError('searchSpace file should not be empty')
return content
......@@ -112,11 +112,18 @@ def update_trialnum(args):
else:
print_error('Update %s failed!' % 'trialnum')
def load_imported_data(path):
'''load the trial data that will be imported'''
content = json.dumps(get_json_content(path))
if not content:
raise ValueError('Imported data should not be empty')
return content
def import_data(args):
'''import additional data to the experiment'''
validate_file(args.filename)
validate_dispatcher(args)
content = load_search_space(args.filename)
content = load_imported_data(args.filename)
experiments_dict = Experiments().get_all_experiments()
experiment_id = get_config_filename(args)
......
......@@ -509,13 +509,13 @@ class NNIManager implements Manager {
return;
}
private updateSearchSpace(searchSpace: string): void {
private updateSearchSpace(searchSpace: object): void {
if (this.dispatcher === undefined) {
throw new Error('Error: tuner has not been setup');
}
this.log.info(`Updated search space ${searchSpace}`);
this.dispatcher.sendCommand(UPDATE_SEARCH_SPACE, searchSpace);
this.experimentProfile.params.searchSpace = JSON.parse(searchSpace);
this.dispatcher.sendCommand(UPDATE_SEARCH_SPACE, JSON.stringify(searchSpace));
this.experimentProfile.params.searchSpace = searchSpace;
return;
}
......
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