Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
nni
Commits
e25ffbda
Unverified
Commit
e25ffbda
authored
Mar 13, 2019
by
SparkSnail
Committed by
GitHub
Mar 13, 2019
Browse files
Merge pull request #141 from Microsoft/master
merge master
parents
17e719e0
7d91796c
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
65 additions
and
36 deletions
+65
-36
Makefile
Makefile
+3
-8
azure-pipelines.yml
azure-pipelines.yml
+8
-20
setup.py
setup.py
+5
-0
src/nni_manager/common/log.ts
src/nni_manager/common/log.ts
+1
-1
src/sdk/pynni/nni/common.py
src/sdk/pynni/nni/common.py
+3
-2
src/sdk/pynni/nni/hyperband_advisor/hyperband_advisor.py
src/sdk/pynni/nni/hyperband_advisor/hyperband_advisor.py
+5
-4
test/pipelines-it-local.yml
test/pipelines-it-local.yml
+38
-0
test/unittest.sh
test/unittest.sh
+2
-1
No files found.
Makefile
View file @
e25ffbda
...
@@ -168,18 +168,13 @@ install-dependencies: $(NNI_NODE_TARBALL) $(NNI_YARN_TARBALL)
...
@@ -168,18 +168,13 @@ install-dependencies: $(NNI_NODE_TARBALL) $(NNI_YARN_TARBALL)
.PHONY
:
install-python-modules
.PHONY
:
install-python-modules
install-python-modules
:
install-python-modules
:
#
$(_INFO)
Installing Python SDK
$(_END)
#
$(_INFO)
Installing Python SDK
$(_END)
cd
src/sdk/pynni
&&
sed
-ie
's/
$(NNI_VERSION_TEMPLATE)
/
$(NNI_VERSION_VALUE)
/'
setup.py
&&
$(PIP_INSTALL)
$(PIP_MODE)
.
sed
-ie
's/
$(NNI_VERSION_TEMPLATE)
/
$(NNI_VERSION_VALUE)
/'
setup.py
&&
$(PIP_INSTALL)
$(PIP_MODE)
.
#
$(_INFO)
Installing nnictl
$(_END)
cd
tools
&&
sed
-ie
's/
$(NNI_VERSION_TEMPLATE)
/
$(NNI_VERSION_VALUE)
/'
setup.py
&&
$(PIP_INSTALL)
$(PIP_MODE)
.
.PHONY
:
dev-install-python-modules
.PHONY
:
dev-install-python-modules
dev-install-python-modules
:
dev-install-python-modules
:
#
$(_INFO)
Installing Python SDK
$(_END)
#
$(_INFO)
Installing Python SDK
$(_END)
cd
src/sdk/pynni
&&
sed
-ie
's/
$(NNI_VERSION_TEMPLATE)
/
$(NNI_VERSION_VALUE)
/'
setup.py
&&
$(PIP_INSTALL)
$(PIP_MODE)
-e
.
sed
-ie
's/
$(NNI_VERSION_TEMPLATE)
/
$(NNI_VERSION_VALUE)
/'
setup.py
&&
$(PIP_INSTALL)
$(PIP_MODE)
.
#
$(_INFO)
Installing nnictl
$(_END)
cd
tools
&&
sed
-ie
's/
$(NNI_VERSION_TEMPLATE)
/
$(NNI_VERSION_VALUE)
/'
setup.py
&&
$(PIP_INSTALL)
$(PIP_MODE)
-e
.
.PHONY
:
install-node-modules
.PHONY
:
install-node-modules
install-node-modules
:
install-node-modules
:
...
...
azure-pipelines.yml
View file @
e25ffbda
trigger
:
-
master
-
dev-remote-ci
jobs
:
jobs
:
-
job
:
'
Ubuntu_16_04'
-
job
:
'
basic_test_pr_ubuntu'
pool
:
'
NNI
CI
GPU'
pool
:
vmImage
:
'
Ubuntu
16.04'
strategy
:
matrix
:
Python36
:
PYTHON_VERSION
:
'
3.6'
steps
:
steps
:
-
script
:
python3 -m pip install --upgrade pip setuptools --user
-
script
:
python3 -m pip install --upgrade pip setuptools --user
...
@@ -12,15 +13,6 @@ jobs:
...
@@ -12,15 +13,6 @@ jobs:
-
script
:
|
-
script
:
|
source install.sh
source install.sh
displayName
:
'
Install
nni
toolkit
via
source
code'
displayName
:
'
Install
nni
toolkit
via
source
code'
-
script
:
|
python3 -m pip install scikit-learn==0.20.0 --user
python3 -m pip install torch==0.4.1 --user
python3 -m pip install torchvision==0.2.1 --user
python3 -m pip install keras==2.1.6 --user
python3 -m pip install tensorflow-gpu==1.10.0 --user
sudo apt-get install swig -y
nnictl package install --name=SMAC
displayName
:
'
Install
dependencies
for
integration
tests'
-
script
:
|
-
script
:
|
cd test
cd test
source unittest.sh
source unittest.sh
...
@@ -33,16 +25,12 @@ jobs:
...
@@ -33,16 +25,12 @@ jobs:
cd test
cd test
PATH=$HOME/.local/bin:$PATH python3 tuner_test.py
PATH=$HOME/.local/bin:$PATH python3 tuner_test.py
displayName
:
'
Built-in
tuners
/
assessors
tests'
displayName
:
'
Built-in
tuners
/
assessors
tests'
-
script
:
|
cd test
PATH=$HOME/.local/bin:$PATH python3 config_test.py --ts local --local_gpu
displayName
:
'
Examples
and
advanced
features
tests
on
local
machine'
-
script
:
|
-
script
:
|
cd test
cd test
PATH=$HOME/.local/bin:$PATH python3 metrics_test.py
PATH=$HOME/.local/bin:$PATH python3 metrics_test.py
displayName
:
'
Trial
job
metrics
test'
displayName
:
'
Trial
job
metrics
test'
-
job
:
'
macOS_10_13
'
-
job
:
'
basic_test_pr_macOS
'
pool
:
pool
:
vmImage
:
'
macOS
10.13'
vmImage
:
'
macOS
10.13'
strategy
:
strategy
:
...
...
setup.py
View file @
e25ffbda
...
@@ -68,5 +68,10 @@ setup(
...
@@ -68,5 +68,10 @@ setup(
cmdclass
=
{
cmdclass
=
{
'install'
:
CustomInstallCommand
'install'
:
CustomInstallCommand
},
entry_points
=
{
'console_scripts'
:
[
'nnictl = nni_cmd.nnictl:parse_args'
]
}
}
)
)
src/nni_manager/common/log.ts
View file @
e25ffbda
...
@@ -137,7 +137,7 @@ class Logger {
...
@@ -137,7 +137,7 @@ class Logger {
private
log
(
level
:
string
,
param
:
any
[]):
void
{
private
log
(
level
:
string
,
param
:
any
[]):
void
{
const
buffer
:
WritableStreamBuffer
=
new
WritableStreamBuffer
();
const
buffer
:
WritableStreamBuffer
=
new
WritableStreamBuffer
();
buffer
.
write
(
`[
${(
new
Date
()).
to
ISO
String
()}
]
${
level
}
`
);
buffer
.
write
(
`[
${(
new
Date
()).
to
Locale
String
()}
]
${
level
}
`
);
buffer
.
write
(
format
(
param
));
buffer
.
write
(
format
(
param
));
buffer
.
write
(
'
\n
'
);
buffer
.
write
(
'
\n
'
);
buffer
.
end
();
buffer
.
end
();
...
...
src/sdk/pynni/nni/common.py
View file @
e25ffbda
...
@@ -25,6 +25,7 @@ from io import TextIOBase
...
@@ -25,6 +25,7 @@ from io import TextIOBase
import
logging
import
logging
import
os
import
os
import
sys
import
sys
import
time
def
_load_env_args
():
def
_load_env_args
():
...
@@ -40,7 +41,7 @@ env_args = _load_env_args()
...
@@ -40,7 +41,7 @@ env_args = _load_env_args()
'''Arguments passed from environment'''
'''Arguments passed from environment'''
_time_format
=
'%
Y-%m-%d
%
H
:%M:%S'
_time_format
=
'%
m/%d/%Y,
%
I
:%M:%S
%P
'
class
_LoggerFileWrapper
(
TextIOBase
):
class
_LoggerFileWrapper
(
TextIOBase
):
def
__init__
(
self
,
logger_file
):
def
__init__
(
self
,
logger_file
):
self
.
file
=
logger_file
self
.
file
=
logger_file
...
@@ -64,8 +65,8 @@ def init_logger(logger_file_path):
...
@@ -64,8 +65,8 @@ def init_logger(logger_file_path):
logger_file_path
=
os
.
path
.
join
(
env_args
.
log_dir
,
logger_file_path
)
logger_file_path
=
os
.
path
.
join
(
env_args
.
log_dir
,
logger_file_path
)
logger_file
=
open
(
logger_file_path
,
'w'
)
logger_file
=
open
(
logger_file_path
,
'w'
)
fmt
=
'[%(asctime)s] %(levelname)s (%(name)s/%(threadName)s) %(message)s'
fmt
=
'[%(asctime)s] %(levelname)s (%(name)s/%(threadName)s) %(message)s'
logging
.
Formatter
.
converter
=
time
.
localtime
formatter
=
logging
.
Formatter
(
fmt
,
_time_format
)
formatter
=
logging
.
Formatter
(
fmt
,
_time_format
)
handler
=
logging
.
StreamHandler
(
logger_file
)
handler
=
logging
.
StreamHandler
(
logger_file
)
handler
.
setFormatter
(
formatter
)
handler
.
setFormatter
(
formatter
)
...
...
src/sdk/pynni/nni/hyperband_advisor/hyperband_advisor.py
View file @
e25ffbda
...
@@ -38,6 +38,7 @@ _logger = logging.getLogger(__name__)
...
@@ -38,6 +38,7 @@ _logger = logging.getLogger(__name__)
_next_parameter_id
=
0
_next_parameter_id
=
0
_KEY
=
'STEPS'
_KEY
=
'STEPS'
_epsilon
=
1e-6
@
unique
@
unique
class
OptimizeMode
(
Enum
):
class
OptimizeMode
(
Enum
):
...
@@ -141,8 +142,8 @@ class Bracket():
...
@@ -141,8 +142,8 @@ class Bracket():
self
.
bracket_id
=
s
self
.
bracket_id
=
s
self
.
s_max
=
s_max
self
.
s_max
=
s_max
self
.
eta
=
eta
self
.
eta
=
eta
self
.
n
=
math
.
ceil
((
s_max
+
1
)
*
(
eta
**
s
)
/
(
s
+
1
))
# pylint: disable=invalid-name
self
.
n
=
math
.
ceil
((
s_max
+
1
)
*
(
eta
**
s
)
/
(
s
+
1
)
-
_epsilon
)
# pylint: disable=invalid-name
self
.
r
=
math
.
ceil
(
R
/
eta
**
s
)
# pylint: disable=invalid-name
self
.
r
=
math
.
ceil
(
R
/
eta
**
s
-
_epsilon
)
# pylint: disable=invalid-name
self
.
i
=
0
self
.
i
=
0
self
.
hyper_configs
=
[]
# [ {id: params}, {}, ... ]
self
.
hyper_configs
=
[]
# [ {id: params}, {}, ... ]
self
.
configs_perf
=
[]
# [ {id: [seq, acc]}, {}, ... ]
self
.
configs_perf
=
[]
# [ {id: [seq, acc]}, {}, ... ]
...
@@ -157,7 +158,7 @@ class Bracket():
...
@@ -157,7 +158,7 @@ class Bracket():
def
get_n_r
(
self
):
def
get_n_r
(
self
):
"""return the values of n and r for the next round"""
"""return the values of n and r for the next round"""
return
math
.
floor
(
self
.
n
/
self
.
eta
**
self
.
i
),
self
.
r
*
self
.
eta
**
self
.
i
return
math
.
floor
(
self
.
n
/
self
.
eta
**
self
.
i
+
_epsilon
),
self
.
r
*
self
.
eta
**
self
.
i
def
increase_i
(
self
):
def
increase_i
(
self
):
"""i means the ith round. Increase i by 1"""
"""i means the ith round. Increase i by 1"""
...
@@ -305,7 +306,7 @@ class Hyperband(MsgDispatcherBase):
...
@@ -305,7 +306,7 @@ class Hyperband(MsgDispatcherBase):
self
.
brackets
=
dict
()
# dict of Bracket
self
.
brackets
=
dict
()
# dict of Bracket
self
.
generated_hyper_configs
=
[]
# all the configs waiting for run
self
.
generated_hyper_configs
=
[]
# all the configs waiting for run
self
.
completed_hyper_configs
=
[]
# all the completed configs
self
.
completed_hyper_configs
=
[]
# all the completed configs
self
.
s_max
=
math
.
floor
(
math
.
log
(
self
.
R
,
self
.
eta
))
self
.
s_max
=
math
.
floor
(
math
.
log
(
self
.
R
,
self
.
eta
)
+
_epsilon
)
self
.
curr_s
=
self
.
s_max
self
.
curr_s
=
self
.
s_max
self
.
searchspace_json
=
None
self
.
searchspace_json
=
None
...
...
test/pipelines-it-local.yml
0 → 100644
View file @
e25ffbda
jobs
:
-
job
:
'
integration_test_local_ubuntu'
steps
:
-
script
:
python3 -m pip install --upgrade pip setuptools --user
displayName
:
'
Install
python
tools'
-
script
:
|
source install.sh
displayName
:
'
Install
nni
toolkit
via
source
code'
-
script
:
|
python3 -m pip install scikit-learn==0.20.0 --user
python3 -m pip install torch==0.4.1 --user
python3 -m pip install torchvision==0.2.1 --user
python3 -m pip install keras==2.1.6 --user
python3 -m pip install tensorflow-gpu==1.10.0 --user
sudo apt-get install swig -y
nnictl package install --name=SMAC
displayName
:
'
Install
dependencies
for
integration
tests'
-
script
:
|
cd test
source unittest.sh
displayName
:
'
Unit
test'
-
script
:
|
cd test
PATH=$HOME/.local/bin:$PATH python3 naive_test.py
displayName
:
'
Naive
test'
-
script
:
|
cd test
PATH=$HOME/.local/bin:$PATH python3 tuner_test.py
displayName
:
'
Built-in
tuners
/
assessors
tests'
-
script
:
|
cd test
PATH=$HOME/.local/bin:$PATH python3 config_test.py --ts local --local_gpu
displayName
:
'
Examples
and
advanced
features
tests
on
local
machine'
-
script
:
|
cd test
PATH=$HOME/.local/bin:$PATH python3 metrics_test.py
displayName
:
'
Trial
job
metrics
test'
test/unittest.sh
100644 → 100755
View file @
e25ffbda
#!/bin/bash
#!/bin/bash
set
-e
CWD
=
${
PWD
}
CWD
=
${
PWD
}
# -------------For python unittest-------------
# -------------For python unittest-------------
...
@@ -25,4 +26,4 @@ python3 -m unittest discover -v tests
...
@@ -25,4 +26,4 @@ python3 -m unittest discover -v tests
cd
${
CWD
}
/../src/nni_manager
cd
${
CWD
}
/../src/nni_manager
echo
""
echo
""
echo
"===========================Testing: nni_manager==========================="
echo
"===========================Testing: nni_manager==========================="
npm run
test
npm run
test
\ No newline at end of file
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