Unverified Commit eb65bc32 authored by liuzhe-lz's avatar liuzhe-lz Committed by GitHub
Browse files

Port trial examples' config file to v2 (#3721)


Co-authored-by: default avatarliuzhe <zhe.liu@microsoft.com>
parent c4d449c5
authorName: default searchSpaceFile: search_space.json
experimentName: example_mnist_pytorch trialCommand: python3 mnist_tensorboard.py # NOTE: change "python3" to "python" if you are using Windows
trialGpuNumber: 0
trialConcurrency: 1 trialConcurrency: 1
maxExecDuration: 1h maxTrialNumber: 10
maxTrialNum: 10
#choice: local, remote, pai
trainingServicePlatform: local
searchSpacePath: search_space.json
#choice: true, false
useAnnotation: false
tuner: tuner:
#choice: TPE, Random, Anneal, Evolution, BatchTuner, MetisTuner, GPTuner name: TPE
#SMAC (SMAC should be installed through nnictl)
builtinTunerName: TPE
classArgs: classArgs:
#choice: maximize, minimize
optimize_mode: maximize optimize_mode: maximize
trial: trainingService:
command: python3 mnist_tensorboard.py platform: local
codeDir: .
gpuNum: 0
searchSpace:
momentum:
_type: uniform
_value: [0, 1]
hidden_size:
_type: choice
_value: [128, 256, 512, 1024]
batch_size:
_type: choice
_value: [16, 32, 64, 128]
lr:
_type: choice
_value: [0.0001, 0.001, 0.01, 0.1]
trainingService:
platform: local
trialCodeDirectory: .
trialCommand: python3 mnist.py
trialConcurrency: 1
trialGpuNumber: 0
tuner:
name: TPE
classArgs:
optimize_mode: maximize
authorName: default
experimentName: example_mnist_pytorch
trialConcurrency: 1
maxExecDuration: 1h
maxTrialNum: 10
#choice: local, remote, pai
trainingServicePlatform: local
searchSpacePath: search_space.json
#choice: true, false
useAnnotation: false
tuner:
#choice: TPE, Random, Anneal, Evolution, BatchTuner, MetisTuner, GPTuner
#SMAC (SMAC should be installed through nnictl)
builtinTunerName: TPE
classArgs:
#choice: maximize, minimize
optimize_mode: maximize
trial:
command: python mnist.py
codeDir: .
gpuNum: 0
authorName: NNI Example # This is the minimal config file for an NNI experiment.
experimentName: MNIST TF v2.x # Use "nnictl create --config config.yml" to launch this experiment.
# Afterwards, you can check "config_detailed.yml" for more explanation.
searchSpaceFile: search_space.json
trialCommand: python3 mnist.py # NOTE: change "python3" to "python" if you are using Windows
trialGpuNumber: 0
trialConcurrency: 1 trialConcurrency: 1
maxExecDuration: 1h
maxTrialNum: 10
trainingServicePlatform: local # choices: local, remote, pai
searchSpacePath: search_space.json
useAnnotation: false
tuner: tuner:
builtinTunerName: TPE # choices: TPE, Random, Anneal, Evolution, BatchTuner, MetisTuner, name: TPE
# GPTuner, SMAC (SMAC should be installed through nnictl)
classArgs: classArgs:
optimize_mode: maximize # choices: maximize, minimize optimize_mode: maximize
trial: trainingService:
command: python3 mnist.py platform: local
codeDir: .
gpuNum: 0
authorName: NNI Example searchSpaceFile: search_space.json
experimentName: MNIST TF v2.x with assessor trialCommand: python3 mnist.py
trialConcurrency: 1 trialGpuNumber: 0
maxExecDuration: 1h trialConcurrency: 2
maxTrialNum: 50 maxTrialNumber: 50
#choice: local, remote
trainingServicePlatform: local
searchSpacePath: search_space.json
#choice: true, false
useAnnotation: false
tuner: tuner:
#choice: TPE, Random, Anneal, Evolution, BatchTuner, MetisTuner, GPTuner name: TPE
#SMAC (SMAC should be installed through nnictl)
builtinTunerName: TPE
classArgs: classArgs:
#choice: maximize, minimize
optimize_mode: maximize optimize_mode: maximize
assessor: assessor: # Specify early-stop algorithm
#choice: Medianstop, Curvefitting name: Curvefitting
builtinAssessorName: Curvefitting
classArgs: classArgs:
epoch_num: 20 epoch_num: 20
threshold: 0.9 threshold: 0.9
trial: trainingService:
command: python3 mnist.py platform: local
codeDir: .
gpuNum: 0
# This example shows more configurable fields comparing to the minimal "config.yml"
# You can use "nnictl create --config config_detailed.yml" to launch this experiment.
# If you see an error message saying "port 8080 is used", use "nnictl stop --all" to stop previous experiments.
name: MNIST # An optional name to help you distinguish experiments.
# Hyper-parameter search space can either be configured here or in a seperate file.
# "config.yml" shows how to specify a seperate search space file.
# The common schema of search space is documented here:
# https://nni.readthedocs.io/en/stable/Tutorial/SearchSpaceSpec.html
searchSpace:
dropout_rate:
_type: uniform
_value: [0.5, 0.9]
conv_size:
_type: choice
_value: [2, 3, 5, 7]
hidden_size:
_type: choice
_value: [128, 512, 1024]
batch_size:
_type: choice
_value: [16, 32]
learning_rate:
_type: choice
_value: [0.0001, 0.001, 0.01, 0.1]
trialCommand: python3 mnist.py # The command to launch a trial. NOTE: change "python3" to "python" if you are using Windows.
trialCodeDirectory: . # The path of trial code. By default it's ".", which means the same directory of this config file.
trialGpuNumber: 1 # How many GPUs should each trial use. CUDA is required when it's greater than zero.
trialConcurrency: 4 # Run 4 trials concurrently.
maxTrialNumber: 10 # Generate at most 10 trials.
maxExperimentDuration: 1h # Stop generating trials after 1 hour.
tuner: # Configure the tuning alogrithm.
name: TPE # Supported algorithms: TPE, Random, Anneal, Evolution, GridSearch, GPTuner, PBTTuner, etc.
# Full list: https://nni.readthedocs.io/en/latest/Tuner/BuiltinTuner.html
classArgs: # Algorithm specific arguments. See the tuner's doc for details.
optimize_mode: maximize # "minimize" or "maximize"
# Configure the training platform.
# Supported platforms: local, remote, openpai, aml, kubeflow, kubernetes, adl.
# You can find config template of some platforms in this directory, and others in mnist-pytorch example.
trainingService:
platform: local
useActiveGpu: false # NOTE: Use "true" if you are using an OS with graphical interface (e.g. Windows 10, Ubuntu desktop)
# Reason and details: https://nni.readthedocs.io/en/latest/reference/experiment_config.html#useactivegpu
searchSpaceFile: search_space.json
trialCommand: python3 mnist.py
trialGpuNumber: 0
trialConcurrency: 5
maxTrialNumber: 20
tuner:
name: TPE
classArgs:
optimize_mode: maximize
# For local, remote, openpai, and aml, NNI can use multiple training services at one time
trainingService:
- platform: local
- platform: remote
machineList:
- host: ${your server's IP or domain name}
user: ${your user name}
ssh_key_file: ~/.ssh/id_rsa
- platform: aml
dockerImage: msranni/nni
subscriptionId: ${your subscription ID}
resourceGroup: ${your resource group}
workspaceName: ${your workspace name}
computeTarget: ${your compute target}
authorName: default searchSpaceFile: search_space.json
experimentName: example_mnist trialCommand: python3 mnist.py
trialConcurrency: 1 trialGpuNumber: 0
maxExecDuration: 1h trialConcurrency: 4
maxTrialNum: 10 maxTrialNumber: 20
#choice: local, remote, pai
trainingServicePlatform: remote
searchSpacePath: search_space.json
#choice: true, false
useAnnotation: false
tuner: tuner:
#choice: TPE, Random, Anneal, Evolution, BatchTuner, MetisTuner name: TPE
#SMAC (SMAC should be installed through nnictl)
builtinTunerName: TPE
classArgs: classArgs:
#choice: maximize, minimize
optimize_mode: maximize optimize_mode: maximize
trial: trainingService:
command: python3 mnist.py platform: remote
codeDir: . machineList:
gpuNum: 0 - host: ${your server's IP or domain name}
#machineList can be empty if the platform is local user: ${your user name}
machineList: ssh_key_file: ~/.ssh/id_rsa # We recommend public key over password, it's more secure and convenient.
- ip: ${replace_to_your_remote_machine_ip} # You can specify more than one SSH servers:
username: ${replace_to_your_remote_machine_username} - host: 123.123.123.123
sshKeyPath: ${replace_to_your_remote_machine_sshKeyPath} port: 10022
# Below are examples of specifying python environment. user: nniuser
# pythonPath: /opt/python3.7/bin password: 12345
# pythonPath: C:/Python37 pythonPath: /usr/bin # Other examples:
# Below is an example of specifying python environment for windows anaconda user. Multiple paths separated by ';'. # /opt/python3.9/bin
# pythonPath: C:/Users/yourname/.conda/envs/myenv;C:/Users/yourname/.conda/envs/myenv/Scripts;C:/Users/yourname/.conda/envs/myenv/Library/bin # C:/Python39
pythonPath: ${replace_to_python_environment_path_in_your_remote_machine} # C:/Users/USERNAME/.conda/envs/ENVNAME;C:/Users/USERNAME/.conda/envs/ENVNAME/Scripts;C:/Users/USERNAME/.conda/envs/ENVNAME/Library/bin
searchSpace:
dropout_rate:
_type: uniform
_value: [0.5, 0.9]
conv_size:
_type: choice
_value: [2, 3, 5, 7]
hidden_size:
_type: choice
_value: [128, 512, 1024]
batch_size:
_type: choice
_value: [16, 32]
learning_rate:
_type: choice
_value: [0.0001, 0.001, 0.01, 0.1]
trainingService:
platform: local
trialCodeDirectory: .
trialCommand: python3 mnist.py
trialConcurrency: 1
trialGpuNumber: 0
tuner:
name: TPE
classArgs:
optimize_mode: maximize
authorName: NNI Example
experimentName: MNIST TF v2.x
trialConcurrency: 1
maxExecDuration: 1h
maxTrialNum: 10
#choice: local, remote, pai
trainingServicePlatform: local
searchSpacePath: search_space.json
#choice: true, false
useAnnotation: false
tuner:
#choice: TPE, Random, Anneal, Evolution, BatchTuner, MetisTuner, GPTuner
#SMAC (SMAC should be installed through nnictl)
builtinTunerName: TPE
classArgs:
#choice: maximize, minimize
optimize_mode: maximize
trial:
command: python mnist.py
codeDir: .
gpuNum: 0
authorName: default trialCommand: python3 FashionMNIST_keras.py
experimentName: example_FashionMNIST-network-morphism trialGpuNumber: 1
trialConcurrency: 4 trialConcurrency: 4
maxExecDuration: 48h maxExperimentDuration: 48h
maxTrialNum: 200 maxTrialNumber: 200
#choice: local, remote, pai searchSpace: {} # search space of NetworkMorphism is provided via classArgs
trainingServicePlatform: local
#searchSpacePath: search_space.json
#choice: true, false
useAnnotation: false
tuner: tuner:
#choice: TPE, Random, Anneal, Evolution, BatchTuner, NetworkMorphism name: NetworkMorphism
#SMAC (SMAC should be installed through nnictl)
builtinTunerName: NetworkMorphism
classArgs: classArgs:
#choice: maximize, minimize optimize_mode: maximize # maximize or minimize
optimize_mode: maximize task: cv # for now, this tuner only supports cv domain
#for now, this tuner only supports cv domain input_width: 28 # input image width
task: cv input_channel: 1 # input image channel
#input image width n_output_node: 10 # number of classes
input_width: 28 trainingService:
#input image channel platform: local
input_channel: 1 useActiveGpu: false # NOTE: Use "true" if you are using an OS with graphical interface (e.g. Windows 10, Ubuntu desktop)
#number of classes # Check the doc for details: https://nni.readthedocs.io/en/latest/reference/experiment_config.html#useactivegpu
n_output_node: 10
trial:
command: python3 FashionMNIST_keras.py
codeDir: .
gpuNum: 1
authorName: default
experimentName: example_FashionMNIST-network-morphism
trialConcurrency: 1
maxExecDuration: 24h
maxTrialNum: 10
#choice: local, remote, pai
trainingServicePlatform: pai
#choice: true, false
useAnnotation: false
tuner:
#choice: TPE, Random, Anneal, Evolution, BatchTuner, NetworkMorphism
#SMAC (SMAC should be installed through nnictl)
builtinTunerName: NetworkMorphism
classArgs:
#choice: maximize, minimize
optimize_mode: maximize
# for now, this tuner only supports cv domain
task: cv
#input image width
input_width: 28
#input image channel
input_channel: 1
#number of classes
n_output_node: 10
trial:
command: python3 FashionMNIST_keras.py
codeDir: .
gpuNum: 1
cpuNum: 1
memoryMB: 8196
#The docker image to run nni job on pai
image: msranni/nni:latest
nniManagerNFSMountPath: {replace_to_your_nfs_mount_path}
containerNFSMountPath: {replace_to_your_container_mount_path}
paiStorageConfigName: {replace_to_your_storage_config_name}
paiConfig:
#The username to login pai
userName: username
#The token to login pai
token: token
#The host of restful server of pai
host: 10.10.10.10
\ No newline at end of file
authorName: default trialCommand: python3 cifar10_keras.py
experimentName: example_cifar10-network-morphism trialGpuNumber: 1
trialConcurrency: 4 trialConcurrency: 4
maxExecDuration: 48h maxExperimentDuration: 48h
maxTrialNum: 200 maxTrialNumber: 200
#choice: local, remote, pai searchSpace: {} # search space of NetworkMorphism is provided via classArgs
trainingServicePlatform: local
#searchSpacePath: search_space.json
#choice: true, false
useAnnotation: false
tuner: tuner:
#choice: TPE, Random, Anneal, Evolution, BatchTuner, NetworkMorphism name: NetworkMorphism
#SMAC (SMAC should be installed through nnictl)
builtinTunerName: NetworkMorphism
classArgs: classArgs:
#choice: maximize, minimize optimize_mode: maximize # maximize or minimize
optimize_mode: maximize task: cv # for now, this tuner only supports cv domain
#for now, this tuner only supports cv domain input_width: 32 # input image width
task: cv input_channel: 3 # input image channel
#input image width n_output_node: 10 # number of classes
input_width: 32 trainingService:
#input image channel platform: local
input_channel: 3 useActiveGpu: false # NOTE: Use "true" if you are using an OS with graphical interface (e.g. Windows 10, Ubuntu desktop)
#number of classes # Check the doc for details: https://nni.readthedocs.io/en/latest/reference/experiment_config.html#useactivegpu
n_output_node: 10
trial:
command: python3 cifar10_keras.py
codeDir: .
gpuNum: 1
authorName: default
experimentName: example_cifar10-network-morphism
trialConcurrency: 1
maxExecDuration: 24h
maxTrialNum: 10
#choice: local, remote, pai
trainingServicePlatform: pai
#choice: true, false
useAnnotation: false
tuner:
#choice: TPE, Random, Anneal, Evolution, BatchTuner, NetworkMorphism
#SMAC (SMAC should be installed through nnictl)
builtinTunerName: NetworkMorphism
classArgs:
#choice: maximize, minimize
optimize_mode: maximize
# for now, this tuner only supports cv domain
task: cv
#input image width
input_width: 32
#input image channel
input_channel: 3
#number of classes
n_output_node: 10
trial:
command: python3 cifar10_keras.py
codeDir: .
gpuNum: 1
cpuNum: 1
memoryMB: 8196
#The docker image to run nni job on pai
image: msranni/nni:latest
nniManagerNFSMountPath: {replace_to_your_nfs_mount_path}
containerNFSMountPath: {replace_to_your_container_mount_path}
paiStorageConfigName: {replace_to_your_storage_config_name}
paiConfig:
#The username to login pai
userName: username
#The token to login pai
token: token
#The host of restful server of pai
host: 10.10.10.10
\ No newline at end of file
authorName: default searchSpaceFile: search_space.json
experimentName: example_sklearn-classification trialCommand: python3 main.py
trialConcurrency: 1 trialConcurrency: 1
maxExecDuration: 1h maxTrialNumber: 100
maxTrialNum: 100 maxExperimentDuration: 1h
#choice: local, remote
trainingServicePlatform: local
searchSpacePath: search_space.json
#choice: true, false
useAnnotation: false
tuner: tuner:
#choice: TPE, Random, Anneal, Evolution, BatchTuner, MetisTuner name: TPE
builtinTunerName: TPE
classArgs: classArgs:
#choice: maximize, minimize
optimize_mode: maximize optimize_mode: maximize
trial: trainingService: # For other platforms, check mnist-pytorch example
command: python3 main.py platform: local
codeDir: .
gpuNum: 0
\ No newline at end of file
authorName: default
experimentName: example_sklearn
trialConcurrency: 1
maxExecDuration: 1h
maxTrialNum: 100
#choice: local, remote, pai
trainingServicePlatform: pai
searchSpacePath: search_space.json
#choice: true, false
useAnnotation: false
tuner:
#choice: TPE, Random, Anneal, Evolution, BatchTuner,MetisTuner
#SMAC (SMAC should be installed through nnictl)
builtinTunerName: TPE
classArgs:
#choice: maximize, minimize
optimize_mode: maximize
trial:
command: python3 main.py
codeDir: .
gpuNum: 0
cpuNum: 1
memoryMB: 8196
#The docker image to run nni job on pai
image: msranni/nni:latest
nniManagerNFSMountPath: {replace_to_your_nfs_mount_path}
containerNFSMountPath: {replace_to_your_container_mount_path}
paiStorageConfigName: {replace_to_your_storage_config_name}
paiConfig:
#The username to login pai
userName: username
#The token to login pai
token: token
#The host of restful server of pai
host: 10.10.10.10
\ No newline at end of file
authorName: default searchSpaceFile: search_space.json
experimentName: example_sklearn-regression trialCommand: python3 main.py
trialConcurrency: 1 trialConcurrency: 1
maxExecDuration: 1h maxTrialNumber: 30
maxTrialNum: 30 maxExperimentDuration: 1h
#choice: local, remote
trainingServicePlatform: local
searchSpacePath: search_space.json
#choice: true, false
useAnnotation: false
tuner: tuner:
#choice: TPE, Random, Anneal, Evolution, BatchTuner, MetisTuner name: TPE
builtinTunerName: TPE
classArgs: classArgs:
#choice: maximize, minimize
optimize_mode: maximize optimize_mode: maximize
trial: trainingService: # For other platforms, check mnist-pytorch example
command: python3 main.py platform: local
codeDir: .
gpuNum: 0
\ No newline at end of file
authorName: default
experimentName: example_sklearn
trialConcurrency: 1
maxExecDuration: 1h
maxTrialNum: 100
#choice: local, remote, pai
trainingServicePlatform: pai
searchSpacePath: search_space.json
#choice: true, false
useAnnotation: false
tuner:
#choice: TPE, Random, Anneal, Evolution, BatchTuner, MetisTuner
#SMAC (SMAC should be installed through nnictl)
builtinTunerName: TPE
classArgs:
#choice: maximize, minimize
optimize_mode: maximize
trial:
command: python3 main.py
codeDir: .
gpuNum: 0
cpuNum: 1
memoryMB: 8196
#The docker image to run nni job on pai
image: msranni/nni:latest
nniManagerNFSMountPath: {replace_to_your_nfs_mount_path}
containerNFSMountPath: {replace_to_your_container_mount_path}
paiStorageConfigName: {replace_to_your_storage_config_name}
paiConfig:
#The username to login pai
userName: username
#The token to login pai
token: token
#The host of restful server of pai
host: 10.10.10.10
\ No newline at end of file
...@@ -124,7 +124,7 @@ class ConfigBase: ...@@ -124,7 +124,7 @@ class ConfigBase:
type_name = str(field.type).replace('typing.', '') type_name = str(field.type).replace('typing.', '')
optional = any([ optional = any([
type_name.startswith('Optional['), type_name.startswith('Optional['),
type_name.startswith('Union[') and 'NoneType' in type_name, type_name.startswith('Union[') and 'None' in type_name,
type_name == 'Any' type_name == 'Any'
]) ])
if value is None: if value is None:
......
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