This repository has been archived by the owner on Sep 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
support hybrid training service v2.0 config #3251
Merged
Merged
Changes from 7 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
878bab6
support hybrid training service config
QuanluZhang 8cc4333
update convert
QuanluZhang d43a199
update
QuanluZhang 3ef1938
remove comments
QuanluZhang 51d044d
Merge branch 'v2.0' of https://github.com/microsoft/nni into hybrid-c…
QuanluZhang cb502d3
Merge branch 'v2.0' of https://github.com/microsoft/nni into hybrid-c…
QuanluZhang 89fbda6
support hybrid in python launch
QuanluZhang 6620b68
resolve comment
QuanluZhang 7f27c89
resolve comments and conflict
QuanluZhang 42b7e52
minor
QuanluZhang 732e737
Merge branch 'v2.0' of https://github.com/microsoft/nni into hybrid-c…
QuanluZhang 2849ea9
fix bug
QuanluZhang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
experimentName: example_mnist | ||
trialConcurrency: 3 | ||
maxExperimentDuration: 1h | ||
maxTrialNumber: 10 | ||
searchSpaceFile: search_space.json | ||
nniManagerIp: 10.150.144.59 | ||
debug: true | ||
|
||
trialCodeDirectory: . | ||
trialCommand: python3 mnist.py | ||
trialGpuNumber: 0 | ||
tuner: | ||
name: TPE | ||
classArgs: | ||
optimize_mode: maximize | ||
|
||
trainingService: | ||
- platform: local | ||
- platform: remote | ||
reuseMode: true | ||
machineList: | ||
- host: 10.190.175.223 | ||
user: xxx | ||
password: xxx | ||
#port can be skip if using default ssh port 22 | ||
port: 22 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# FIXME: For demonstration only. It should not be here | ||
|
||
from pathlib import Path | ||
|
||
from nni.experiment import Experiment | ||
from nni.experiment import RemoteMachineConfig | ||
from nni.algorithms.hpo.hyperopt_tuner import HyperoptTuner | ||
|
||
tuner = HyperoptTuner('tpe') | ||
|
||
search_space = { | ||
"dropout_rate": { "_type": "uniform", "_value": [0.5, 0.9] }, | ||
"conv_size": { "_type": "choice", "_value": [2, 3, 5, 7] }, | ||
"hidden_size": { "_type": "choice", "_value": [124, 512, 1024] }, | ||
"batch_size": { "_type": "choice", "_value": [16, 32] }, | ||
"learning_rate": { "_type": "choice", "_value": [0.0001, 0.001, 0.01, 0.1] } | ||
} | ||
|
||
experiment = Experiment(tuner, ['local', 'remote']) | ||
experiment.config.experiment_name = 'test' | ||
experiment.config.trial_concurrency = 3 | ||
experiment.config.max_trial_number = 10 | ||
experiment.config.search_space = search_space | ||
experiment.config.nni_manager_ip = '10.150.144.59' | ||
experiment.config.trial_command = 'python3 mnist.py' | ||
experiment.config.trial_code_directory = Path(__file__).parent | ||
experiment.config.training_service[0].use_active_gpu = True | ||
experiment.config.training_service[1].reuse_mode = True | ||
rm_conf = RemoteMachineConfig() | ||
rm_conf.host = '10.190.175.223' | ||
rm_conf.user = 'xxx' | ||
rm_conf.password = 'xxx' | ||
rm_conf.port = 22 | ||
experiment.config.training_service[1].machine_list = [rm_conf] | ||
|
||
experiment.run(26780, debug=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
from subprocess import Popen | ||
from threading import Thread | ||
import time | ||
from typing import Optional, overload | ||
from typing import Optional, Union, List, overload | ||
|
||
import colorama | ||
import psutil | ||
|
@@ -52,7 +52,7 @@ def __init__(self, tuner: Tuner, config: ExperimentConfig) -> None: | |
... | ||
|
||
@overload | ||
def __init__(self, tuner: Tuner, training_service: str) -> None: | ||
def __init__(self, tuner: Tuner, training_service: Union[str, List[str]]) -> None: | ||
""" | ||
Prepare an experiment, leaving configuration fields to be set later. | ||
|
||
|
@@ -83,7 +83,7 @@ def __init__(self, tuner: Tuner, config=None, training_service=None): | |
self._dispatcher: Optional[MsgDispatcher] = None | ||
self._dispatcher_thread: Optional[Thread] = None | ||
|
||
if isinstance(config, str): | ||
if isinstance(config, (str, list)): | ||
config, training_service = None, config | ||
|
||
if config is None: | ||
|
@@ -171,6 +171,7 @@ def run(self, port: int = 8080, debug: bool = False) -> bool: | |
while True: | ||
time.sleep(10) | ||
status = self.get_status() | ||
print('zqlllll: ', status) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's this line used for? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sorry, forgot to remove it... |
||
if status == 'DONE' or status == 'STOPPED': | ||
return True | ||
if status == 'ERROR': | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove ip and version check