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
d48ad027
Unverified
Commit
d48ad027
authored
Jun 20, 2019
by
SparkSnail
Committed by
GitHub
Jun 20, 2019
Browse files
Merge pull request #184 from microsoft/master
merge master
parents
9352cc88
22993e5d
Changes
187
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
73 additions
and
74 deletions
+73
-74
examples/trials/network_morphism/cifar10/config.yml
examples/trials/network_morphism/cifar10/config.yml
+1
-1
examples/trials/network_morphism/cifar10/config_pai.yml
examples/trials/network_morphism/cifar10/config_pai.yml
+1
-1
examples/trials/sklearn/classification/main.py
examples/trials/sklearn/classification/main.py
+1
-1
examples/trials/sklearn/regression/main.py
examples/trials/sklearn/regression/main.py
+2
-2
examples/trials/weight_sharing/ga_squad/config_remote.yml
examples/trials/weight_sharing/ga_squad/config_remote.yml
+3
-3
examples/trials/weight_sharing/ga_squad/graph_to_tf.py
examples/trials/weight_sharing/ga_squad/graph_to_tf.py
+1
-1
examples/tuners/ga_customer_tuner/README.md
examples/tuners/ga_customer_tuner/README.md
+2
-2
examples/tuners/weight_sharing/ga_customer_tuner/README.md
examples/tuners/weight_sharing/ga_customer_tuner/README.md
+2
-2
src/nni_manager/common/restServer.ts
src/nni_manager/common/restServer.ts
+5
-5
src/nni_manager/common/trainingService.ts
src/nni_manager/common/trainingService.ts
+1
-2
src/nni_manager/common/utils.ts
src/nni_manager/common/utils.ts
+6
-6
src/nni_manager/config/frameworkcontroller/frameworkcontrollerjob-crd-v1.json
...ig/frameworkcontroller/frameworkcontrollerjob-crd-v1.json
+8
-8
src/nni_manager/config/kubeflow/pytorchjob-crd-v1alpha2.json
src/nni_manager/config/kubeflow/pytorchjob-crd-v1alpha2.json
+8
-8
src/nni_manager/config/kubeflow/pytorchjob-crd-v1beta1.json
src/nni_manager/config/kubeflow/pytorchjob-crd-v1beta1.json
+8
-8
src/nni_manager/config/kubeflow/tfjob-crd-v1alpha2.json
src/nni_manager/config/kubeflow/tfjob-crd-v1alpha2.json
+8
-8
src/nni_manager/config/kubeflow/tfjob-crd-v1beta1.json
src/nni_manager/config/kubeflow/tfjob-crd-v1beta1.json
+8
-8
src/nni_manager/core/nnimanager.ts
src/nni_manager/core/nnimanager.ts
+2
-2
src/nni_manager/core/test/ipcInterface.test.ts
src/nni_manager/core/test/ipcInterface.test.ts
+3
-3
src/nni_manager/core/test/mockedTrainingService.ts
src/nni_manager/core/test/mockedTrainingService.ts
+2
-2
src/nni_manager/core/test/nnimanager.test.ts
src/nni_manager/core/test/nnimanager.test.ts
+1
-1
No files found.
examples/trials/network_morphism/cifar10/config.yml
View file @
d48ad027
...
...
@@ -10,7 +10,7 @@ trainingServicePlatform: local
useAnnotation
:
false
tuner
:
#choice: TPE, Random, Anneal, Evolution, BatchTuner, NetworkMorphism
#SMAC (SMAC should be installed through nnictl)
#SMAC (SMAC should be installed through nnictl)
builtinTunerName
:
NetworkMorphism
classArgs
:
#choice: maximize, minimize
...
...
examples/trials/network_morphism/cifar10/config_pai.yml
View file @
d48ad027
...
...
@@ -9,7 +9,7 @@ trainingServicePlatform: pai
useAnnotation
:
false
tuner
:
#choice: TPE, Random, Anneal, Evolution, BatchTuner, NetworkMorphism
#SMAC (SMAC should be installed through nnictl)
#SMAC (SMAC should be installed through nnictl)
builtinTunerName
:
NetworkMorphism
classArgs
:
#choice: maximize, minimize
...
...
examples/trials/sklearn/classification/main.py
View file @
d48ad027
...
...
@@ -56,7 +56,7 @@ def get_model(PARAMS):
model
.
degree
=
PARAMS
.
get
(
'degree'
)
model
.
gamma
=
PARAMS
.
get
(
'gamma'
)
model
.
coef0
=
PARAMS
.
get
(
'coef0'
)
return
model
def
run
(
X_train
,
X_test
,
y_train
,
y_test
,
PARAMS
):
...
...
examples/trials/sklearn/regression/main.py
View file @
d48ad027
...
...
@@ -63,9 +63,9 @@ def get_model(PARAMS):
if
not
model_dict
.
get
(
PARAMS
[
'model_name'
]):
LOG
.
exception
(
'Not supported model!'
)
exit
(
1
)
model
=
model_dict
[
PARAMS
[
'model_name'
]]
try
:
if
PARAMS
[
'model_name'
]
==
'SVR'
:
model
.
kernel
=
PARAMS
[
'svr_kernel'
]
...
...
examples/trials/weight_sharing/ga_squad/config_remote.yml
View file @
d48ad027
...
...
@@ -10,7 +10,7 @@ useAnnotation: false
multiThread
:
true
tuner
:
codeDir
:
../../../tuners/weight_sharing/ga_customer_tuner
classFileName
:
customer_tuner.py
classFileName
:
customer_tuner.py
className
:
CustomerTuner
classArgs
:
optimize_mode
:
maximize
...
...
@@ -23,9 +23,9 @@ trial:
machineList
:
-
ip
:
remote-ip-0
port
:
8022
username
:
root
username
:
root
passwd
:
screencast
-
ip
:
remote-ip-1
port
:
8022
username
:
root
username
:
root
passwd
:
screencast
examples/trials/weight_sharing/ga_squad/graph_to_tf.py
View file @
d48ad027
...
...
@@ -290,7 +290,7 @@ def graph_to_network(input1,
if
topo_i
==
'|'
:
continue
# Note: here we use the `hash_id` of layer as scope name,
# Note: here we use the `hash_id` of layer as scope name,
# so that we can automatically load sharable weights from previous trained models
with
tf
.
variable_scope
(
p_graph
.
layers
[
topo_i
].
hash_id
,
reuse
=
tf
.
AUTO_REUSE
):
if
p_graph
.
layers
[
topo_i
].
graph_type
==
LayerType
.
input
.
value
:
...
...
examples/tuners/ga_customer_tuner/README.md
View file @
d48ad027
# How to use ga_customer_tuner?
This tuner is a customized tuner which only suitable for trial whose code path is "~/nni/examples/trials/ga_squad",
This tuner is a customized tuner which only suitable for trial whose code path is "~/nni/examples/trials/ga_squad",
type
`cd ~/nni/examples/trials/ga_squad`
and check readme.md to get more information for ga_squad trial.
# config
# config
If you want to use ga_customer_tuner in your experiment, you could set config file as following format:
```
...
...
examples/tuners/weight_sharing/ga_customer_tuner/README.md
View file @
d48ad027
# How to use ga_customer_tuner?
This tuner is a customized tuner which only suitable for trial whose code path is "~/nni/examples/trials/ga_squad",
This tuner is a customized tuner which only suitable for trial whose code path is "~/nni/examples/trials/ga_squad",
type
`cd ~/nni/examples/trials/ga_squad`
and check readme.md to get more information for ga_squad trial.
# config
# config
If you want to use ga_customer_tuner in your experiment, you could set config file as following format:
```
...
...
src/nni_manager/common/restServer.ts
View file @
d48ad027
...
...
@@ -29,7 +29,7 @@ import { getBasePort } from './experimentStartupInfo';
/**
* Abstraction class to create a RestServer
* The module who wants to use a RestServer could <b>extends</b> this abstract class
* The module who wants to use a RestServer could <b>extends</b> this abstract class
* And implement its own registerRestHandler() function to register routers
*/
export
abstract
class
RestServer
{
...
...
@@ -43,7 +43,7 @@ export abstract class RestServer {
protected
app
:
express
.
Application
=
express
();
protected
log
:
Logger
=
getLogger
();
protected
basePort
?:
number
;
constructor
()
{
this
.
port
=
getBasePort
();
assert
(
this
.
port
&&
this
.
port
>
1024
);
...
...
@@ -91,9 +91,9 @@ export abstract class RestServer {
}
else
{
this
.
startTask
.
promise
.
then
(
()
=>
{
// Started
//Stops the server from accepting new connections and keeps existing connections.
//This function is asynchronous, the server is finally closed when all connections
//are ended and the server emits a 'close' event.
//Stops the server from accepting new connections and keeps existing connections.
//This function is asynchronous, the server is finally closed when all connections
//are ended and the server emits a 'close' event.
//Refer https://nodejs.org/docs/latest/api/net.html#net_server_close_callback
this
.
server
.
close
().
on
(
'
close
'
,
()
=>
{
this
.
log
.
info
(
'
Rest server stopped.
'
);
...
...
src/nni_manager/common/trainingService.ts
View file @
d48ad027
...
...
@@ -91,6 +91,7 @@ interface TrialJobMetric {
* define TrainingServiceError
*/
class
TrainingServiceError
extends
Error
{
private
errCode
:
number
;
constructor
(
errorCode
:
number
,
errorMessage
:
string
)
{
...
...
@@ -136,5 +137,3 @@ export {
TrainingServiceMetadata
,
TrialJobDetail
,
TrialJobMetric
,
HyperParameters
,
HostJobApplicationForm
,
JobApplicationForm
,
JobType
,
NNIManagerIpConfig
};
src/nni_manager/common/utils.ts
View file @
d48ad027
...
...
@@ -167,7 +167,7 @@ function getCmdPy(): string {
}
/**
* Generate command line to start automl algorithm(s),
* Generate command line to start automl algorithm(s),
* either start advisor or start a process which runs tuner and assessor
* @param tuner : For builtin tuner:
* {
...
...
@@ -361,11 +361,11 @@ function countFilesRecursively(directory: string, timeoutMilliSeconds?: number):
if
(
process
.
platform
===
"
win32
"
)
{
cmd
=
`powershell "Get-ChildItem -Path
${
directory
}
-Recurse -File | Measure-Object | %{$_.Count}"`
}
else
{
cmd
=
`find
${
directory
}
-type f | wc -l`
;
cmd
=
`find
${
directory
}
-type f | wc -l`
;
}
cpp
.
exec
(
cmd
).
then
((
result
)
=>
{
if
(
result
.
stdout
&&
parseInt
(
result
.
stdout
))
{
fileCount
=
parseInt
(
result
.
stdout
);
fileCount
=
parseInt
(
result
.
stdout
);
}
deferred
.
resolve
(
fileCount
);
});
...
...
@@ -385,7 +385,7 @@ async function getVersion(): Promise<string> {
deferred
.
reject
(
error
);
});
return
deferred
.
promise
;
}
}
/**
* run command as ChildProcess
...
...
@@ -437,7 +437,7 @@ async function isAlive(pid:any): Promise<boolean> {
}
/**
* kill process
* kill process
*/
async
function
killPid
(
pid
:
any
):
Promise
<
void
>
{
let
deferred
:
Deferred
<
void
>
=
new
Deferred
<
void
>
();
...
...
@@ -466,7 +466,7 @@ function getNewLine(): string {
/**
* Use '/' to join path instead of '\' for all kinds of platform
* @param path
* @param path
*/
function
unixPathJoin
(...
paths
:
any
[]):
string
{
const
dir
:
string
=
paths
.
filter
((
path
:
any
)
=>
path
!==
''
).
join
(
'
/
'
);
...
...
src/nni_manager/config/frameworkcontroller/frameworkcontrollerjob-crd-v1.json
View file @
d48ad027
{
"kind"
:
"CustomResourceDefinition"
,
"kind"
:
"CustomResourceDefinition"
,
"spec"
:
{
"scope"
:
"Namespaced"
,
"version"
:
"v1"
,
"group"
:
"frameworkcontroller.microsoft.com"
,
"scope"
:
"Namespaced"
,
"version"
:
"v1"
,
"group"
:
"frameworkcontroller.microsoft.com"
,
"names"
:
{
"kind"
:
"Framework"
,
"plural"
:
"frameworks"
,
"kind"
:
"Framework"
,
"plural"
:
"frameworks"
,
"singular"
:
"framework"
}
},
"apiVersion"
:
"apiextensions.k8s.io/v1beta1"
,
},
"apiVersion"
:
"apiextensions.k8s.io/v1beta1"
,
"metadata"
:
{
"name"
:
"frameworks.frameworkcontroller.microsoft.com"
}
...
...
src/nni_manager/config/kubeflow/pytorchjob-crd-v1alpha2.json
View file @
d48ad027
{
"kind"
:
"CustomResourceDefinition"
,
"kind"
:
"CustomResourceDefinition"
,
"spec"
:
{
"scope"
:
"Namespaced"
,
"version"
:
"v1alpha2"
,
"group"
:
"kubeflow.org"
,
"scope"
:
"Namespaced"
,
"version"
:
"v1alpha2"
,
"group"
:
"kubeflow.org"
,
"names"
:
{
"kind"
:
"PyTorchJob"
,
"plural"
:
"pytorchjobs"
,
"kind"
:
"PyTorchJob"
,
"plural"
:
"pytorchjobs"
,
"singular"
:
"pytorchjob"
}
},
"apiVersion"
:
"apiextensions.k8s.io/v1beta1"
,
},
"apiVersion"
:
"apiextensions.k8s.io/v1beta1"
,
"metadata"
:
{
"name"
:
"pytorchjobs.kubeflow.org"
}
...
...
src/nni_manager/config/kubeflow/pytorchjob-crd-v1beta1.json
View file @
d48ad027
{
"kind"
:
"CustomResourceDefinition"
,
"kind"
:
"CustomResourceDefinition"
,
"spec"
:
{
"scope"
:
"Namespaced"
,
"version"
:
"v1beta1"
,
"group"
:
"kubeflow.org"
,
"scope"
:
"Namespaced"
,
"version"
:
"v1beta1"
,
"group"
:
"kubeflow.org"
,
"names"
:
{
"kind"
:
"PyTorchJob"
,
"plural"
:
"pytorchjobs"
,
"kind"
:
"PyTorchJob"
,
"plural"
:
"pytorchjobs"
,
"singular"
:
"pytorchjob"
}
},
"apiVersion"
:
"apiextensions.k8s.io/v1beta1"
,
},
"apiVersion"
:
"apiextensions.k8s.io/v1beta1"
,
"metadata"
:
{
"name"
:
"pytorchjobs.kubeflow.org"
}
...
...
src/nni_manager/config/kubeflow/tfjob-crd-v1alpha2.json
View file @
d48ad027
{
"kind"
:
"CustomResourceDefinition"
,
"kind"
:
"CustomResourceDefinition"
,
"spec"
:
{
"scope"
:
"Namespaced"
,
"version"
:
"v1alpha2"
,
"group"
:
"kubeflow.org"
,
"scope"
:
"Namespaced"
,
"version"
:
"v1alpha2"
,
"group"
:
"kubeflow.org"
,
"names"
:
{
"kind"
:
"TFJob"
,
"plural"
:
"tfjobs"
,
"kind"
:
"TFJob"
,
"plural"
:
"tfjobs"
,
"singular"
:
"tfjob"
}
},
"apiVersion"
:
"apiextensions.k8s.io/v1beta1"
,
},
"apiVersion"
:
"apiextensions.k8s.io/v1beta1"
,
"metadata"
:
{
"name"
:
"tfjobs.kubeflow.org"
}
...
...
src/nni_manager/config/kubeflow/tfjob-crd-v1beta1.json
View file @
d48ad027
{
"kind"
:
"CustomResourceDefinition"
,
"kind"
:
"CustomResourceDefinition"
,
"spec"
:
{
"scope"
:
"Namespaced"
,
"version"
:
"v1beta1"
,
"group"
:
"kubeflow.org"
,
"scope"
:
"Namespaced"
,
"version"
:
"v1beta1"
,
"group"
:
"kubeflow.org"
,
"names"
:
{
"kind"
:
"TFJob"
,
"plural"
:
"tfjobs"
,
"kind"
:
"TFJob"
,
"plural"
:
"tfjobs"
,
"singular"
:
"tfjob"
}
},
"apiVersion"
:
"apiextensions.k8s.io/v1beta1"
,
},
"apiVersion"
:
"apiextensions.k8s.io/v1beta1"
,
"metadata"
:
{
"name"
:
"tfjobs.kubeflow.org"
}
...
...
src/nni_manager/core/nnimanager.ts
View file @
d48ad027
...
...
@@ -159,7 +159,7 @@ class NNIManager implements Manager {
if
(
expParams
.
logCollection
!==
undefined
)
{
this
.
trainingService
.
setClusterMetadata
(
'
log_collection
'
,
expParams
.
logCollection
.
toString
());
}
const
dispatcherCommand
:
string
=
getMsgDispatcherCommand
(
expParams
.
tuner
,
expParams
.
assessor
,
expParams
.
advisor
,
expParams
.
multiPhase
,
expParams
.
multiThread
);
this
.
log
.
debug
(
`dispatcher command:
${
dispatcherCommand
}
`
);
...
...
@@ -493,7 +493,7 @@ class NNIManager implements Manager {
// If trialConcurrency does not change, requestTrialNum equals finishedTrialJobNum.
// If trialConcurrency changes, for example, trialConcurrency increases by 2 (trialConcurrencyChange=2), then
// requestTrialNum equals 2 + finishedTrialJobNum and trialConcurrencyChange becomes 0.
// If trialConcurrency changes, for example, trialConcurrency decreases by 4 (trialConcurrencyChange=-4) and
// If trialConcurrency changes, for example, trialConcurrency decreases by 4 (trialConcurrencyChange=-4) and
// finishedTrialJobNum is 2, then requestTrialNum becomes -2. No trial will be requested from tuner,
// and trialConcurrencyChange becomes -2.
const
requestTrialNum
:
number
=
this
.
trialConcurrencyChange
+
finishedTrialJobNum
;
...
...
src/nni_manager/core/test/ipcInterface.test.ts
View file @
d48ad027
...
...
@@ -46,11 +46,11 @@ function runProcess(): Promise<Error | null> {
if
(
code
!==
0
)
{
deferred
.
resolve
(
new
Error
(
`return code:
${
code
}
`
));
}
else
{
let
str
=
proc
.
stdout
.
read
().
toString
();
let
str
=
proc
.
stdout
.
read
().
toString
();
if
(
str
.
search
(
"
\r\n
"
)
!=-
1
){
sentCommands
=
str
.
split
(
"
\r\n
"
);
}
else
{
else
{
sentCommands
=
str
.
split
(
'
\n
'
);
}
deferred
.
resolve
(
null
);
...
...
@@ -76,7 +76,7 @@ function runProcess(): Promise<Error | null> {
commandTooLong
=
error
;
}
// Command #4: FE is not tuner/assessor command, test the exception type of send non-valid command
// Command #4: FE is not tuner/assessor command, test the exception type of send non-valid command
try
{
dispatcher
.
sendCommand
(
'
FE
'
,
'
1
'
);
}
catch
(
error
)
{
...
...
src/nni_manager/core/test/mockedTrainingService.ts
View file @
d48ad027
...
...
@@ -59,10 +59,10 @@ class MockedTrainingService extends TrainingService {
},
sequenceId
:
0
};
public
listTrialJobs
():
Promise
<
TrialJobDetail
[]
>
{
const
deferred
=
new
Deferred
<
TrialJobDetail
[]
>
();
deferred
.
resolve
([
this
.
jobDetail1
,
this
.
jobDetail2
]);
return
deferred
.
promise
;
}
...
...
src/nni_manager/core/test/nnimanager.test.ts
View file @
d48ad027
...
...
@@ -104,7 +104,7 @@ describe('Unit test for nnimanager', function () {
maxSequenceId
:
0
,
revision
:
0
}
before
(
async
()
=>
{
await
initContainer
();
...
...
Prev
1
2
3
4
5
6
7
8
…
10
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