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
4b67c457
Unverified
Commit
4b67c457
authored
Dec 22, 2021
by
liuzhe-lz
Committed by
GitHub
Dec 22, 2021
Browse files
Fix backward incompatible config behavior (#4408)
parent
f2ddea0a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
2 deletions
+6
-2
nni/experiment/config/exp_config.py
nni/experiment/config/exp_config.py
+1
-1
test/ut/experiment/test_exp_config.py
test/ut/experiment/test_exp_config.py
+5
-1
No files found.
nni/experiment/config/exp_config.py
View file @
4b67c457
...
@@ -89,7 +89,7 @@ class ExperimentConfig(ConfigBase):
...
@@ -89,7 +89,7 @@ class ExperimentConfig(ConfigBase):
for
algo_type
in
[
'tuner'
,
'assessor'
,
'advisor'
]:
for
algo_type
in
[
'tuner'
,
'assessor'
,
'advisor'
]:
# add placeholder items, so users can write `config.tuner.name = 'random'`
# add placeholder items, so users can write `config.tuner.name = 'random'`
if
getattr
(
self
,
algo_type
)
is
None
:
if
getattr
(
self
,
algo_type
)
is
None
:
setattr
(
self
,
algo_type
,
_AlgorithmConfig
(
name
=
'_none_'
))
setattr
(
self
,
algo_type
,
_AlgorithmConfig
(
name
=
'_none_'
,
class_args
=
{}
))
elif
not
utils
.
is_missing
(
self
.
training_service
):
elif
not
utils
.
is_missing
(
self
.
training_service
):
# training service is set via json or constructor
# training service is set via json or constructor
if
isinstance
(
self
.
training_service
,
list
):
if
isinstance
(
self
.
training_service
,
list
):
...
...
test/ut/experiment/test_exp_config.py
View file @
4b67c457
import
copy
import
os.path
import
os.path
from
pathlib
import
Path
from
pathlib
import
Path
...
@@ -46,6 +47,9 @@ minimal_canon = {
...
@@ -46,6 +47,9 @@ minimal_canon = {
},
},
}
}
minimal_canon_2
=
copy
.
deepcopy
(
minimal_canon
)
minimal_canon_2
[
'tuner'
][
'classArgs'
]
=
{}
## detailed config ##
## detailed config ##
detailed_canon
=
{
detailed_canon
=
{
...
@@ -100,7 +104,7 @@ def test_all():
...
@@ -100,7 +104,7 @@ def test_all():
minimal
=
ExperimentConfig
(
**
minimal_json
)
minimal
=
ExperimentConfig
(
**
minimal_json
)
assert
minimal
.
json
()
==
minimal_canon
assert
minimal
.
json
()
==
minimal_canon
assert
minimal_class
.
json
()
==
minimal_canon
assert
minimal_class
.
json
()
==
minimal_canon
_2
detailed
=
ExperimentConfig
.
load
(
expand_path
(
'assets/config.yaml'
))
detailed
=
ExperimentConfig
.
load
(
expand_path
(
'assets/config.yaml'
))
assert
detailed
.
json
()
==
detailed_canon
assert
detailed
.
json
()
==
detailed_canon
...
...
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