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

Chinese translation (#2458) #101

Merged
merged 1 commit into from
Jul 3, 2020
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
25 changes: 15 additions & 10 deletions README_zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ NNI 管理自动机器学习 (AutoML) 的 Experiment,**调度运行**由调优
* 想要更容易**实现或试验新的自动机器学习算法**的研究员或数据科学家,包括:超参调优算法,神经网络搜索算法以及模型压缩算法。
* 在机器学习平台中**支持自动机器学习**。

### **[NNI v1.5 已发布!](https://github.com/microsoft/nni/releases) &nbsp;[<img width="48" src="docs/img/release_icon.png" />](#nni-released-reminder)**
### **[NNI v1.6 已发布!](https://github.com/microsoft/nni/releases) &nbsp;[<img width="48" src="docs/img/release_icon.png" />](#nni-released-reminder)**

## **NNI 功能一览**

Expand Down Expand Up @@ -84,6 +84,7 @@ NNI 提供命令行工具以及友好的 WebUI 来管理训练的 Experiment。
<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>
<li><a href="docs/zh_CN/TrialExample/EfficientNet.md">EfficientNet</a></li>
<li><a href="docs/zh_CN/TrialExample/OpEvoExamples.md">GPU Kernel 调优</li></a>
<a href="docs/zh_CN/SupportedFramework_Library.md">更多...</a><br/>
</ul>
</ul>
Expand Down Expand Up @@ -137,6 +138,10 @@ NNI 提供命令行工具以及友好的 WebUI 来管理训练的 Experiment。
<li><a href="docs/zh_CN/Compressor/Pruner.md#agp-pruner">AGP Pruner</a></li>
<li><a href="docs/zh_CN/Compressor/Pruner.md#slim-pruner">Slim Pruner</a></li>
<li><a href="docs/zh_CN/Compressor/Pruner.md#fpgm-pruner">FPGM Pruner</a></li>
<li><a href="docs/zh_CN/Compressor/Pruner.md#netadapt-pruner">NetAdapt Pruner</a></li>
<li><a href="docs/zh_CN/Compressor/Pruner.md#simulatedannealing-pruner">SimulatedAnnealing Pruner</a></li>
<li><a href="docs/zh_CN/Compressor/Pruner.md#admm-pruner">ADMM Pruner</a></li>
<li><a href="docs/zh_CN/Compressor/Pruner.md#autocompress-pruner">AutoCompress Pruner</a></li>
</ul>
<b>量化</b>
<ul>
Expand Down Expand Up @@ -164,7 +169,7 @@ NNI 提供命令行工具以及友好的 WebUI 来管理训练的 Experiment。
<li><a href="docs/zh_CN/TrainingService/KubeflowMode.md">Kubeflow</a></li>
<li><a href="docs/zh_CN/TrainingService/FrameworkControllerMode.md">基于 Kubernetes(AKS 等)的 FrameworkController</a></li>
</ul>
<ul><li><a href="docs/zh_CN/TrainingService/DLTSMode.md">DLWorkspace (又称 DLTS)</a></li>
<ul><li><a href="docs/zh_CN/TrainingService/DLTSMode.md">DLWorkspace (又称 DLTS)</a></li>
</ul>
</td>
</tr>
Expand All @@ -186,11 +191,12 @@ NNI 提供命令行工具以及友好的 WebUI 来管理训练的 Experiment。
<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>
<li><a href="docs/zh_CN/Tutorial/InstallCustomizedAlgos.md">安装自定义的 Tuner,Assessor,Advisor</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/Overview.md">支持训练平台</li>
<li><a href="docs/zh_CN/TrainingService/HowToImplementTrainingService.md">实现训练平台</a></li>
</ul>
</td>
Expand Down Expand Up @@ -223,7 +229,7 @@ Linux 和 macOS 下 NNI 系统需求[参考这里](https://nni.readthedocs.io/zh
注意:

* 如果遇到任何权限问题,可添加 `--user` 在用户目录中安装 NNI。
* 目前,Windows 上的 NNI 支持本机,远程和 OpenPAI 模式。 强烈推荐使用 Anaconda 或 Miniconda 在 Windows 上安装 NNI。
* 目前,Windows 上的 NNI 支持本机,远程和 OpenPAI 模式。 强烈推荐使用 Anaconda 或 Miniconda [在 Windows 上安装 NNI](docs/zh_CN/Tutorial/InstallationWin.md)
* 如果遇到如 `Segmentation fault` 等错误参考[常见问题](docs/zh_CN/Tutorial/FAQ.md)。 Windows 上的 FAQ 参考[在 Windows 上使用 NNI](docs/zh_CN/Tutorial/InstallationWin.md#faq)。

### **验证安装**
Expand All @@ -233,7 +239,7 @@ Linux 和 macOS 下 NNI 系统需求[参考这里](https://nni.readthedocs.io/zh
* 通过克隆源代码下载示例。

```bash
git clone -b v1.5 https://github.com/Microsoft/nni.git
git clone -b v1.6 https://github.com/Microsoft/nni.git
```

* 运行 MNIST 示例。
Expand Down Expand Up @@ -316,8 +322,7 @@ You can use these commands to get more information about the experiment
经作者许可的一些 NNI 用法示例和相关文档。

* ### **外部代码库** ###
* 在 NNI 中运行 [ENAS](examples/tuners/enas_nni/README_zh_CN.md)
* 在 NNI 中运行 [神经网络架构结构搜索](examples/trials/nas_cifar10/README_zh_CN.md)
* 在 NNI 中运行 [ENAS](examples/nas/enas/README_zh_CN.md)
* [NNI 中的自动特征工程](examples/feature_engineering/auto-feature-engineering/README_zh_CN.md)
* 使用 NNI 的 [矩阵分解超参调优](https://github.com/microsoft/recommenders/blob/master/notebooks/04_model_select_and_optimize/nni_surprise_svd.ipynb)
* [scikit-nni](https://github.com/ksachdeva/scikit-nni) 使用 NNI 为 scikit-learn 开发的超参搜索。
Expand All @@ -339,9 +344,9 @@ You can use these commands to get more information about the experiment

加入聊天组:

| Gitter | | 微信 |
| ----------------------------------------------------------------------------------------------------------- | - | ------------------------------------------------------------------------------------------- |
| ![图片](https://user-images.githubusercontent.com/39592018/80665738-e0574a80-8acc-11ea-91bc-0836dc4cbf89.png) | 或 | ![图片](https://github.com/JSong-Jia/NNI-user-group/blob/master/user%20group%20code_0512.jpg) |
| Gitter | | 微信 |
| ----------------------------------------------------------------------------------------------------------- | - | ----------------------------------------------------------------------- |
| ![图片](https://user-images.githubusercontent.com/39592018/80665738-e0574a80-8acc-11ea-91bc-0836dc4cbf89.png) | 或 | ![image](https://github.com/scarlett2018/nniutil/raw/master/wechat.png) |

## 相关项目

Expand Down
12 changes: 6 additions & 6 deletions docs/zh_CN/Assessor/BuiltinAssessor.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ NNI 提供了先进的评估算法,使用上也很简单。 下面是内置 As

<a name="MedianStop"></a>

![](https://placehold.it/15/1589F0/000000?text=+) `Median Stop Assessor`
### Median Stop Assessor

> 名称:**Medianstop**

Expand Down Expand Up @@ -47,20 +47,21 @@ assessor:

<a name="Curvefitting"></a>

![](https://placehold.it/15/1589F0/000000?text=+) `Curve Fitting Assessor`
### Curve Fitting Assessor

> 名称:**Curvefitting**

**建议场景**

适用于各种性能曲线,可用到各种场景中来加速优化过程。 更好的地方是,它能处理并评估性能类似的曲线。 [详细说明](./CurvefittingAssessor.md)
适用于各种性能曲线,可用到各种场景中来加速优化过程。 更好的是,它能够处理并评估性能类似的曲线。 [详细说明](./CurvefittingAssessor.md)

**注意**,根据原始论文,仅支持递增函数。 因此,此 Assessor 仅可用于最大化优化指标的场景。 例如,它可用于准确度,但不能用于损失值。

**classArgs 要求:**

* **epoch_num** (*int, **必需***) - epoch 的总数。 需要此数据来决定需要预测点的总数。
* **optimize_mode** (*maximize 或 minimize, 可选, 默认值为 maximize*) - 如果为 'maximize', Assessor 会在结果小于期望值时**终止** Trial。 如果为 'minimize',Assessor 会在结果大于期望值时**终止** Trial。
* **start_step** (*int, 可选, 默认值为 6*) - 只有收到 start_step 个中间结果后,才开始判断是否一个 Trial 应该被终止。
* **threshold** (*float, 可选, 默认值为 0.95*) - 用来确定提前终止较差结果的阈值。 例如,如果 threshold = 0.95, optimize_mode = maximize,最好的历史结果是 0.9,那么会在 Trial 的预测值低于 0.95 * 0.9 = 0.855 时停止。
* **threshold** (*float, 可选, 默认值为 0.95*) - 用来确定提前终止较差结果的阈值。 例如,如果 threshold = 0.95,最好的历史结果是 0.9,那么会在 Trial 的预测值低于 0.95 * 0.9 = 0.855 时停止。
* **gap** (*int, 可选, 默认值为 1*) - Assessor 两次评估之间的间隔次数。 例如:如果 gap = 2, start_step = 6,就会评估第 6, 8, 10, 12... 个中间结果。

**使用示例:**
Expand All @@ -71,7 +72,6 @@ assessor:
builtinAssessorName: Curvefitting
classArgs:
epoch_num: 20
optimize_mode: maximize
start_step: 6
threshold: 0.95
gap: 1
Expand Down
63 changes: 32 additions & 31 deletions docs/zh_CN/Assessor/CurvefittingAssessor.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# NNI 中的 Curve Fitting Assessor

## 1. 介绍
## 介绍

Curve Fitting Assessor 是一个 LPA (learning, predicting, assessing,即学习、预测、评估) 的算法。 如果预测的 Trial X 在 step S 比性能最好的 Trial 要差,就会提前终止它。

此算法中采用了 12 种曲线来拟合学习曲线。 这组参数曲线模型来自于[参考论文](http://aad.informatik.uni-freiburg.de/papers/15-IJCAI-Extrapolation_of_Learning_Curves.pdf)。 学习曲线的形状与先验知识是一致的:都是典型的递增的、饱和的函数。

![](../../img/curvefitting_learning_curve.PNG)
![learning_curve](../../img/curvefitting_learning_curve.PNG)

所有学习曲线模型被合并到了单个,更强大的模型中。 合并的模型通过加权线性混合:

![](../../img/curvefitting_f_comb.gif)
![f_comb](../../img/curvefitting_f_comb.gif)

合并后的新参数向量

![](../../img/curvefitting_expression_xi.gif)
![expression_xi](../../img/curvefitting_expression_xi.gif)

假设增加一个高斯噪声,且噪声参数初始化为最大似然估计。

Expand All @@ -30,43 +30,44 @@ Curve Fitting Assessor 是一个 LPA (learning, predicting, assessing,即学

下图显示了此算法在 MNIST Trial 历史数据上结果。其中绿点表示 Assessor 获得的数据,蓝点表示将来,但未知的数据,红色线条是 Curve fitting Assessor 的预测曲线。

![](../../img/curvefitting_example.PNG)
![示例](../../img/curvefitting_example.PNG)

## 2. 用法
## 用法

要使用 Curve Fitting Assessor,需要在 Experiment 的 YAML 配置文件进行如下改动。

assessor:
builtinAssessorName: Curvefitting
classArgs:
# (必须) epoch 的总数。
# 需要此数据来决定需要预测的点。
epoch_num: 20
# (可选) 选项: maximize, minimize
* optimize_mode 的默认值是 maximize
optimize_mode: maximize
# (可选) 为了节约计算资源,在收到了 start_step 个中间结果后,才开始预测。
# start_step 的默认值是 6。
start_step: 6
# (可选) 决定是否提前终止的阈值。
# 例如,如果 threshold = 0.95, optimize_mode = maximize,最好的历史结果是 0.9,那么会在 Trial 的预测值低于 0.95 * 0.9 = 0.855 时停止。
* 阈值的默认值是 0.95。
# 注意:如果选择了 minimize 模式,要让 threshold >= 1.0 (如 threshold=1.1)
threshold: 0.95
# (可选) gap 是两次评估之间的间隔次数。
# 例如:如果 gap = 2, start_step = 6,就会评估第 6, 8, 10, 12... 个中间结果。
* gap 的默认值是 1。
gap: 1


## 3. 文件结构
```yaml
assessor:
builtinAssessorName: Curvefitting
classArgs:
# (必须) epoch 的总数。
# 需要此数据来决定需要预测的点。
epoch_num: 20
# (可选) 为了节约计算资源,仅在收到 start_step 个中间结果后,才开始进行预测。
# start_step 的默认值是 6。
start_step: 6
# (可选) 决定是否提前终止的阈值。
# 例如,如果 threshold = 0.95,最好的历史结果是 0.9,那么会在 Trial 的预测值低于 0.95 * 0.9 = 0.855 时停止。
# 阈值的默认值是 0.95。
threshold: 0.95
# (可选) gap 是两次评估之间的间隔次数。
# 例如:如果 gap = 2, start_step = 6,就会评估第 6, 8, 10, 12... 个中间结果。
# gap 的默认值是 1。
gap: 1
```

## 局限性

根据原始论文,仅支持递增函数。 因此,此 Assessor 仅可用于最大化优化指标的场景。 例如,它可用于准确度,但不能用于损失值。

## 文件结构

Assessor 有大量的文件、函数和类。 在这里,会简要描述其中一部分。

* `curvefunctions.py` 包含了所有函数表达式和默认参数。
* `modelfactory.py` 包括学习和预测部分,并实现了相应的计算部分。
* `curvefitting_assessor.py` 是接收 Trial 历史数据并评估是否需要提前终止的 Assessor。

## 4. TODO
## TODO

* 进一步提高预测精度,并在更多模型上测试。
40 changes: 40 additions & 0 deletions docs/zh_CN/Compressor/CompressionReference.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# 模型压缩 Python API 参考

```eval_rst
.. contents::
```

## 灵敏度工具

```eval_rst
.. autoclass:: nni.compression.torch.utils.sensitivity_analysis.SensitivityAnalysis
:members:

```

## 拓扑结构工具

```eval_rst
.. autoclass:: nni.compression.torch.utils.shape_dependency.ChannelDependency
:members:

.. autoclass:: nni.compression.torch.utils.shape_dependency.GroupDependency
:members:

.. autoclass:: nni.compression.torch.utils.mask_conflict.CatMaskPadding
:members:

.. autoclass:: nni.compression.torch.utils.mask_conflict.GroupMaskConflict
:members:

.. autoclass:: nni.compression.torch.utils.mask_conflict.ChannelMaskConflict
:members:

```

## 模型 FLOPs 和参数计数器

```eval_rst
.. autofunction:: nni.compression.torch.utils.counter.count_flops_params

```
Loading