Unverified Commit 871f031d authored by Guoxin's avatar Guoxin Committed by GitHub
Browse files

Merge pull request #1520 from suiguoxin/v1.0-conf-resolve

merge v1.0 back to master (conflicts resolved)
parents 8f71479e b75a2914
......@@ -18,7 +18,7 @@ NNI (Neural Network Intelligence) is a toolkit to help users run automated machi
The tool dispatches and runs trial jobs generated by tuning algorithms to search the best neural architecture and/or hyper-parameters in different environments like local machine, remote servers and cloud.
### **NNI [v0.9](https://github.com/Microsoft/nni/releases) has been released! &nbsp;<a href="#nni-released-reminder"><img width="48" src="docs/img/release_icon.png"></a>**
### **NNI [v1.0](https://github.com/Microsoft/nni/releases) has been released! &nbsp;<a href="#nni-released-reminder"><img width="48" src="docs/img/release_icon.png"></a>**
<p align="center">
<a href="#nni-has-been-released"><img src="docs/img/overview.svg" /></a>
......@@ -100,7 +100,7 @@ The tool dispatches and runs trial jobs generated by tuning algorithms to search
<li><a href="docs/en_US/Tuner/BuiltinTuner.md#BOHB">BOHB</a></li>
<li><a href="docs/en_US/Tuner/BuiltinTuner.md#GPTuner">GP Tuner</a></li>
</ul>
<li><b>Tuner for <a href="docs/en_US/CommunitySharings/NasComparision.md">NAS</a></b></li>
<li><b>Tuner for <a href="docs/en_US/AdvancedFeature/GeneralNasInterfaces.md">NAS</a></b></li>
<ul>
<li><a href="docs/en_US/Tuner/BuiltinTuner.md#NetworkMorphism">Network Morphism</a></li>
<li><a href="examples/tuners/enas_nni/README.md">ENAS</a></li>
......@@ -211,7 +211,7 @@ Linux and MacOS
* Run the following commands in an environment that has `python >= 3.5`, `git` and `wget`.
```bash
git clone -b v0.9 https://github.com/Microsoft/nni.git
git clone -b v1.0 https://github.com/Microsoft/nni.git
cd nni
source install.sh
```
......@@ -221,7 +221,7 @@ Windows
* Run the following commands in an environment that has `python >=3.5`, `git` and `PowerShell`
```bash
git clone -b v0.9 https://github.com/Microsoft/nni.git
git clone -b v1.0 https://github.com/Microsoft/nni.git
cd nni
powershell -ExecutionPolicy Bypass -file install.ps1
```
......@@ -237,7 +237,7 @@ The following example is an experiment built on TensorFlow. Make sure you have *
* Download the examples via clone the source code.
```bash
git clone -b v0.9 https://github.com/Microsoft/nni.git
git clone -b v1.0 https://github.com/Microsoft/nni.git
```
Linux and MacOS
......@@ -345,11 +345,14 @@ Before providing your hacks, you can review the [Contributing Instruction](docs/
* [Implement customized TrainingService](docs/en_US/TrainingService/HowToImplementTrainingService.md)
## **External Repositories**
Now we have some external usage examples run in NNI from our contributors. Thanks our lovely contributors. And welcome more and more people to join us!
* Run [ENAS](examples/tuners/enas_nni/README.md) in NNI
* Run [Neural Network Architecture Search](examples/trials/nas_cifar10/README.md) in NNI
* [Automatic Feature Engineering](examples/trials/auto-feature-engineering/README.md) in NNI
## **External Repositories and References**
With authors' permission, we listed a set of NNI usage examples and relevant articles.
* **Repo** - Run [ENAS](examples/tuners/enas_nni/README.md) with NNI
* **Repo** - Run [Neural Network Architecture Search](examples/trials/nas_cifar10/README.md) with NNI
* **Repo** - [Automatic Feature Engineering](examples/trials/auto-feature-engineering/README.md) with NNI
* **Repo** - [Hyperparameter Tuning for Matrix Factorization](https://github.com/microsoft/recommenders/blob/master/notebooks/04_model_select_and_optimize/nni_surprise_svd.ipynb) with NNI
* **Blog (in Chinese)** - AutoML tools (Advisor, NNI and Google Vizier) comparison by [@gaocegege]( https://github.com/gaocegege ) - [总结与分析 section of design and implementation of kubeflow/katib](http://gaocegege.com/Blog/%E6%9C%BA%E5%99%A8%E5%AD%A6%E4%B9%A0/katib-new#%E6%80%BB%E7%BB%93%E4%B8%8E%E5%88%86%E6%9E%90)
## **Feedback**
* Discuss on the NNI [Gitter](https://gitter.im/Microsoft/nni?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) in NNI
......
......@@ -10,7 +10,7 @@
NNI (Neural Network Intelligence) 是自动机器学习(AutoML)的工具包。 它通过多种调优的算法来搜索最好的神经网络结构和(或)超参,并支持单机、本地多机、云等不同的运行环境。
### **NNI [v0.9](https://github.com/Microsoft/nni/releases) 已发布! &nbsp;[<img width="48" src="docs/img/release_icon.png" />](#nni-released-reminder)**
### **NNI [v1.0](https://github.com/Microsoft/nni/releases) 已发布! &nbsp;[<img width="48" src="docs/img/release_icon.png" />](#nni-released-reminder)**
<p align="center">
<a href="#nni-has-been-released"><img src="docs/img/overview.svg" /></a>
......@@ -19,8 +19,10 @@ NNI (Neural Network Intelligence) 是自动机器学习(AutoML)的工具包
<table>
<tbody>
<tr align="center" valign="bottom">
<td>
</td>
<td>
<b>支持的框架</b>
<b>框架和库</b>
<img src="docs/img/bar.png"/>
</td>
<td>
......@@ -34,26 +36,52 @@ NNI (Neural Network Intelligence) 是自动机器学习(AutoML)的工具包
</tr>
</tr>
<tr valign="top">
<td align="center" valign="middle">
<b>内置</b>
</td>
<td>
<ul><li><b>支持的框架</b></li>
<ul>
<li>PyTorch</li>
<li>TensorFlow</li>
<li>Keras</li>
<li>TensorFlow</li>
<li>MXNet</li>
<li>Caffe2</li>
<li>CNTK (Python 语言)</li>
<li>Chainer</li>
<li>Theano</li>
<a href="docs/zh_CN/SupportedFramework_Library.md">更多...</a><br/>
</ul>
</ul>
<ul>
<li><b>支持的库</b></li>
<ul>
<li>Scikit-learn</li>
<li>XGBoost</li>
<li>LightGBM</li>
<a href="docs/zh_CN/SupportedFramework_Library.md">更多...</a><br/>
</ul>
</ul>
<ul>
<li><b>示例</b></li>
<ul>
<li><a href="examples/trials/mnist-distributed-pytorch">MNIST-pytorch</li></a>
<li><a href="examples/trials/mnist-distributed">MNIST-tensorflow</li></a>
<li><a href="examples/trials/mnist-keras">MNIST-keras</li></a>
<li><a href="docs/zh_CN/TrialExample/GbdtExample.md">Auto-gbdt</a></li>
<li><a href="docs/zh_CN/TrialExample/Cifar10Examples.md">Cifar10-pytorch</li></a>
<li><a href="docs/zh_CN/TrialExample/SklearnExamples.md">Scikit-learn</a></li>
<a href="docs/zh_CN/SupportedFramework_Library.md">更多...</a><br/>
</ul>
</ul>
</td>
<td align="left">
<td align="left" >
<a href="docs/zh_CN/Tuner/BuiltinTuner.md">Tuner(调参器)</a>
<br />
<ul>
<b style="margin-left:-20px">通用 Tuner</b>
<li><b>通用 Tuner</b></li>
<ul>
<li><a href="docs/zh_CN/Tuner/BuiltinTuner.md#Random">Random Search(随机搜索)</a></li>
<li><a href="docs/zh_CN/Tuner/BuiltinTuner.md#Evolution">Naïve Evolution(进化算法)</a></li>
<b style="margin-left:-20px">超参 Tuner</b>
<li><a href="docs/zh_CN/Tuner/BuiltinTuner.md#Evolution">Naïve Evolution(朴素进化)</a></li>
</ul>
<li><b><a href="docs/zh_CN/CommunitySharings/HpoComparision.md">超参调优</a> Tuner</b></li>
<ul>
<li><a href="docs/zh_CN/Tuner/BuiltinTuner.md#TPE">TPE</a></li>
<li><a href="docs/zh_CN/Tuner/BuiltinTuner.md#Anneal">Anneal(退火算法)</a></li>
<li><a href="docs/zh_CN/Tuner/BuiltinTuner.md#SMAC">SMAC</a></li>
......@@ -63,14 +91,19 @@ NNI (Neural Network Intelligence) 是自动机器学习(AutoML)的工具包
<li><a href="docs/zh_CN/Tuner/BuiltinTuner.md#MetisTuner">Metis Tuner</a></li>
<li><a href="docs/zh_CN/Tuner/BuiltinTuner.md#BOHB">BOHB</a></li>
<li><a href="docs/zh_CN/Tuner/BuiltinTuner.md#GPTuner">GP Tuner</a></li>
<b style="margin-left:-20px">网络结构 Tuner</b>
</ul>
<li><b><a href="docs/zh_CN/CommunitySharings/NasComparision.md">网络结构搜索</a> Tuner</b></li>
<ul>
<li><a href="docs/zh_CN/Tuner/BuiltinTuner.md#NetworkMorphism">Network Morphism</a></li>
<li><a href="examples/tuners/enas_nni/README.md">ENAS</a></li>
<li><a href="examples/tuners/enas_nni/README_zh_CN.md">ENAS</a></li>
</ul>
</ul>
<a href="docs/zh_CN/Assessor/BuiltinAssessor.md">Assessor(评估器)</a>
<ul>
<ul>
<li><a href="docs/zh_CN/Assessor/BuiltinAssessor.md#Medianstop">Median Stop(中位数终止)</a></li>
<li><a href="docs/zh_CN/Assessor/BuiltinAssessor.md#Curvefitting">Curve Fitting(曲线拟合)</a></li>
</ul>
</ul>
</td>
<td>
......@@ -85,6 +118,33 @@ NNI (Neural Network Intelligence) 是自动机器学习(AutoML)的工具包
</ul>
</td>
</tr>
<tr align="center" valign="bottom">
</td>
</tr>
<tr valign="top">
<td valign="middle">
<b>参考</b>
</td>
<td style="border-top:#FF0000 solid 0px;">
<ul>
<li><a href="docs/zh_CN/sdk_reference.rst">Python API</a></li>
<li><a href="docs/zh_CN/Tutorial/AnnotationSpec.md">NNI Annotation</a></li>
<li><a href="docs/zh_CN/Tutorial/Installation.md">支持的操作系统</a></li>
</ul>
</td>
<td style="border-top:#FF0000 solid 0px;">
<ul>
<li><a href="docs/zh_CN/Tuner/CustomizeTuner.md">自定义 Tuner</a></li>
<li><a href="docs/zh_CN/Assessor/CustomizeAssessor.md">自定义 Assessor</a></li>
</ul>
</td>
<td style="border-top:#FF0000 solid 0px;">
<ul>
<li><a href="docs/zh_CN/TrainingService/SupportTrainingService.md">支持训练平台</li>
<li><a href="docs/zh_CN/TrainingService/HowToImplementTrainingService.md">实现训练平台</a></li>
</ul>
</td>
</tr>
</tbody>
</table>
......@@ -139,7 +199,7 @@ Linux 和 macOS
*`python >= 3.5` 的环境中运行命令: `git``wget`,确保安装了这两个组件。
```bash
git clone -b v0.9 https://github.com/Microsoft/nni.git
git clone -b v1.0 https://github.com/Microsoft/nni.git
cd nni
source install.sh
```
......@@ -149,7 +209,7 @@ Windows
*`python >=3.5` 的环境中运行命令: `git``PowerShell`,确保安装了这两个组件。
```bash
git clone -b v0.9 https://github.com/Microsoft/nni.git
git clone -b v1.0 https://github.com/Microsoft/nni.git
cd nni
powershell -ExecutionPolicy Bypass -file install.ps1
```
......@@ -165,7 +225,7 @@ Windows 上参考 [Windows 上使用 NNI](docs/zh_CN/Tutorial/NniOnWindows.md)
* 通过克隆源代码下载示例。
```bash
git clone -b v0.9 https://github.com/Microsoft/nni.git
git clone -b v1.0 https://github.com/Microsoft/nni.git
```
Linux 和 macOS
......@@ -227,48 +287,50 @@ You can use these commands to get more information about the experiment
* [NNI 概述](docs/zh_CN/Overview.md)
* [快速入门](docs/zh_CN/Tutorial/QuickStart.md)
* [贡献](docs/zh_CN/Tutorial/Contributing.md)
* [示例](docs/zh_CN/examples.rst)
* [参考](docs/zh_CN/reference.rst)
* [Web 界面教程](docs/zh_CN/Tutorial/WebUI.md)
* [贡献](docs/zh_CN/Tutorial/Contributing.md)
## **入门**
* [安装 NNI](docs/zh_CN/Tutorial/Installation.md)
* [使用命令行工具 nnictl](docs/zh_CN/Tutorial/Nnictl.md)
* [使用 NNIBoard](docs/zh_CN/Tutorial/WebUI.md)
* [如何定义搜索空间](docs/zh_CN/Tutorial/SearchSpaceSpec.md)
* [如何实现 Trial 代码](docs/zh_CN/TrialExample/Trials.md)
* [如何选择 Tuner、搜索算法](docs/zh_CN/Tuner/BuiltinTuner.md)
* [实现 Trial](docs/zh_CN/TrialExample/Trials.md)
* [配置 Experiment](docs/zh_CN/Tutorial/ExperimentConfig.md)
* [如何使用 Annotation](docs/zh_CN/TrialExample/Trials.md#nni-python-annotation)
* [定制搜索空间](docs/zh_CN/Tutorial/SearchSpaceSpec.md)
* [选择 Tuner、搜索算法](docs/zh_CN/Tuner/BuiltinTuner.md)
* [使用 Annotation](docs/zh_CN/TrialExample/Trials.md#nni-python-annotation)
* [使用 NNIBoard](docs/zh_CN/Tutorial/WebUI.md)
## **教程**
* [在本机运行 Experiment (支持多 GPU 卡)](docs/zh_CN/TrainingService/LocalMode.md)
* [在 OpenPAI 上运行 Experiment](docs/zh_CN/TrainingService/PaiMode.md)
* [在 Kubeflow 上运行 Experiment](docs/zh_CN/TrainingService/KubeflowMode.md)
* [在本机运行 Experiment (支持多 GPU 卡)](docs/zh_CN/TrainingService/LocalMode.md)
* [在多机上运行 Experiment](docs/zh_CN/TrainingService/RemoteMachineMode.md)
* [尝试不同的 Tuner](docs/zh_CN/Tuner/BuiltinTuner.md)
* [尝试不同的 Assessor](docs/zh_CN/Assessor/BuiltinAssessor.md)
* [实现自定义 Tuner](docs/zh_CN/Tuner/CustomizeTuner.md)
* [实现自定义 Assessor](docs/zh_CN/Assessor/CustomizeAssessor.md)
* [实现 NNI 训练平台](docs/zh_CN/TrainingService/HowToImplementTrainingService.md)
* [使用进化算法为阅读理解任务找到好模型](docs/zh_CN/TrialExample/SquadEvolutionExamples.md)
* [高级神经网络架构搜索](docs/zh_CN/AdvancedFeature/AdvancedNas.md)
## **贡献**
非常欢迎通过各种方式参与此项目,例如:
* 审查[源代码改动](https://github.com/microsoft/nni/pulls)
* 审查[文档](https://github.com/microsoft/nni/tree/master/docs)中从拼写错误到新内容的任何内容,并提交拉取请求。
* [报告 Bug](https://github.com/microsoft/nni/issues/new/choose)
* [请求新功能](https://github.com/microsoft/nni/issues/new/choose).
* 建议或询问[如何调试](docs/zh_CN/Tutorial/HowToDebug.md)文档相关的问题。
* 找到标有 ['good first issue'](https://github.com/Microsoft/nni/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22)['help-wanted'](https://github.com/microsoft/nni/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22) 标签的 Issue。这些都是简单的 Issue,新的贡献者可以从这些问题开始。
提交代码前,需要遵循以下的简单准则
编写代码前,可以先看看[贡献指南](docs/zh_CN/Tutorial/Contributing.md)来了解更多信息。 此外,还提供了以下文档
* [NNI 开发环境安装教程](docs/zh_CN/Tutorial/SetupNniDeveloperEnvironment.md)
* [如何调试](docs/zh_CN/Tutorial/HowToDebug.md)
* [代码风格和命名约定](docs/zh_CN/Tutorial/Contributing.md)
* 如何设置 [NNI 开发环境](docs/zh_CN/Tutorial/SetupNniDeveloperEnvironment.md)
* 查看[贡献说明](docs/zh_CN/Tutorial/Contributing.md)并熟悉 NNI 的代码贡献指南
* [自定义 Advisor](docs/zh_CN/Tuner/CustomizeAdvisor.md)
* [自定义 Tuner](docs/zh_CN/Tuner/CustomizeTuner.md)
* [实现定制的训练平台](docs/zh_CN/TrainingService/HowToImplementTrainingService.md)
## **外部代码库**
......@@ -276,15 +338,13 @@ You can use these commands to get more information about the experiment
* 在 NNI 中运行 [ENAS](examples/tuners/enas_nni/README_zh_CN.md)
* 在 NNI 中运行 [神经网络架构结构搜索](examples/trials/nas_cifar10/README_zh_CN.md)
* [NNI 中的自动特征工程](examples/trials/auto-feature-engineering/README_zh_CN.md)
## **反馈**
* [报告 Bug](https://github.com/microsoft/nni/issues/new/choose)
* [请求新功能](https://github.com/microsoft/nni/issues/new/choose).
*[Gitter](https://gitter.im/Microsoft/nni?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) 中参与讨论
*[Stack Overflow](https://stackoverflow.com/questions/tagged/nni?sort=Newest&edited=true) 上使用 nni 的标签提问,或[在 Github 上提交 Issue](https://github.com/microsoft/nni/issues/new/choose)
* 我们正在实现[如何调试](docs/zh_CN/Tutorial/HowToDebug.md)的页面,欢迎提交建议和问题
*[Stack Overflow](https://stackoverflow.com/questions/tagged/nni?sort=Newest&edited=true) 上使用 NNI 标签提问
* [在 GitHub 上提交问题](https://github.com/microsoft/nni/issues/new/choose)
## **许可协议**
......
......@@ -40,7 +40,7 @@ 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))
with open('../../README.md', 'r') as fh:
with open('../../README.md', 'r', encoding="utf-8") as fh:
long_description = fh.read()
setuptools.setup(
......
......@@ -56,7 +56,7 @@ The hyper-parameters used in `Step 1.2 - Get predefined parameters` is defined i
"learning_rate":{"_type":"uniform","_value":[0.0001, 0.1]}
}
```
Refer to [SearchSpaceSpec.md](../Tutorial/SearchSpaceSpec.md) to learn more about search space.
Refer to [define search space](../Tutorial/SearchSpaceSpec.md) to learn more about search space.
>Step 3 - Define Experiment
......
......@@ -55,6 +55,32 @@ Compared with [LocalMode](LocalMode.md) and [RemoteMachineMode](RemoteMachineMod
* Optional key. Set the shmMB configuration of OpenPAI, it set the shared memory for one task in the task role.
* authFile
* Optional key, Set the auth file path for private registry while using PAI mode, [Refer](https://github.com/microsoft/pai/blob/2ea69b45faa018662bc164ed7733f6fdbb4c42b3/docs/faq.md#q-how-to-use-private-docker-registry-job-image-when-submitting-an-openpai-job), you can prepare the authFile and simply provide the local path of this file, NNI will upload this file to HDFS for you.
* portList
* Optional key. Set the portList configuration of OpenPAI, it specifies a list of port used in container, [Refer](https://github.com/microsoft/pai/blob/b2324866d0280a2d22958717ea6025740f71b9f0/docs/job_tutorial.md#specification).
The config schema in NNI is shown below:
```
portList:
- label: test
beginAt: 8080
portNumber: 2
```
Let's say you want to launch a tensorboard in the mnist example using the port. So the first step is to write a wrapper script `launch_pai.sh` of `mnist.py`.
```bash
export TENSORBOARD_PORT=PAI_PORT_LIST_${PAI_CURRENT_TASK_ROLE_NAME}_0_tensorboard
tensorboard --logdir . --port ${!TENSORBOARD_PORT} &
python3 mnist.py
```
The config file of portList should be filled as following:
```yaml
trial:
command: bash launch_pai.sh
portList:
- label: tensorboard
beginAt: 0
portNumber: 1
```
Once complete to fill NNI experiment config file and save (for example, save as exp_pai.yml), then run the following command
```
......
......@@ -33,4 +33,4 @@ abstract class TrainingService {
}
```
The parent class of TrainingService has a few abstract functions, users need to inherit the parent class and implement all of these abstract functions.
For more information about how to write your own TrainingService, please [refer](https://github.com/SparkSnail/nni/blob/dev-trainingServiceDoc/docs/en_US/TrainingService/HowToImplementTrainingService.md).
For more information about how to write your own TrainingService, please [refer](https://github.com/microsoft/nni/blob/master/docs/en_US/TrainingService/HowToImplementTrainingService.md).
......@@ -3,4 +3,6 @@ Grid Search on NNI
## Grid Search
Grid Search performs an exhaustive searching through a manually specified subset of the hyperparameter space defined in the searchspace file. Note that the only acceptable types of search space are `choice`, `quniform`, `qloguniform`. **The number `q` in `quniform` and `qloguniform` has special meaning (different from the spec in [search space spec](../Tutorial/SearchSpaceSpec.md)). It means the number of values that will be sampled evenly from the range `low` and `high`.**
\ No newline at end of file
Grid Search performs an exhaustive searching through a manually specified subset of the hyperparameter space defined in the searchspace file.
Note that the only acceptable types of search space are `choice`, `quniform`, `randint`.
\ No newline at end of file
......@@ -519,6 +519,10 @@ machineList:
__azureShare__ is the share of the azure file storage.
* __uploadRetryCount__
If upload files to azure storage failed, NNI will retry the process of uploading, this field will specify the number of attempts to re-upload files.
* __paiConfig__
* __userName__
......
......@@ -27,9 +27,8 @@ All types of sampling strategies and their parameter are listed here:
* `{"_type": "choice", "_value": options}`
* Which means the variable's value is one of the options. Here 'options' should be a list. Each element of options is a number of string. It could also be a nested sub-search-space, this sub-search-space takes effect only when the corresponding element is chosen. The variables in this sub-search-space could be seen as conditional variables.
* An simple [example](https://github.com/microsoft/nni/tree/master/examples/trials/mnist-nested-search-space/search_space.json) of [nested] search space definition. If an element in the options list is a dict, it is a sub-search-space, and for our built-in tuners you have to add a key `_name` in this dict, which helps you to identify which element is chosen. Accordingly, here is a [sample](https://github.com/microsoft/nni/tree/master/examples/trials/mnist-nested-search-space/sample.json) which users can get from nni with nested search space definition. Tuners which support nested search space is as follows:
* Which means the variable's value is one of the options. Here `options` should be a list of numbers or a list of strings. Using arbitrary objects as members of this list (like sublists, a mixture of numbers and strings, or null values) should work in most cases, but may trigger undefined behaviors.
* `options` could also be a nested sub-search-space, this sub-search-space takes effect only when the corresponding element is chosen. The variables in this sub-search-space could be seen as conditional variables. Here is an simple [example of nested search space definition](https://github.com/microsoft/nni/tree/master/examples/trials/mnist-nested-search-space/search_space.json). If an element in the options list is a dict, it is a sub-search-space, and for our built-in tuners you have to add a key `_name` in this dict, which helps you to identify which element is chosen. Accordingly, here is a [sample](https://github.com/microsoft/nni/tree/master/examples/trials/mnist-nested-search-space/sample.json) which users can get from nni with nested search space definition. Tuners which support nested search space are as follows:
- Random Search
- TPE
......
......@@ -125,7 +125,7 @@ for _ in range(num):
***oneshot_mode***: 遵循[论文](http://proceedings.mlr.press/v80/bender18a/bender18a.pdf)中的训练方法。 与 enas_mode 通过训练大量子图来训练全图有所不同,oneshot_mode 中构建了全图,并将 dropout 添加到候选的输入以及候选的输出操作中。 然后像其它深度学习模型一样进行训练。 [详细说明](#OneshotMode)。 (当前仅支持 TensorFlow)。
要使用 oneshot_mode,需要在配置的 `trial` 部分增加如下字段。 此模式不需要 Tuner,因此不用在配置文件中指定 Tuner。 (注意,当前仍然需要在配置文件中指定任一一个 Tuner。)此模式下也不需要`nni.training_update`,因为在训练过程中不需要特别的更新过程
要使用 oneshot_mode,需要在配置的 `trial` 部分增加如下字段。 此模式中,不需要使用 Tuner,只需要在配置文件中添加任意一个Tuner。 此外,也不需要`nni.training_update`,因为在训练过程中不需要更新
```diff
trial:
......@@ -139,7 +139,7 @@ trial:
***darts_mode***: 参考 [论文](https://arxiv.org/abs/1806.09055)中的训练方法。 与 oneshot_mode 类似。 有两个不同之处,首先 darts_mode 只将架构权重添加到候选操作的输出中,另外是交错的来训练模型权重和架构权重。 [详细说明](#DartsMode)
要使用 darts_mode,需要在配置的 `trial` 部分增加如下字段。 此模式不需要 Tuner,因此不用在配置文件中指定 Tuner。 (注意,当前仍需要在配置文件中指定任意一个 Tuner。
要使用 darts_mode,需要在配置的 `trial` 部分增加如下字段。 此模式中,不需要使用 Tuner,只需要在配置文件中添加任意一个Tuner。
```diff
trial:
......@@ -166,9 +166,9 @@ for _ in range(num):
### enas_mode
在 enas_mode 中,编译后的 Trial 代码会构建完整的图形(而不是子图),会接收所选择的架构,并在完整的图形上对此体系结构进行小型的批处理训练,然后再请求另一个架构。 通过 [NNI 多阶段 Experiment](./multiPhase.md) 来支持。
在 enas_mode 中,编译后的 Trial 代码会构建完整的图形(而不是子图),会接收所选择的架构,并在完整的图形上对此体系结构进行小型的批处理训练,然后再请求另一个架构。 通过 [NNI 多阶段 Experiment](./MultiPhase.md) 来支持。
具体来说,使用 TensorFlow 的 Trial,通过 TensorFlow 变量来作为信号,并使用 TensorFlow 的条件函数来控制搜索空间(全图)来提高灵活性。这意味着根据这些信号,可以变为不同的多个子图。 [这是 enas_mode]() 的示例。
具体来说,使用 TensorFlow 的 Trial,通过 TensorFlow 变量来作为信号,并使用 TensorFlow 的条件函数来控制搜索空间(全图)来提高灵活性。这意味着根据这些信号,可以变为不同的多个子图。 [](https://github.com/microsoft/nni/tree/master/examples/trials/mnist-nas/enas_mode)是 enas_mode 的示例。
<a name="OneshotMode"></a>
......@@ -178,7 +178,7 @@ for _ in range(num):
![](../../img/oneshot_mode.png)
[论文](http://proceedings.mlr.press/v80/bender18a/bender18a.pdf)中的建议,应该为每层的输入实现 Dropout 方法。 当 0 < r < 1 是模型超参的取值范围(默认值为 0.01),k 是某层可选超参的数量,Dropout 比率设为 r^(1/k)。 fan-in 越高,每个输入被丢弃的可能性越大。 但某层丢弃所有可选输入的概率是常数,与 fan-in 无关。 假设 r = 0.05。 如果某层有 k = 2 个可选的输入,每个输入都会以独立的 0.051/2 ≈ 0.22 的概率被丢弃,也就是说有 0.78 的概率被保留。 如果某层有 k = 7 个可选的输入,每个输入都会以独立的 0.051/7 ≈ 0.65 的概率被丢弃,也就是说有 0.35 的概率被保留。 在这两种情况下,丢弃所有可选输入的概率是 5%。 候选操作的输出会通过同样的方法被丢弃。 [这里]()是 oneshot_mode 的示例。
[论文](http://proceedings.mlr.press/v80/bender18a/bender18a.pdf)中的建议,应该为每层的输入实现 Dropout 方法。 当 0 < r < 1 是模型超参的取值范围(默认值为 0.01),k 是某层可选超参的数量,Dropout 比率设为 r^(1/k)。 fan-in 越高,每个输入被丢弃的可能性越大。 但某层丢弃所有可选输入的概率是常数,与 fan-in 无关。 假设 r = 0.05。 如果某层有 k = 2 个可选的输入,每个输入都会以独立的 0.051/2 ≈ 0.22 的概率被丢弃,也就是说有 0.78 的概率被保留。 如果某层有 k = 7 个可选的输入,每个输入都会以独立的 0.051/7 ≈ 0.65 的概率被丢弃,也就是说有 0.35 的概率被保留。 在这两种情况下,丢弃所有可选输入的概率是 5%。 候选操作的输出会通过同样的方法被丢弃。 [这里](https://github.com/microsoft/nni/tree/master/examples/trials/mnist-nas/oneshot_mode)是 oneshot_mode 的示例。
<a name="DartsMode"></a>
......@@ -188,7 +188,7 @@ for _ in range(num):
![](../../img/darts_mode.png)
`nni.training_update` 中,TensorFlow 的 MomentumOptimizer 通过传递的 `loss``feed_dict` 来训练架构权重。 [这是 darts_mode]() 的示例。
`nni.training_update` 中,TensorFlow 的 MomentumOptimizer 通过传递的 `loss``feed_dict` 来训练架构权重。 [](https://github.com/microsoft/nni/tree/master/examples/trials/mnist-nas/darts_mode)是 darts_mode 的示例。
### [**待实现**] One-Shot NAS 的多 Trial 任务。
......
......@@ -2,7 +2,7 @@
*匿名作者*
超参优化算法在几个问题上的对比。
超参优化算法(HPO)在几个问题上的对比。
超参数优化算法如下:
......
# 框架和库的支持
通过内置的 Python API,NNI 天然支持所有 Python (` 版本 >= 3.5`) 语言的 AI 框架,可使用所有超参调优和神经网络搜索算法。 NNI 还为常见场景提供了一些示例和教程,使上手更容易。
## 支持的 AI 框架
* **[PyTorch]** https://github.com/pytorch/pytorch
* [MNIST-pytorch](../../examples/trials/mnist-distributed-pytorch)
* [CIFAR-10](TrialExample/Cifar10Examples.md)
* [TGS salt identification chanllenge](../../examples/trials/kaggle-tgs-salt/README.md)
* [Network morphism](../../examples/trials/network_morphism/README_zh_CN.md)
* **[TensorFlow]** https://github.com/tensorflow/tensorflow
* [MNIST-tensorflow](../../examples/trials/mnist-distributed)
* [Squad](../../examples/trials/ga_squad/README_zh_CN.md)
* **[Keras]** https://github.com/keras-team/keras
* [MNIST-keras](../../examples/trials/mnist-keras)
* [Network morphism](../../examples/trials/network_morphism/README_zh_CN.md)
* **[MXNet]** https://github.com/apache/incubator-mxnet
* **[Caffe2]** https://github.com/BVLC/caffe
* **[CNTK (Python 语言)]** https://github.com/microsoft/CNTK
* **[Spark MLlib]** http://spark.apache.org/mllib/
* **[Chainer]** https://chainer.org/
* **[Theano]** https://pypi.org/project/Theano/
如果能[贡献更多示例](Tutorial/Contributing.md),会对其他 NNI 用户有很大的帮助。
## 支持的库
NNI 也支持其它 Python 库,包括一些基于 GBDT 的算法:XGBoost, CatBoost 以及 lightGBM。
* **[Scikit-learn]** https://scikit-learn.org/stable/
* [Scikit-learn](TrialExample/SklearnExamples.md)
* **[XGBoost]** https://xgboost.readthedocs.io/en/latest/
* **[CatBoost]** https://catboost.ai/
* **[LightGBM]** https://lightgbm.readthedocs.io/en/latest/
* [Auto-gbdt](TrialExample/GbdtExample.md)
这只是 NNI 支持的一小部分库。 如果对 NNI 感兴趣,可参考[教程](TrialExample/Trials.md)来继续学习。
除了这些案例,也欢迎更多的用户将 NNI 应用到自己的工作中,如果有任何疑问,请参考[实现 Trial](TrialExample/Trials.md)。 如果想成为 NNI 的贡献者,无论是分享示例,还是实现 Tuner 或其它内容,我们都非常期待您的参与。更多信息请[参考这里](Tutorial/Contributing.md)
\ No newline at end of file
......@@ -57,7 +57,7 @@
}
参考 [SearchSpaceSpec.md](../Tutorial/SearchSpaceSpec.md) 进一步了解搜索空间
参考[定义搜索空间](../Tutorial/SearchSpaceSpec.md)进一步了解。
> 第三步:定义 Experiment
>
......
......@@ -57,7 +57,7 @@ paiConfig:
* shmMB
* 可选。 设置 OpenPAI 的 shmMB,即 Docker 中的共享内存。
* authFile
* 可选,设置在使用 OpenPAI 时的私有 Docker 认证文件路径。[参考文档](https://github.com/microsoft/pai/blob/2ea69b45faa018662bc164ed7733f6fdbb4c42b3/docs/faq.md#q-how-to-use-private-docker-registry-job-image-when-submitting-an-openpai-job)
* 可选在使用 pai 模式时,为私有 Docker 仓库设置认证文件,[参考文档](https://github.com/microsoft/pai/blob/2ea69b45faa018662bc164ed7733f6fdbb4c42b3/docs/faq.md#q-how-to-use-private-docker-registry-job-image-when-submitting-an-openpai-job)提供 authFile 的本地路径即可, NNI 会上传此文件。
完成并保存 NNI Experiment 配置文件后(例如可保存为:exp_pai.yml),运行以下命令:
......
# 训练平台
NNI 为 Trial 任务实现了训练平台。 NNI 支持[本机](./LocalMode.md), [远程](./RemoteMachineMode.md), [OpenPAI](./PaiMode.md), [Kubeflow](./KubeflowMode.md)[FrameworkController](./FrameworkControllerMode.md) 这些内置的训练平台。
NNI 不仅提供了这些内置的训练平台,还提供了轻松连接自己训练平台的方法。
## 内置训练平台
| 训练平台 | 简介 |
| ------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [**本机**](./LocalMode.md) | NNI 支持在本机运行实验,称为 local 模式。 local 模式表示 NNI 会在运行 NNI Manager 进程计算机上运行 Trial 任务,支持 GPU 调度功能。 |
| [**远程计算机**](./RemoteMachineMode.md) | NNI 支持通过 SSH 通道在多台计算机上运行 Experiment,称为 remote 模式。 NNI 需要这些计算机的访问权限,并假定已配置好了深度学习训练环境。 NNI 将在远程计算机上中提交 Trial 任务,并根据 GPU 资源调度 Trial 任务。 |
| [**OpenPAI**](./PaiMode.md) | NNI 支持在 [OpenPAI](https://github.com/Microsoft/pai) (简称 pai)上运行 Experiment,即 pai 模式。 在使用 NNI 的 pai 模式前, 需要有 [OpenPAI](https://github.com/Microsoft/pai) 群集及其账户。 如果没有 OpenPAI,参考[这里](https://github.com/Microsoft/pai#how-to-deploy)来进行部署。 在 pai 模式中,会在 Docker 创建的容器中运行 Trial 程序。 |
| [**Kubeflow**](./KubeflowMode.md) | NNI 支持在 [Kubeflow](https://github.com/kubeflow/kubeflow)上运行,称为 kubeflow 模式。 在开始使用 NNI 的 Kubeflow 模式前,需要有一个 Kubernetes 集群,可以是私有部署的,或者是 [Azure Kubernetes Service(AKS)](https://azure.microsoft.com/zh-cn/services/kubernetes-service/),并需要一台配置好 [kubeconfig](https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/) 的 Ubuntu 计算机连接到此 Kubernetes 集群。 如果不熟悉 Kubernetes,可先浏览[这里](https://kubernetes.io/docs/tutorials/kubernetes-basics/)。 在 kubeflow 模式下,每个 Trial 程序会在 Kubernetes 集群中作为一个 Kubeflow 作业来运行。 |
| [**FrameworkController**](./FrameworkControllerMode.md) | NNI 支持使用 [FrameworkController](https://github.com/Microsoft/frameworkcontroller),来运行 Experiment,称之为 frameworkcontroller 模式。 FrameworkController 构建于 Kubernetes 上,用于编排各种应用。这样,可以不用为某个深度学习框架安装 Kubeflow 的 tf-operator 或 pytorch-operator 等。 而直接用 FrameworkController 作为 NNI Experiment 的训练平台。 |
## 实现训练平台
TrainingService 在设计上为了便于实现,将平台相关的公共属性抽象成类。用户只需要继承这个抽象类,并根据平台特点实现子类,便能够实现 TrainingService。
TrainingService 的声明如下:
abstract class TrainingService {
public abstract listTrialJobs(): Promise<TrialJobDetail[]>;
public abstract getTrialJob(trialJobId: string): Promise<TrialJobDetail>;
public abstract addTrialJobMetricListener(listener: (metric: TrialJobMetric) => void): void;
public abstract removeTrialJobMetricListener(listener: (metric: TrialJobMetric) => void): void;
public abstract submitTrialJob(form: JobApplicationForm): Promise<TrialJobDetail>;
public abstract updateTrialJob(trialJobId: string, form: JobApplicationForm): Promise<TrialJobDetail>;
public abstract get isMultiPhaseJobSupported(): boolean;
public abstract cancelTrialJob(trialJobId: string, isEarlyStopped?: boolean): Promise<void>;
public abstract setClusterMetadata(key: string, value: string): Promise<void>;
public abstract getClusterMetadata(key: string): Promise<string>;
public abstract cleanUp(): Promise<void>;
public abstract run(): Promise<void>;
}
TrainingService 的父类有一些抽象函数,用户需要继承父类并实现所有这些抽象函数。
有关如何实现 TrainingService 的更多信息,[参考这里](HowToImplementTrainingService.md)
\ No newline at end of file
......@@ -123,6 +123,7 @@ nnictl 支持的命令:
| ---------- | ----- | --- | -------------------------------- |
| id | False | | 要停止的 Experiment 标识 |
| --port, -p | False | | 要停止的 Experiment 使用的 RESTful 服务端口 |
| --all, -a | False | | 停止所有 Experiment |
* 详细信息及样例
......@@ -147,10 +148,10 @@ nnictl 支持的命令:
```
4. 可使用 'nnictl stop all' 来停止所有的 Experiment。
4. 可使用 'nnictl stop --all' 来停止所有的 Experiment。
```bash
nnictl stop all
nnictl stop --all
```
......
......@@ -10,11 +10,11 @@
```yaml
{
"dropout_rate":{"_type":"uniform","_value":[0.1,0.5]},
"conv_size":{"_type":"choice","_value":[2,3,5,7]},
"hidden_size":{"_type":"choice","_value":[124, 512, 1024]},
"batch_size":{"_type":"choice","_value":[50, 250, 500]},
"learning_rate":{"_type":"uniform","_value":[0.0001, 0.1]}
"dropout_rate": {"_type": "uniform", "_value": [0.1, 0.5]},
"conv_size": {"_type": "choice", "_value": [2, 3, 5, 7]},
"hidden_size": {"_type": "choice", "_value": [124, 512, 1024]},
"batch_size": {"_type": "choice", "_value": [50, 250, 500]},
"learning_rate": {"_type": "uniform", "_value": [0.0001, 0.1]}
}
```
......@@ -25,61 +25,60 @@
所有采样策略和参数如下:
* {"_type":"choice","_value":options}
* `{"_type": "choice", "_value": options}`
* 表示变量的值是选项之一。 这里的 'options' 是一个数组。 选项的每个元素都是字符串。 也可以是嵌套的子搜索空间。此子搜索空间仅在相应的元素选中后才起作用。 该子搜索空间中的变量可看作是条件变量。
* [nested] 搜索空间定义的简单[示例](https://github.com/microsoft/nni/tree/master/examples/trials/mnist-nested-search-space/search_space.json)。 如果选项列表中的元素是 dict,则它是一个子搜索空间,对于内置的 Tuner,必须在此 dict 中添加键 “_name”,这有助于标识选中的元素。 相应的,这是使用从 NNI 获得的嵌套搜索空间的[示例](https://github.com/microsoft/nni/tree/master/examples/trials/mnist-nested-search-space/sample.json)。 以下 Tuner 支持嵌套搜索空间:
* 表示变量的值是选项之一。 这里的 `options` 应该是字符串或数值的列表。 可将任意对象(如子数组,数字与字符串的混合值或者空值)存入此数组中,但可能会产生不可预料的行为。
* `options` 也可以是嵌套的子搜索空间。此子搜索空间仅在相应的元素选中后才起作用。 该子搜索空间中的变量可看作是条件变量。 <a [嵌套搜索空间的简单示例](https://github.com/microsoft/nni/tree/master/examples/trials/mnist-nested-search-space/search_space.json)。 如果选项列表中的元素是 dict,则它是一个子搜索空间,对于内置的 Tuner,必须在此 dict 中添加键 `_name`,这有助于标识选中的元素。 相应的,这是使用从 NNI 获得的嵌套搜索空间的[示例](https://github.com/microsoft/nni/tree/master/examples/trials/mnist-nested-search-space/sample.json)。 以下 Tuner 支持嵌套搜索空间:
* Random Search(随机搜索)
* TPE
* Anneal(退火算法)
* Evolution
* {"_type":"randint","_value":[lower, upper]}
* `{"_type": "randint", "_value": [lower, upper]}`
* 当前实现的是 "quniform" 的 "randint" 分布,随机变量的分布函数是 round(uniform(lower, upper))。 所选择值的类型是 float。 如果要使用整数,需要显式转换。
*`lower` (包含) 到 `upper` (不包含) 中选择一个随机整数。
* 注意:不同 Tuner 可能对 `randint` 有不同的实现。 一些 Tuner(例如,TPE,GridSearch)将从低到高无序选择,而其它一些(例如,SMAC)则有顺序。 如果希望所有 Tuner 都有序,可使用 `quniform` 并设置 `q=1`
* {"_type":"uniform","_value":[low, high]}
* `{"_type": "uniform", "_value": [low, high]}`
* 变量是 low 和 high 之间均匀分布的值。
* 当优化时,此变量值会在两侧区间内。
* {"_type":"quniform","_value":[low, high, q]}
* 变量值为 clip(round(uniform(low, high) / q) * q, low, high),clip 操作用于约束生成值的边界。 例如,_value 为 [0, 10, 2.5],可取的值为 [0, 2.5, 5.0, 7.5, 10.0]; _value 为 [2, 10, 5],可取的值为 [2, 5, 10]。
* `{"_type": "quniform", "_value": [low, high, q]}`
* 变量值为 `clip(round(uniform(low, high) / q) * q, low, high)`,clip 操作用于约束生成值的边界。 例如,`_value` 为 [0, 10, 2.5],可取的值为 [0, 2.5, 5.0, 7.5, 10.0]; `_value` 为 [2, 10, 5],可取的值为 [2, 5, 10]。
* 适用于离散,同时反映了某种"平滑"的数值,但上下限都有限制。 如果需要从范围 [low, high] 中均匀选择整数,可以如下定义 `_value``[low, high, 1]`
* {"_type":"loguniform","_value":[low, high]}
* `{"_type": "loguniform", "_value": [low, high]}`
* 变量值在范围 [low, high] 中是 loguniform 分布,如 exp(uniform(log(low), log(high))),因此返回值是对数均匀分布的。
* 当优化时,此变量必须是正数。
* {"_type":"qloguniform","_value":[low, high, q]}
* `{"_type": "qloguniform", "_value": [low, high, q]}`
* 变量值为 clip(round(loguniform(low, high) / q) * q, low, high),clip 操作用于约束生成值的边界。
* 变量值为 `clip(round(loguniform(low, high) / q) * q, low, high)`,clip 操作用于约束生成值的边界。
* 适用于值是“平滑”的离散变量,但上下限均有限制。
* {"_type":"normal","_value":[mu, sigma]}
* `{"_type": "normal", "_value": [mu, sigma]}`
* 变量值为实数,且为正态分布,均值为 mu,标准方差为 sigma。 优化时,此变量不受约束。
* {"_type":"qnormal","_value":[mu, sigma, q]}
* `{"_type": "qnormal", "_value": [mu, sigma, q]}`
* 这表示变量值会类似于 round(normal(mu, sigma) / q) * q
* 这表示变量值会类似于 `round(normal(mu, sigma) / q) * q`
* 适用于在 mu 周围的离散变量,且没有上下限限制。
* {"_type":"lognormal","_value":[mu, sigma]}
* `{"_type": "lognormal", "_value": [mu, sigma]}`
* 变量值为 exp(normal(mu, sigma)) 分布,范围值是对数的正态分布。 当优化时,此变量必须是正数。
* 变量值为 `exp(normal(mu, sigma))` 分布,范围值是对数的正态分布。 当优化时,此变量必须是正数。
* {"_type":"qlognormal","_value":[mu, sigma, q]}
* `{"_type": "qlognormal", "_value": [mu, sigma, q]}`
* 这表示变量值会类似于 round(exp(normal(mu, sigma)) / q) * q
* 这表示变量值会类似于 `round(exp(normal(mu, sigma)) / q) * q`
* 适用于值是“平滑”的离散变量,但某一边有界。
* {"_type":"mutable_layer","_value":{mutable_layer_infomation}}
* `{"_type": "mutable_layer", "_value": {mutable_layer_infomation}}`
* [神经网络架构搜索空间](../AdvancedFeature/GeneralNasInterfaces.md)的类型。 值是字典类型,键值对表示每个 mutable_layer 的名称和搜索空间。
* 当前,只能通过 Annotation 来使用这种类型的搜索空间。因此不需要为搜索空间定义 JSON 文件,它会通过 Trial 中的 Annotation 自动生成。
......
......@@ -12,7 +12,7 @@
![](../../img/webui-img/refresh-interval.png)
* 支持查看并下载 Experiment 结果,以及 NNI Manager、Dispatcher 的日志文件。
* "View" 按钮支持查看并下载 Experiment 结果,以及 NNI Manager、Dispatcher 的日志文件。
![](../../img/webui-img/download.png)
......@@ -53,13 +53,11 @@
![](../../img/webui-img/trials_intermeidate.png)
由于训练中可能有非常多的中间结果,因此中间结果图提供了过滤功能。 如果要使用过滤按钮查看部分 Trial,则需要提供数据
Trial 可能在训练过程中有大量中间结果。 为了更清楚的理解一些 Trial 的趋势,可以为中间结果图设置过滤
第一个输入框应该填入什么? 可能会发现一个 Trial 中间结果变得更好或更差。 换句话说,这可能是非常重要的中间结果只需将其输入第一个输入框中
这样可以发现 Trial 在某个中间结果上会变得更好或更差。 换句话说,这是一个重要的中间结果。 如果要仔细查看这个点,可以在 #Intermediate 中输入其横坐标
选择了中间结果序号后,要输入需要了解的该中间结果序号的指标范围。 即其最小值和最大值。 如此图中,中间结果点为 9,指标范围为 60 至 80。
Trial 中指标范围在 20 至 60 的 13 个结果就被过滤掉了。
并输入这个中间结果的指标范围。 如下图所示,选择了第 4 个中间结果, 并将指标范围设置为了 0.8 -1。
![](../../img/webui-img/filter-intermediate.png)
......
......@@ -28,7 +28,7 @@ author = 'Microsoft'
# The short X.Y version
version = ''
# The full version, including alpha/beta/rc tags
release = 'v0.7'
release = 'v1.0'
# -- General configuration ---------------------------------------------------
......
......@@ -60,7 +60,8 @@
"lodash": "^4.17.13",
"lodash.merge": "^4.6.2",
"node.extend": "^1.1.7",
"hoek": "^4.2.1"
"hoek": "^4.2.1",
"js-yaml": "^3.13.1"
},
"engines": {
"node": ">=10.0.0"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment