Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge master #61

Merged
merged 8 commits into from
Nov 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Note: If you are in docker container (as root), please remove `--user` from the
* 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.3 https://github.com/Microsoft/nni.git
git clone -b v0.3.4 https://github.com/Microsoft/nni.git
cd nni
source install.sh
```
Expand All @@ -47,7 +47,7 @@ Note: If you are in docker container (as root), please remove `--user` from the
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
git clone -b v0.3.3 https://github.com/Microsoft/nni.git
git clone -b v0.3.4 https://github.com/Microsoft/nni.git
```
* Run the mnist example.
```bash
Expand Down
6 changes: 3 additions & 3 deletions deployment/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

FROM nvidia/cuda:9.0-cudnn7-devel-ubuntu16.04
FROM nvidia/cuda:9.0-cudnn7-runtime-ubuntu16.04

LABEL maintainer='Microsoft NNI Team<[email protected]>'

Expand Down Expand Up @@ -53,7 +53,7 @@ RUN python3 -m pip --no-cache-dir install \
#
#Install NNI
#
RUN python3 -m pip install --user nni
RUN python3 -m pip install nni

#
#Tensorflow 1.10.0
Expand All @@ -68,6 +68,6 @@ RUN python3 -m pip --no-cache-dir install Keras==2.1.6
#sklearn
RUN python3 -m pip --no-cache-dir install scikit-learn

ENV PATH=/usr/local/nvidia/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/root/.local/bin:/usr/bin:
ENV PATH=/usr/local/nvidia/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/root/.local/bin:/usr/bin:/bin:/sbin

WORKDIR /root
5 changes: 3 additions & 2 deletions deployment/pypi/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

setuptools.setup(
name = 'nni',
version = '0.3.2',
version = '0.3.4',
author = 'Microsoft NNI team',
author_email = '[email protected]',
description = 'Neural Network Intelligence package',
Expand All @@ -32,7 +32,8 @@
'pyyaml',
'psutil',
'requests',
'astor'
'astor',
'pyhdfs'
],
classifiers = [
'Programming Language :: Python :: 3',
Expand Down
2 changes: 1 addition & 1 deletion docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ When raising issues, please specify the following:

Provide PRs with appropriate tags for bug fixes or enhancements to the source code. Do follow the correct naming conventions and code styles when you work on and do try to implement all code reviews along the way.

If you are looking for How to go about contributing and debugging the NNI source code, you can refer our [How to Contribute](./HowToContribute.md) file in the `docs` folder.
If you are looking for How to develop and debug the NNI source code, you can refer to [How to set up NNI developer environment doc](./SetupNNIDeveloperEnvironment.md) file in the `docs` folder.

Similarly for [writing trials](./WriteYourTrial.md) or [starting experiments](StartExperiment.md). For everything else, refer [here](https://github.com/Microsoft/nni/tree/master/docs).

Expand Down
2 changes: 1 addition & 1 deletion docs/GetStarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

* __Install NNI through source code__

git clone -b v0.3.3 https://github.com/Microsoft/nni.git
git clone -b v0.3.4 https://github.com/Microsoft/nni.git
cd nni
source install.sh

Expand Down
2 changes: 1 addition & 1 deletion docs/InstallNNI_Ubuntu.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

* __Install NNI through source code__

git clone -b v0.3.3 https://github.com/Microsoft/nni.git
git clone -b v0.3.4 https://github.com/Microsoft/nni.git
cd nni
source install.sh

Expand Down
18 changes: 18 additions & 0 deletions docs/NNICTLDOC.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ nnictl experiment
nnictl config
nnictl log
nnictl webui
nnictl tensorboard
```
### Manage an experiment
* __nnictl create__
Expand Down Expand Up @@ -122,6 +123,23 @@ nnictl webui
| ------ | ------ | ------ |------ |
| id| False| |ID of the experiment you want to set|
| --value, -v| True| |the experiment duration will be NUMBER seconds. SUFFIX may be 's' for seconds (the default), 'm' for minutes, 'h' for hours or 'd' for days.|

* __nnictl update trialnum__
* Description

You can use this command to update an experiment's maxtrialnum.

* Usage

nnictl update trialnum [OPTIONS]

Options:

| Name, shorthand | Required|Default | Description |
| ------ | ------ | ------ |------ |
| id| False| |ID of the experiment you want to set|
| --value, -v| True| |the new number of maxtrialnum you want to set|



* __nnictl trial__
Expand Down
2 changes: 1 addition & 1 deletion docs/SetupNNIDeveloperEnvironment.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ And open WebUI to check if everything is OK

**6. Redeploy**

After you change some code, just use **step 4** to rebuild your code, then the change will take effect immediately
After the code changes, use **step 3** to rebuild your codes, then the changes will take effect immediately.

---
At last, wish you have a wonderful day.
Expand Down
19 changes: 10 additions & 9 deletions examples/trials/mnist-annotation/mnist.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ def main(params):
'''
# Import data
mnist = input_data.read_data_sets(params['data_dir'], one_hot=True)
print('Mnist download data down.')
logger.debug('Mnist download data down.')
print('Mnist download data done.')
logger.debug('Mnist download data done.')

# Create the model
# Build the graph for the deep net
Expand All @@ -180,15 +180,15 @@ def main(params):
test_acc = 0.0
with tf.Session() as sess:
sess.run(tf.global_variables_initializer())
"""@nni.variable(nni.choice(50, 250, 500), name=batch_num)"""
batch_num = params['batch_num']
for i in range(batch_num):
batch = mnist.train.next_batch(batch_num)
"""@nni.variable(nni.choice(1, 5), name=dropout_rate)"""
"""@nni.variable(nni.choice(1, 4, 8, 16, 32), name=batch_size)"""
batch_size = params['batch_size']
for i in range(params['batch_num']):
batch = mnist.train.next_batch(batch_size)
"""@nni.variable(nni.choice(0.5, 0.9), name=dropout_rate)"""
dropout_rate = params['dropout_rate']
mnist_network.train_step.run(feed_dict={mnist_network.images: batch[0],
mnist_network.labels: batch[1],
mnist_network.keep_prob: dropout_rate}
mnist_network.keep_prob: 1 - dropout_rate}
)

if i % 100 == 0:
Expand Down Expand Up @@ -224,7 +224,8 @@ def generate_defualt_params():
'pool_size': 2,
'hidden_size': 1024,
'learning_rate': 1e-4,
'batch_num': 200}
'batch_num': 2000,
'batch_size': 32}
return params


Expand Down
11 changes: 6 additions & 5 deletions examples/trials/mnist-smartparam/mnist.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,13 @@ def main(params):
test_acc = 0.0
with tf.Session() as sess:
sess.run(tf.global_variables_initializer())
batch_num = nni.choice(50, 250, 500, name='batch_num')
for i in range(batch_num):
batch = mnist.train.next_batch(batch_num)
dropout_rate = nni.choice(1, 5, name='dropout_rate')
batch_size = nni.choice(1, 4, 8, 16, 32, name='batch_size')
for i in range(2000):
batch = mnist.train.next_batch(batch_size)
dropout_rate = nni.choice(0.5, 0.9, name='dropout_rate')
mnist_network.train_step.run(feed_dict={mnist_network.images: batch[0],
mnist_network.labels: batch[1],
mnist_network.keep_prob: dropout_rate}
mnist_network.keep_prob: 1 - dropout_rate}
)

if i % 100 == 0:
Expand Down Expand Up @@ -223,6 +223,7 @@ def generate_defualt_params():

if __name__ == '__main__':
try:
nni.get_next_parameter()
main(generate_defualt_params())
except Exception as exception:
logger.exception(exception)
Expand Down
6 changes: 3 additions & 3 deletions examples/trials/mnist/config_assessor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ authorName: default
experimentName: example_mnist
trialConcurrency: 1
maxExecDuration: 1h
maxTrialNum: 1
maxTrialNum: 20
#choice: local, remote
trainingServicePlatform: local
searchSpacePath: ~/nni/examples/trials/mnist/search_space.json
searchSpacePath: search_space.json
#choice: true, false
useAnnotation: false
tuner:
Expand All @@ -23,5 +23,5 @@ assessor:
optimize_mode: maximize
trial:
command: python3 mnist.py
codeDir: ~/nni/examples/trials/mnist
codeDir: .
gpuNum: 0
7 changes: 4 additions & 3 deletions examples/trials/mnist/mnist.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,10 @@ def main(params):
with tf.Session() as sess:
sess.run(tf.global_variables_initializer())
for i in range(params['batch_num']):
batch = mnist.train.next_batch(params['batch_num'])
batch = mnist.train.next_batch(params['batch_size'])
mnist_network.train_step.run(feed_dict={mnist_network.images: batch[0],
mnist_network.labels: batch[1],
mnist_network.keep_prob: params['dropout_rate']}
mnist_network.keep_prob: 1 - params['dropout_rate']}
)

if i % 100 == 0:
Expand Down Expand Up @@ -212,7 +212,8 @@ def generate_default_params():
'pool_size': 2,
'hidden_size': 1024,
'learning_rate': 1e-4,
'batch_num': 200}
'batch_num': 2000,
'batch_size': 32}
return params


Expand Down
3 changes: 2 additions & 1 deletion examples/trials/mnist/search_space.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"dropout_rate":{"_type":"uniform","_value":[0.1,0.5]},
"dropout_rate":{"_type":"uniform","_value":[0.5, 0.9]},
"conv_size":{"_type":"choice","_value":[2,3,5,7]},
"hidden_size":{"_type":"choice","_value":[124, 512, 1024]},
"batch_size": {"_type":"choice", "_value": [1, 4, 8, 16, 32]},
"learning_rate":{"_type":"choice","_value":[0.0001, 0.001, 0.01, 0.1]}
}
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def run(self):

setup(
name = 'nni',
version = '0.3.2',
version = '0.3.4',
author = 'Microsoft NNI Team',
author_email = '[email protected]',
description = 'Neural Network Intelligence project',
Expand Down
4 changes: 3 additions & 1 deletion src/nni_manager/rest_server/restValidationSchemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ export namespace ValidationSchemas {
params: joi.object(STARTEXPERIMENT.body).required(),
execDuration: joi.number().required(),
startTime: joi.number(),
endTime: joi.number()
endTime: joi.number(),
logDir: joi.string(),
maxSequenceId: joi.number()
}
};
export const STARTTENSORBOARD = {
Expand Down
14 changes: 7 additions & 7 deletions src/nni_manager/training_service/local/localTrainingService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class LocalTrialJobDetail implements TrialJobDetail {
public pid?: number;

constructor(id: string, status: TrialJobStatus, submitTime: number,
workingDirectory: string, form: JobApplicationForm, sequenceId: number) {
workingDirectory: string, form: JobApplicationForm, sequenceId: number) {
this.id = id;
this.status = status;
this.submitTime = submitTime;
Expand Down Expand Up @@ -283,21 +283,21 @@ class LocalTrainingService implements TrainingService {
public getClusterMetadata(key: string): Promise<string> {
switch (key) {
case TrialConfigMetadataKey.TRIAL_CONFIG:
let getResult : Promise<string>;
if(!this.localTrailConfig) {
let getResult: Promise<string>;
if (!this.localTrailConfig) {
getResult = Promise.reject(new NNIError(NNIErrorNames.NOT_FOUND, `${key} is never set yet`));
} else {
getResult = Promise.resolve(!this.localTrailConfig? '' : JSON.stringify(this.localTrailConfig));
getResult = Promise.resolve(!this.localTrailConfig ? '' : JSON.stringify(this.localTrailConfig));
}
return getResult;
return getResult;
default:
return Promise.reject(new NNIError(NNIErrorNames.NOT_FOUND, 'Key not found'));
}
}

public cleanUp(): Promise<void> {
this.stopping = true;
for(const stream of this.streams) {
for (const stream of this.streams) {
stream.destroy();
}
return Promise.resolve();
Expand Down Expand Up @@ -359,7 +359,7 @@ class LocalTrainingService implements TrainingService {
await cpp.exec(`mkdir -p ${trialJobDetail.workingDirectory}`);
await cpp.exec(`mkdir -p ${path.join(trialJobDetail.workingDirectory, '.nni')}`);
await cpp.exec(`touch ${path.join(trialJobDetail.workingDirectory, '.nni', 'metrics')}`);
await fs.promises.writeFile(path.join(trialJobDetail.workingDirectory, 'run.sh'), runScriptLines.join('\n'), { encoding: 'utf8' });
await fs.promises.writeFile(path.join(trialJobDetail.workingDirectory, 'run.sh'), runScriptLines.join('\n'), { encoding: 'utf8', mode: 0o777 });
await this.writeParameterFile(trialJobDetail.workingDirectory, (<TrialJobApplicationForm>trialJobDetail.form).hyperParameters);
await this.writeSequenceIdFile(trialJobId);
const process: cp.ChildProcess = cp.exec(`bash ${path.join(trialJobDetail.workingDirectory, 'run.sh')}`);
Expand Down
1 change: 1 addition & 0 deletions src/sdk/pynni/nni/trial.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def get_next_parameter():
return _params['parameters']

def get_current_parameter(tag):
global _params
if _params is None:
return None
return _params['parameters'][tag]
Expand Down
Loading