From 95a8f93e025b5c7d896732c98fb47d91358495b3 Mon Sep 17 00:00:00 2001 From: gongwuji Date: Tue, 13 Nov 2018 10:07:37 +0800 Subject: [PATCH] update local demo doc and configuration (#344) * update local demo doc and configuration * change folder name * Update tutorial_1_CR_exp_local_api.md no need to have a new training file * Delete mnist_gpu.py no need to have a new training file * Update config_gpu.yml no need to have a new training file --- docs/tutorial_1_CR_exp_local_api.md | 29 +++++++++++++++++-- .../README.md} | 0 .../config.yml | 0 .../config_pai.yml | 0 .../main.py | 0 .../models/__init__.py | 0 .../models/densenet.py | 0 .../models/dpn.py | 0 .../models/googlenet.py | 0 .../models/lenet.py | 0 .../models/mobilenet.py | 0 .../models/mobilenetv2.py | 0 .../models/pnasnet.py | 0 .../models/preact_resnet.py | 0 .../models/resnet.py | 0 .../models/resnext.py | 0 .../models/senet.py | 0 .../models/shufflenet.py | 0 .../models/vgg.py | 0 .../search_space.json | 0 .../utils.py | 0 .../trials/mnist-annotation/config_gpu.yml | 20 +++++++++++++ 22 files changed, 47 insertions(+), 2 deletions(-) rename examples/trials/{pytorch_cifar10/requirement.txt => cifar10_pytorch/README.md} (100%) rename examples/trials/{pytorch_cifar10 => cifar10_pytorch}/config.yml (100%) rename examples/trials/{pytorch_cifar10 => cifar10_pytorch}/config_pai.yml (100%) rename examples/trials/{pytorch_cifar10 => cifar10_pytorch}/main.py (100%) rename examples/trials/{pytorch_cifar10 => cifar10_pytorch}/models/__init__.py (100%) rename examples/trials/{pytorch_cifar10 => cifar10_pytorch}/models/densenet.py (100%) rename examples/trials/{pytorch_cifar10 => cifar10_pytorch}/models/dpn.py (100%) rename examples/trials/{pytorch_cifar10 => cifar10_pytorch}/models/googlenet.py (100%) rename examples/trials/{pytorch_cifar10 => cifar10_pytorch}/models/lenet.py (100%) rename examples/trials/{pytorch_cifar10 => cifar10_pytorch}/models/mobilenet.py (100%) rename examples/trials/{pytorch_cifar10 => cifar10_pytorch}/models/mobilenetv2.py (100%) rename examples/trials/{pytorch_cifar10 => cifar10_pytorch}/models/pnasnet.py (100%) rename examples/trials/{pytorch_cifar10 => cifar10_pytorch}/models/preact_resnet.py (100%) rename examples/trials/{pytorch_cifar10 => cifar10_pytorch}/models/resnet.py (100%) rename examples/trials/{pytorch_cifar10 => cifar10_pytorch}/models/resnext.py (100%) rename examples/trials/{pytorch_cifar10 => cifar10_pytorch}/models/senet.py (100%) rename examples/trials/{pytorch_cifar10 => cifar10_pytorch}/models/shufflenet.py (100%) rename examples/trials/{pytorch_cifar10 => cifar10_pytorch}/models/vgg.py (100%) rename examples/trials/{pytorch_cifar10 => cifar10_pytorch}/search_space.json (100%) rename examples/trials/{pytorch_cifar10 => cifar10_pytorch}/utils.py (100%) create mode 100644 examples/trials/mnist-annotation/config_gpu.yml diff --git a/docs/tutorial_1_CR_exp_local_api.md b/docs/tutorial_1_CR_exp_local_api.md index 9d78755c8d..6ce851e23b 100644 --- a/docs/tutorial_1_CR_exp_local_api.md +++ b/docs/tutorial_1_CR_exp_local_api.md @@ -101,7 +101,7 @@ authorName: your_name experimentName: auto_mnist # how many trials could be concurrently running -trialConcurrency: 2 +trialConcurrency: 1 # maximum experiment running duration maxExecDuration: 3h @@ -133,4 +133,29 @@ With all these steps done, we can run the experiment with the following command: You can refer to [here](NNICTLDOC.md) for more usage guide of *nnictl* command line tool. ## View experiment results -The experiment has been running now, NNI provides WebUI for you to view experiment progress, to control your experiment, and some other appealing features. The WebUI is opened by default by `nnictl create`. \ No newline at end of file +The experiment has been running now. Oher than *nnictl*, NNI also provides WebUI for you to view experiment progress, to control your experiment, and some other appealing features. + +## Using multiple local GPUs to speed up search +The following steps assume that you have 4 NVIDIA GPUs installed at local and [tensorflow with GPU support](https://www.tensorflow.org/install/gpu). The demo enables 4 concurrent trail jobs and each trail job uses 1 GPU. + +**Prepare configure file**: NNI provides a demo configuration file for the setting above, `cat ~/nni/examples/trials/mnist-annotation/config_gpu.yml` to see it. The trailConcurrency and gpuNum are different from the basic configure file: + +``` +... + +# how many trials could be concurrently running +trialConcurrency: 4 + +... + +trial: + command: python mnist.py + codeDir: ~/nni/examples/trials/mnist-annotation + gpuNum: 1 +``` + +We can run the experiment with the following command: + + nnictl create --config ~/nni/examples/trials/mnist-annotation/config_gpu.yml + +You can use *nnictl* command line tool or WebUI to trace the training progress. *nvidia_smi* command line tool can also help you to monitor the GPU usage during training. diff --git a/examples/trials/pytorch_cifar10/requirement.txt b/examples/trials/cifar10_pytorch/README.md similarity index 100% rename from examples/trials/pytorch_cifar10/requirement.txt rename to examples/trials/cifar10_pytorch/README.md diff --git a/examples/trials/pytorch_cifar10/config.yml b/examples/trials/cifar10_pytorch/config.yml similarity index 100% rename from examples/trials/pytorch_cifar10/config.yml rename to examples/trials/cifar10_pytorch/config.yml diff --git a/examples/trials/pytorch_cifar10/config_pai.yml b/examples/trials/cifar10_pytorch/config_pai.yml similarity index 100% rename from examples/trials/pytorch_cifar10/config_pai.yml rename to examples/trials/cifar10_pytorch/config_pai.yml diff --git a/examples/trials/pytorch_cifar10/main.py b/examples/trials/cifar10_pytorch/main.py similarity index 100% rename from examples/trials/pytorch_cifar10/main.py rename to examples/trials/cifar10_pytorch/main.py diff --git a/examples/trials/pytorch_cifar10/models/__init__.py b/examples/trials/cifar10_pytorch/models/__init__.py similarity index 100% rename from examples/trials/pytorch_cifar10/models/__init__.py rename to examples/trials/cifar10_pytorch/models/__init__.py diff --git a/examples/trials/pytorch_cifar10/models/densenet.py b/examples/trials/cifar10_pytorch/models/densenet.py similarity index 100% rename from examples/trials/pytorch_cifar10/models/densenet.py rename to examples/trials/cifar10_pytorch/models/densenet.py diff --git a/examples/trials/pytorch_cifar10/models/dpn.py b/examples/trials/cifar10_pytorch/models/dpn.py similarity index 100% rename from examples/trials/pytorch_cifar10/models/dpn.py rename to examples/trials/cifar10_pytorch/models/dpn.py diff --git a/examples/trials/pytorch_cifar10/models/googlenet.py b/examples/trials/cifar10_pytorch/models/googlenet.py similarity index 100% rename from examples/trials/pytorch_cifar10/models/googlenet.py rename to examples/trials/cifar10_pytorch/models/googlenet.py diff --git a/examples/trials/pytorch_cifar10/models/lenet.py b/examples/trials/cifar10_pytorch/models/lenet.py similarity index 100% rename from examples/trials/pytorch_cifar10/models/lenet.py rename to examples/trials/cifar10_pytorch/models/lenet.py diff --git a/examples/trials/pytorch_cifar10/models/mobilenet.py b/examples/trials/cifar10_pytorch/models/mobilenet.py similarity index 100% rename from examples/trials/pytorch_cifar10/models/mobilenet.py rename to examples/trials/cifar10_pytorch/models/mobilenet.py diff --git a/examples/trials/pytorch_cifar10/models/mobilenetv2.py b/examples/trials/cifar10_pytorch/models/mobilenetv2.py similarity index 100% rename from examples/trials/pytorch_cifar10/models/mobilenetv2.py rename to examples/trials/cifar10_pytorch/models/mobilenetv2.py diff --git a/examples/trials/pytorch_cifar10/models/pnasnet.py b/examples/trials/cifar10_pytorch/models/pnasnet.py similarity index 100% rename from examples/trials/pytorch_cifar10/models/pnasnet.py rename to examples/trials/cifar10_pytorch/models/pnasnet.py diff --git a/examples/trials/pytorch_cifar10/models/preact_resnet.py b/examples/trials/cifar10_pytorch/models/preact_resnet.py similarity index 100% rename from examples/trials/pytorch_cifar10/models/preact_resnet.py rename to examples/trials/cifar10_pytorch/models/preact_resnet.py diff --git a/examples/trials/pytorch_cifar10/models/resnet.py b/examples/trials/cifar10_pytorch/models/resnet.py similarity index 100% rename from examples/trials/pytorch_cifar10/models/resnet.py rename to examples/trials/cifar10_pytorch/models/resnet.py diff --git a/examples/trials/pytorch_cifar10/models/resnext.py b/examples/trials/cifar10_pytorch/models/resnext.py similarity index 100% rename from examples/trials/pytorch_cifar10/models/resnext.py rename to examples/trials/cifar10_pytorch/models/resnext.py diff --git a/examples/trials/pytorch_cifar10/models/senet.py b/examples/trials/cifar10_pytorch/models/senet.py similarity index 100% rename from examples/trials/pytorch_cifar10/models/senet.py rename to examples/trials/cifar10_pytorch/models/senet.py diff --git a/examples/trials/pytorch_cifar10/models/shufflenet.py b/examples/trials/cifar10_pytorch/models/shufflenet.py similarity index 100% rename from examples/trials/pytorch_cifar10/models/shufflenet.py rename to examples/trials/cifar10_pytorch/models/shufflenet.py diff --git a/examples/trials/pytorch_cifar10/models/vgg.py b/examples/trials/cifar10_pytorch/models/vgg.py similarity index 100% rename from examples/trials/pytorch_cifar10/models/vgg.py rename to examples/trials/cifar10_pytorch/models/vgg.py diff --git a/examples/trials/pytorch_cifar10/search_space.json b/examples/trials/cifar10_pytorch/search_space.json similarity index 100% rename from examples/trials/pytorch_cifar10/search_space.json rename to examples/trials/cifar10_pytorch/search_space.json diff --git a/examples/trials/pytorch_cifar10/utils.py b/examples/trials/cifar10_pytorch/utils.py similarity index 100% rename from examples/trials/pytorch_cifar10/utils.py rename to examples/trials/cifar10_pytorch/utils.py diff --git a/examples/trials/mnist-annotation/config_gpu.yml b/examples/trials/mnist-annotation/config_gpu.yml new file mode 100644 index 0000000000..e926aab534 --- /dev/null +++ b/examples/trials/mnist-annotation/config_gpu.yml @@ -0,0 +1,20 @@ +authorName: default +experimentName: example_mnist +trialConcurrency: 4 +maxExecDuration: 1h +maxTrialNum: 10 +#choice: local, remote, pai +trainingServicePlatform: local +#choice: true, false +useAnnotation: true +tuner: + #choice: TPE, Random, Anneal, Evolution, BatchTuner + #SMAC (SMAC should be installed through nnictl) + builtinTunerName: TPE + classArgs: + #choice: maximize, minimize + optimize_mode: maximize +trial: + command: python3 mnist.py + codeDir: . + gpuNum: 1