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
e3872ba1
Commit
e3872ba1
authored
Nov 05, 2018
by
Gems Guo
Committed by
goooxu
Nov 05, 2018
Browse files
Uniform the names of python modules
parent
761638d8
Changes
38
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
46 additions
and
50 deletions
+46
-50
Makefile
Makefile
+1
-1
README.md
README.md
+3
-4
deployment/pypi/.gitignore
deployment/pypi/.gitignore
+1
-3
deployment/pypi/Makefile
deployment/pypi/Makefile
+5
-9
deployment/pypi/setup.py
deployment/pypi/setup.py
+9
-4
docs/GetStarted.md
docs/GetStarted.md
+2
-2
docs/InstallNNI_Ubuntu.md
docs/InstallNNI_Ubuntu.md
+2
-2
docs/RemoteMachineMode.md
docs/RemoteMachineMode.md
+1
-1
docs/tutorial_2_RemoteMachineMode.md
docs/tutorial_2_RemoteMachineMode.md
+1
-1
setup.py
setup.py
+4
-4
src/nni_manager/common/log.ts
src/nni_manager/common/log.ts
+4
-4
src/nni_manager/core/nnimanager.ts
src/nni_manager/core/nnimanager.ts
+4
-6
src/nni_manager/training_service/pai/paiData.ts
src/nni_manager/training_service/pai/paiData.ts
+1
-1
test/nnictl
test/nnictl
+1
-1
tools/nni_cmd/__init__.py
tools/nni_cmd/__init__.py
+0
-0
tools/nni_cmd/common_utils.py
tools/nni_cmd/common_utils.py
+0
-0
tools/nni_cmd/config_schema.py
tools/nni_cmd/config_schema.py
+0
-0
tools/nni_cmd/config_utils.py
tools/nni_cmd/config_utils.py
+0
-0
tools/nni_cmd/constants.py
tools/nni_cmd/constants.py
+0
-0
tools/nni_cmd/launcher.py
tools/nni_cmd/launcher.py
+7
-7
No files found.
Makefile
View file @
e3872ba1
...
...
@@ -22,7 +22,7 @@ else # is normal user
endif
BIN_FOLDER
?=
$(ROOT_FOLDER)
/bin
NNI_PKG_FOLDER
?=
$(ROOT_FOLDER)
/nni
_pkg
NNI_PKG_FOLDER
?=
$(ROOT_FOLDER)
/nni
## Dependency information
$(info
$(_INFO)
Installing
dependencies,
use
local
toolchain
$(_END))
...
...
README.md
View file @
e3872ba1
...
...
@@ -32,7 +32,7 @@ The tool dispatches and runs trial jobs generated by tuning algorithms to search
*
We only support Linux (Ubuntu 16.04 or higher) in our current stage.
*
Run the following commands in an environment that has
`python >= 3.5`
,
`git`
and
`wget`
.
```
bash
git clone
-b
v0.3.
0
https://github.com/Microsoft/nni.git
git clone
-b
v0.3.
2
https://github.com/Microsoft/nni.git
cd
nni
source
install.sh
```
...
...
@@ -41,12 +41,11 @@ The tool dispatches and runs trial jobs generated by tuning algorithms to search
*
The following example is an experiment built on TensorFlow. Make sure you have
**TensorFlow installed**
before running it.
*
Download the examples via clone the source code.
```
bash
cd
~
git clone
-b
v0.3.0 https://github.com/Microsoft/nni.git
git clone
-b
v0.3.2 https://github.com/Microsoft/nni.git
```
*
Run the mnist example.
```
bash
nnictl create
--config
~/
nni/examples/trials/mnist/config.yml
nnictl create
--config
nni/examples/trials/mnist/config.yml
```
*
Wait for the message
`INFO: Successfully started experiment!`
in the command line. This message indicates that your experiment has been successfully started. You can explore the experiment using the
`Web UI url`
.
...
...
deployment/pypi/.gitignore
View file @
e3872ba1
nni_pkg/
nni_annotation/
nnicmd/
nni/
dist/
build/
*.egg-info/
...
...
deployment/pypi/Makefile
View file @
e3872ba1
...
...
@@ -9,15 +9,11 @@ build:
tar
xf
$(CWD)
node-linux-x64.tar.xz
-C
node-linux-x64
--strip-components
1
cd
$(CWD)
../../src/nni_manager
&&
yarn
&&
yarn build
cd
$(CWD)
../../src/webui
&&
yarn
&&
yarn build
rm
-rf
$(CWD)
nni_pkg
cp
-r
$(CWD)
../../src/nni_manager/dist
$(CWD)
nni_pkg
cp
-r
$(CWD)
../../src/webui/build
$(CWD)
nni_pkg/static
cp
$(CWD)
../../src/nni_manager/package.json
$(CWD)
nni_pkg
cd
$(CWD)
nni_pkg
&&
yarn
--prod
rm
-rf
$(CWD)
nnicmd
rm
-rf
$(CWD)
nni_annotation
cp
-r
$(CWD)
../../tools/nnicmd
$(CWD)
nnicmd
cp
-r
$(CWD)
../../tools/nni_annotation
$(CWD)
nni_annotation
rm
-rf
$(CWD)
nni
cp
-r
$(CWD)
../../src/nni_manager/dist
$(CWD)
nni
cp
-r
$(CWD)
../../src/webui/build
$(CWD)
nni/static
cp
$(CWD)
../../src/nni_manager/package.json
$(CWD)
nni
cd
$(CWD)
nni
&&
yarn
--prod
cd
$(CWD)
&&
python3 setup.py bdist_wheel
cd
$(CWD)
../../src/sdk/pynni
&&
python3 setup.py bdist_wheel
cp
-r
$(CWD)
../../src/sdk/pynni/dist/
*
.whl
$(CWD)
dist
...
...
deployment/pypi/setup.py
View file @
e3872ba1
...
...
@@ -2,7 +2,7 @@ import setuptools
from
os
import
walk
,
path
data_files
=
[(
'bin'
,
[
'node-linux-x64/bin/node'
])]
for
(
dirpath
,
dirnames
,
filenames
)
in
walk
(
'./nni
_pkg
'
):
for
(
dirpath
,
dirnames
,
filenames
)
in
walk
(
'./nni'
):
files
=
[
path
.
normpath
(
path
.
join
(
dirpath
,
filename
))
for
filename
in
filenames
]
data_files
.
append
((
path
.
normpath
(
dirpath
),
files
))
...
...
@@ -11,7 +11,7 @@ with open('../../README.md', 'r') as fh:
setuptools
.
setup
(
name
=
'nni'
,
version
=
'0.3.
0
'
,
version
=
'0.3.
2
'
,
author
=
'Microsoft NNI team'
,
author_email
=
'nni@microsoft.com'
,
description
=
'Neural Network Intelligence package'
,
...
...
@@ -19,7 +19,12 @@ setuptools.setup(
long_description_content_type
=
'text/markdown'
,
license
=
'MIT'
,
url
=
'https://github.com/Microsoft/nni'
,
packages
=
setuptools
.
find_packages
(),
packages
=
setuptools
.
find_packages
(
'../../tools'
),
package_dir
=
{
'nni_annotation'
:
'../../tools/nni_annotation'
,
'nni_cmd'
:
'../../tools/nni_cmd'
,
'nni_trial_tool'
:
'../../tools/nni_trial_tool'
},
python_requires
=
'>=3.5'
,
install_requires
=
[
'nni-sdk'
,
...
...
@@ -37,7 +42,7 @@ setuptools.setup(
data_files
=
data_files
,
entry_points
=
{
'console_scripts'
:
[
'nnictl = nnicmd.nnictl:parse_args'
'nnictl = nni
_
cmd.nnictl:parse_args'
]
}
)
\ No newline at end of file
docs/GetStarted.md
View file @
e3872ba1
...
...
@@ -14,11 +14,11 @@
*
__Install NNI through pip__
python3 -m pip install --user nni
python3 -m pip install --user
--upgrade
nni
*
__Install NNI through source code__
git clone -b v0.3.
0
https://github.com/Microsoft/nni.git
git clone -b v0.3.
2
https://github.com/Microsoft/nni.git
cd nni
source install.sh
...
...
docs/InstallNNI_Ubuntu.md
View file @
e3872ba1
...
...
@@ -12,11 +12,11 @@
*
__Install NNI through pip__
python3 -m pip install --user nni
python3 -m pip install --user
--upgrade
nni
*
__Install NNI through source code__
git clone -b v0.3.
0
https://github.com/Microsoft/nni.git
git clone -b v0.3.
2
https://github.com/Microsoft/nni.git
cd nni
source install.sh
...
...
docs/RemoteMachineMode.md
View file @
e3872ba1
...
...
@@ -15,7 +15,7 @@ For remote machines that are used only to run trials but not the nnictl, you can
*
__Install python SDK through pip__
python3 -m pip install --user nni-sdk
python3 -m pip install --user
--upgrade
nni-sdk
*
__Install python SDK through source code__
...
...
docs/tutorial_2_RemoteMachineMode.md
View file @
e3872ba1
...
...
@@ -15,7 +15,7 @@ For remote machines that are used only to run trials but not the nnictl, you can
*
__Install python SDK through pip__
python3 -m pip install --user nni-sdk
python3 -m pip install --user
--upgrade
nni-sdk
*
__Install python SDK through source code__
...
...
setup.py
View file @
e3872ba1
...
...
@@ -35,7 +35,7 @@ class CustomInstallCommand(install):
setup
(
name
=
'nni'
,
version
=
'0.3.
0
'
,
version
=
'0.3.
2
'
,
author
=
'Microsoft NNI Team'
,
author_email
=
'nni@microsoft.com'
,
description
=
'Neural Network Intelligence project'
,
...
...
@@ -45,10 +45,10 @@ setup(
packages
=
find_packages
(
'src/sdk/pynni'
,
exclude
=
[
'tests'
])
+
find_packages
(
'tools'
),
package_dir
=
{
'nni_annotation'
:
'tools/nni_annotation'
,
'nni'
:
'src/sdk/pynni/nni'
,
'nnicmd'
:
'tools/nnicmd'
,
'trial_tool'
:
'tools/trial_tool'
'nni_annotation'
:
'tools/nni_annotation'
,
'nni_cmd'
:
'tools/nni_cmd'
,
'nni_trial_tool'
:
'tools/nni_trial_tool'
},
package_data
=
{
'nni'
:
[
'**/requirements.txt'
]},
python_requires
=
'>=3.5'
,
...
...
src/nni_manager/common/log.ts
View file @
e3872ba1
...
...
@@ -70,23 +70,23 @@ class Logger {
private
DEFAULT_LOGFILE
:
string
=
path
.
join
(
getLogDir
(),
'
nnimanager.log
'
);
private
level
:
number
=
DEBUG
;
private
bufferSerialEmitter
:
BufferSerialEmitter
;
private
writble
:
Writable
;
private
writ
a
ble
:
Writable
;
constructor
(
fileName
?:
string
)
{
let
logFile
:
string
|
undefined
=
fileName
;
if
(
logFile
===
undefined
)
{
logFile
=
this
.
DEFAULT_LOGFILE
;
}
this
.
writble
=
fs
.
createWriteStream
(
logFile
,
{
this
.
writ
a
ble
=
fs
.
createWriteStream
(
logFile
,
{
flags
:
'
a+
'
,
encoding
:
'
utf8
'
,
autoClose
:
true
});
this
.
bufferSerialEmitter
=
new
BufferSerialEmitter
(
this
.
writble
);
this
.
bufferSerialEmitter
=
new
BufferSerialEmitter
(
this
.
writ
a
ble
);
}
public
close
()
{
this
.
writble
.
destroy
();
this
.
writ
a
ble
.
destroy
();
}
public
debug
(...
param
:
any
[]):
void
{
...
...
src/nni_manager/core/nnimanager.ts
View file @
e3872ba1
...
...
@@ -341,7 +341,7 @@ class NNIManager implements Manager {
private
async
periodicallyUpdateExecDuration
():
Promise
<
void
>
{
let
count
:
number
=
1
;
while
(
this
.
status
.
status
!==
'
STOPPING
'
)
{
while
(
this
.
status
.
status
!==
'
STOPPING
'
&&
this
.
status
.
status
!==
'
STOPPED
'
)
{
await
delay
(
1000
*
1
);
// 1 seconds
if
(
this
.
status
.
status
===
'
EXPERIMENT_RUNNING
'
)
{
this
.
experimentProfile
.
execDuration
+=
1
;
...
...
@@ -354,7 +354,6 @@ class NNIManager implements Manager {
}
private
async
requestTrialJobsStatus
():
Promise
<
number
>
{
const
deferred
:
Deferred
<
number
>
=
new
Deferred
<
number
>
();
let
finishedTrialJobNum
:
number
=
0
;
for
(
const
trialJobId
of
Array
.
from
(
this
.
trialJobs
.
keys
()))
{
const
trialJobDetail
:
TrialJobDetail
=
await
this
.
trainingService
.
getTrialJob
(
trialJobId
);
...
...
@@ -385,9 +384,8 @@ class NNIManager implements Manager {
// TO DO: add warning in log
}
}
deferred
.
resolve
(
finishedTrialJobNum
);
return
deferred
.
promise
;
return
finishedTrialJobNum
;
}
private
async
manageTrials
():
Promise
<
void
>
{
...
...
@@ -395,7 +393,7 @@ class NNIManager implements Manager {
throw
new
Error
(
'
Error: tuner has not been setup
'
);
}
let
allFinishedTrialJobNum
:
number
=
0
;
while
(
this
.
status
.
status
!==
'
STOPPING
'
)
{
while
(
this
.
status
.
status
!==
'
STOPPING
'
&&
this
.
status
.
status
!==
'
STOPPED
'
)
{
const
finishedTrialJobNum
:
number
=
await
this
.
requestTrialJobsStatus
();
allFinishedTrialJobNum
+=
finishedTrialJobNum
;
...
...
src/nni_manager/training_service/pai/paiData.ts
View file @
e3872ba1
...
...
@@ -62,7 +62,7 @@ fi`;
export
const
PAI_TRIAL_COMMAND_FORMAT
:
string
=
`export NNI_PLATFORM=pai NNI_SYS_DIR={0} NNI_OUTPUT_DIR={1} NNI_TRIAL_JOB_ID={2} NNI_EXP_ID={3}
&& cd $NNI_SYS_DIR && sh install_nni.sh
&& python3 -m trial_tool.trial_keeper --trial_command '{4}' --nnimanager_ip '{5}' --pai_hdfs_output_dir '{6}'
&& python3 -m
nni_
trial_tool.trial_keeper --trial_command '{4}' --nnimanager_ip '{5}' --pai_hdfs_output_dir '{6}'
--pai_hdfs_host '{7}' --pai_user_name {8}`
;
export
const
PAI_OUTPUT_DIR_FORMAT
:
string
=
...
...
test/nnictl
View file @
e3872ba1
#!/bin/sh
python3
-m
nnicmd.nnictl
$@
python3
-m
nni
_
cmd.nnictl
$@
tools/nnicmd/__init__.py
→
tools/nni
_
cmd/__init__.py
View file @
e3872ba1
File moved
tools/nnicmd/common_utils.py
→
tools/nni
_
cmd/common_utils.py
View file @
e3872ba1
File moved
tools/nnicmd/config_schema.py
→
tools/nni
_
cmd/config_schema.py
View file @
e3872ba1
File moved
tools/nnicmd/config_utils.py
→
tools/nni
_
cmd/config_utils.py
View file @
e3872ba1
File moved
tools/nnicmd/constants.py
→
tools/nni
_
cmd/constants.py
View file @
e3872ba1
File moved
tools/nnicmd/launcher.py
→
tools/nni
_
cmd/launcher.py
View file @
e3872ba1
...
...
@@ -72,7 +72,7 @@ def start_rest_server(port, platform, mode, config_file_name, experiment_id=None
else
:
site_dir
=
site
.
getusersitepackages
()
python_dir
=
str
(
Path
(
site_dir
).
parents
[
2
])
cmds
=
[
'node'
,
os
.
path
.
join
(
python_dir
,
'nni
_pkg
'
,
'main.js'
),
'--port'
,
str
(
port
),
'--mode'
,
platform
,
'--start_mode'
,
mode
]
cmds
=
[
'node'
,
os
.
path
.
join
(
python_dir
,
'nni'
,
'main.js'
),
'--port'
,
str
(
port
),
'--mode'
,
platform
,
'--start_mode'
,
mode
]
if
mode
==
'resume'
:
cmds
+=
[
'--experiment_id'
,
experiment_id
]
stdout_full_path
,
stderr_full_path
=
get_log_path
(
config_file_name
)
...
...
@@ -83,7 +83,7 @@ def start_rest_server(port, platform, mode, config_file_name, experiment_id=None
log_header
=
LOG_HEADER
%
str
(
time_now
)
stdout_file
.
write
(
log_header
)
stderr_file
.
write
(
log_header
)
process
=
Popen
(
cmds
,
cwd
=
os
.
path
.
join
(
python_dir
,
'nni
_pkg
'
),
stdout
=
stdout_file
,
stderr
=
stderr_file
)
process
=
Popen
(
cmds
,
cwd
=
os
.
path
.
join
(
python_dir
,
'nni'
),
stdout
=
stdout_file
,
stderr
=
stderr_file
)
return
process
,
str
(
time_now
)
def
set_trial_config
(
experiment_config
,
port
,
config_file_name
):
...
...
@@ -250,7 +250,7 @@ def launch_experiment(args, experiment_config, mode, config_file_name, experimen
print_error
(
'Restful server start failed!'
)
print_log_content
(
config_file_name
)
try
:
cmds
=
[
'
p
kill'
,
'-P'
,
str
(
rest_process
.
pid
)]
cmds
=
[
'kill'
,
str
(
rest_process
.
pid
)]
call
(
cmds
)
except
Exception
:
raise
Exception
(
ERROR_INFO
%
'Rest server stopped!'
)
...
...
@@ -265,7 +265,7 @@ def launch_experiment(args, experiment_config, mode, config_file_name, experimen
else
:
print_error
(
'Failed! Error is: {}'
.
format
(
err_msg
))
try
:
cmds
=
[
'
p
kill'
,
'-P'
,
str
(
rest_process
.
pid
)]
cmds
=
[
'kill'
,
str
(
rest_process
.
pid
)]
call
(
cmds
)
except
Exception
:
raise
Exception
(
ERROR_INFO
%
'Rest server stopped!'
)
...
...
@@ -279,7 +279,7 @@ def launch_experiment(args, experiment_config, mode, config_file_name, experimen
else
:
print_error
(
'Set local config failed!'
)
try
:
cmds
=
[
'
p
kill'
,
'-P'
,
str
(
rest_process
.
pid
)]
cmds
=
[
'kill'
,
str
(
rest_process
.
pid
)]
call
(
cmds
)
except
Exception
:
raise
Exception
(
ERROR_INFO
%
'Rest server stopped!'
)
...
...
@@ -295,7 +295,7 @@ def launch_experiment(args, experiment_config, mode, config_file_name, experimen
if
err_msg
:
print_error
(
'Failed! Error is: {}'
.
format
(
err_msg
))
try
:
cmds
=
[
'
p
kill'
,
'-P'
,
str
(
rest_process
.
pid
)]
cmds
=
[
'kill'
,
str
(
rest_process
.
pid
)]
call
(
cmds
)
except
Exception
:
raise
Exception
(
ERROR_INFO
%
'Restful server stopped!'
)
...
...
@@ -312,7 +312,7 @@ def launch_experiment(args, experiment_config, mode, config_file_name, experimen
print_error
(
'Start experiment failed!'
)
print_log_content
(
config_file_name
)
try
:
cmds
=
[
'
p
kill'
,
'-P'
,
str
(
rest_process
.
pid
)]
cmds
=
[
'kill'
,
str
(
rest_process
.
pid
)]
call
(
cmds
)
except
Exception
:
raise
Exception
(
ERROR_INFO
%
'Restful server stopped!'
)
...
...
Prev
1
2
Next
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