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

Commit

Permalink
fix experiment import bug and add it cases: experiment import & export
Browse files Browse the repository at this point in the history
  • Loading branch information
Ning Shang committed Sep 10, 2020
1 parent 3bc8104 commit 15f8671
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/sdk/pynni/nni/msg_dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ def handle_import_data(self, data):
data: a list of dictionaries, each of which has at least two keys, 'parameter' and 'value'
"""
for entry in data:
entry['value'] = entry['value'] if type(entry['value']) is str else json_tricks.dumps(entry['value'])
entry['value'] = json_tricks.loads(entry['value'])
self.tuner.import_data(data)

Expand Down
14 changes: 14 additions & 0 deletions test/config/integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,20 @@ testCases:
launchCommand: nnictl view $resumeExpId
experimentStatusCheck: False

# Experiment import test
- name: nnictl-experiment-import
configFile: test/config/nnictl_experiment/sklearn-classification.yml
setExperimentIdtoVar: $imoprtExpId
stopCommand: nnictl experiment import $imoprtExpId -f config/nnictl_experiment/test_import.json
onExitCommand: nnictl stop

# Experiment export test
- name: nnictl-experiment-export
configFile: test/config/nnictl_experiment/sklearn-classification.yml
launchCommand: nnictl resume $imoprtExpId
stopCommand: nnictl experiment export --filename config/nnictl_experiment/test_export.json --type json --intermediate
onExitCommand: nnictl stop

- name: multi-thread
configFile: test/config/multi_thread/config.yml

Expand Down
23 changes: 23 additions & 0 deletions test/config/nnictl_experiment/sklearn-classification.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
authorName: nni
experimentName: default_test
maxExecDuration: 5m
maxTrialNum: 4
trialConcurrency: 2
searchSpacePath: ../../../examples/trials/sklearn/classification/search_space.json

tuner:
builtinTunerName: TPE
assessor:
builtinAssessorName: Medianstop
classArgs:
optimize_mode: maximize
trial:
codeDir: ../../../examples/trials/sklearn/classification
command: python3 main.py
gpuNum: 0

useAnnotation: false
multiPhase: false
multiThread: false

trainingServicePlatform: local
4 changes: 4 additions & 0 deletions test/config/nnictl_experiment/test_import.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[
{"parameter": {"C": 0.15940134774738896, "kernel": "sigmoid", "degree": 3, "gamma": 0.07295826917955316, "coef0 ": 0.0978204758732429}, "value": 0.6},
{"parameter": {"C": 0.5556430724708544, "kernel": "linear", "degree": 3, "gamma": 0.04957496655414671, "coef0 ": 0.08520868779907687}, "value": 0.7}
]

0 comments on commit 15f8671

Please sign in to comment.