Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
nni
Commits
3423117d
Unverified
Commit
3423117d
authored
Jan 04, 2021
by
Yuge Zhang
Committed by
GitHub
Jan 04, 2021
Browse files
Add config v2 example and refine validation error message (#3248)
parent
bdb2826e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
9 deletions
+63
-9
examples/trials/mnist-pytorch/config_v2.yml
examples/trials/mnist-pytorch/config_v2.yml
+23
-0
examples/trials/mnist-tfv2/config_v2.yml
examples/trials/mnist-tfv2/config_v2.yml
+26
-0
nni/tools/nnictl/launcher.py
nni/tools/nnictl/launcher.py
+14
-9
No files found.
examples/trials/mnist-pytorch/config_v2.yml
0 → 100644
View file @
3423117d
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
examples/trials/mnist-tfv2/config_v2.yml
0 → 100644
View file @
3423117d
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
nni/tools/nnictl/launcher.py
View file @
3423117d
...
@@ -17,7 +17,7 @@ from .launcher_utils import validate_all_content
...
@@ -17,7 +17,7 @@ from .launcher_utils import validate_all_content
from
.rest_utils
import
rest_put
,
rest_post
,
check_rest_server
,
check_response
from
.rest_utils
import
rest_put
,
rest_post
,
check_rest_server
,
check_response
from
.url_utils
import
cluster_metadata_url
,
experiment_url
,
get_local_urls
from
.url_utils
import
cluster_metadata_url
,
experiment_url
,
get_local_urls
from
.config_utils
import
Config
,
Experiments
from
.config_utils
import
Config
,
Experiments
from
.common_utils
import
get_yml_content
,
get_json_content
,
print_error
,
print_normal
,
\
from
.common_utils
import
get_yml_content
,
get_json_content
,
print_error
,
print_normal
,
print_warning
,
\
detect_port
,
get_user
detect_port
,
get_user
from
.constants
import
NNICTL_HOME_DIR
,
ERROR_INFO
,
REST_TIME_OUT
,
EXPERIMENT_SUCCESS_INFO
,
LOG_HEADER
from
.constants
import
NNICTL_HOME_DIR
,
ERROR_INFO
,
REST_TIME_OUT
,
EXPERIMENT_SUCCESS_INFO
,
LOG_HEADER
...
@@ -592,16 +592,21 @@ def create_experiment(args):
...
@@ -592,16 +592,21 @@ def create_experiment(args):
print_error
(
'Please set correct config path!'
)
print_error
(
'Please set correct config path!'
)
exit
(
1
)
exit
(
1
)
experiment_config
=
get_yml_content
(
config_path
)
experiment_config
=
get_yml_content
(
config_path
)
try
:
config
=
ExperimentConfig
(
**
experiment_config
)
experiment_config
=
convert
.
to_v1_yaml
(
config
)
except
Exception
:
pass
try
:
try
:
validate_all_content
(
experiment_config
,
config_path
)
validate_all_content
(
experiment_config
,
config_path
)
except
Exception
as
e
:
except
Exception
:
print_error
(
e
)
print_warning
(
'Validation with V1 schema failed. Trying to convert from V2 format...'
)
exit
(
1
)
try
:
config
=
ExperimentConfig
(
**
experiment_config
)
experiment_config
=
convert
.
to_v1_yaml
(
config
)
except
Exception
as
e
:
print_error
(
f
'Conversion from v2 format failed:
{
repr
(
e
)
}
'
)
try
:
validate_all_content
(
experiment_config
,
config_path
)
except
Exception
as
e
:
print_error
(
f
'Config validation failed.
{
repr
(
e
)
}
'
)
exit
(
1
)
nni_config
.
set_config
(
'experimentConfig'
,
experiment_config
)
nni_config
.
set_config
(
'experimentConfig'
,
experiment_config
)
nni_config
.
set_config
(
'restServerPort'
,
args
.
port
)
nni_config
.
set_config
(
'restServerPort'
,
args
.
port
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment