Unverified Commit df4f05c7 authored by Chi Song's avatar Chi Song Committed by GitHub
Browse files

add Chinese translation (#661)

parent b38c0431
<svg id="图层_1" data-name="图层 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 806.55 233.23"><defs><style>.cls-1,.cls-10,.cls-2,.cls-3,.cls-7,.cls-8,.cls-9{fill:none;}.cls-1,.cls-9{stroke:#c1c1c1;}.cls-1{stroke-miterlimit:10;}.cls-2{stroke:#000;}.cls-10,.cls-2,.cls-3,.cls-7,.cls-8,.cls-9{stroke-miterlimit:8;stroke-width:1.53px;}.cls-3{stroke:#662d91;}.cls-4{font-size:18px;fill:#0071bc;font-family:SegoeUI, Segoe UI;}.cls-5{letter-spacing:-0.1em;}.cls-6{font-family:SegoeUIBlack, Segoe UI;}.cls-7,.cls-8{stroke:#505050;}.cls-10,.cls-8,.cls-9{stroke-linecap:square;}.cls-10{stroke:#29abe2;}.cls-11{font-size:16.14px;fill:#a1c057;font-family:SegoeUI-Bold, Segoe UI;font-weight:700;}</style></defs><title>overview</title><path class="cls-1" d="M698.51,57.48a70.71,70.71,0,0,1,15.66,139.67"/><path class="cls-1" d="M104.59,57.48A70.71,70.71,0,0,0,92.83,197.92"/><path class="cls-2" d="M377.34,201.92c0-1-.15-2-.15-3a20.37,20.37,0,0,1,20.27-20.48c1,0,1.84.14,2.69.14"/><path class="cls-2" d="M391.79,218.68a24.59,24.59,0,0,0,5.67.71,20.37,20.37,0,0,0,20.27-20.48,12.59,12.59,0,0,0-.15-2.44"/><path class="cls-2" d="M397.46,215.1l-5.81,3.43,3.54,5.73"/><path class="cls-2" d="M394.48,182.15l5.81-3.44L396.75,173"/><path class="cls-3" d="M414,184h-8.36v8.31H414V184Z"/><path class="cls-3" d="M383,216.1a5.88,5.88,0,1,0-5.81-5.87A5.9,5.9,0,0,0,383,216.1Z"/><line class="cls-1" x1="701.49" y1="57.48" x2="595.78" y2="57.48"/><line class="cls-1" x1="488.78" y1="57.48" x2="296.61" y2="57.48"/><line class="cls-1" x1="210.1" y1="57.48" x2="104.59" y2="57.48"/><text class="cls-4" transform="translate(174.39 103.07)">Command Line <tspan class="cls-5" x="124.94" y="0">T</tspan><tspan x="132.61" y="0">ool</tspan><tspan class="cls-6"><tspan x="45.01" y="23.6">NNICTL</tspan></tspan></text><text class="cls-4" transform="translate(493.22 105.07)">Visualized UI<tspan class="cls-6"><tspan x="3.81" y="23.6">NNI Board</tspan></tspan></text><path class="cls-7" d="M240.73,53.54a12.69,12.69,0,1,1,12.69,12.38,12.55,12.55,0,0,1-12.69-12.38Zm20.42-21.33a23.92,23.92,0,0,0-7.73-1.28c-12.84,0-23.19,10.1-23.19,22.61A22.58,22.58,0,0,0,243.5,74m2.19.85a22.63,22.63,0,0,0,7.73,1.28c12.83,0,23.19-10.1,23.19-22.62a22.48,22.48,0,0,0-1.17-7m-.87-2.42a23.09,23.09,0,0,0-10.79-10.81m-4.09,5.55-1.17,3.27m10.8,5.54L265.23,49m-.14,9.25,4.08,1.56m-8.9,8.82-1.89-3.7m-11.09,3.84,1.61-3.69M238.1,59.8l3.65-1.42M238.1,47.71,241.6,49m7.15-7-1.6-3.12"/><path class="cls-8" d="M567.21,74.12h-46.5V37.28h46.5V74.12m-46.5-27.63h45.74m-27.14,6.15h-12.4V68h12.4V52.64m4.65,0h9.3M544,58.77h9.3M544,64.91h6.2"/><polyline class="cls-1" points="357.3 194.3 361.8 198.62 357.3 202.95"/><polyline class="cls-1" points="625.71 194.3 630.21 198.62 625.71 202.95"/><line class="cls-1" x1="245.91" y1="198.91" x2="176.69" y2="198.91"/><line class="cls-1" x1="361.68" y1="198.91" x2="285.84" y2="198.91"/><line class="cls-1" x1="630.29" y1="198.91" x2="557.62" y2="198.91"/><line class="cls-1" x1="517.67" y1="198.91" x2="430.83" y2="198.91"/><path class="cls-9" d="M265.88,187.49A11.87,11.87,0,1,1,254,199.35a11.86,11.86,0,0,1,11.86-11.86ZM264,205.39l6-6-6-6"/><path class="cls-9" d="M537.65,187.49a11.87,11.87,0,1,1-11.86,11.86,11.86,11.86,0,0,1,11.86-11.86Zm-1.9,17.9,6-6-6-6"/><path class="cls-2" d="M699.21,204.44a11.15,11.15,0,0,0-8.71-17.93,15.84,15.84,0,0,0-15.67-14.39,15.64,15.64,0,0,0-13.34,7.62,17.76,17.76,0,0,0-3-.17,14.45,14.45,0,0,0-14.34,14.56,14.59,14.59,0,0,0,14.34,14.73h11.66"/><path class="cls-10" d="M671.09,214a2.11,2.11,0,0,1,3,0,2.16,2.16,0,0,1,0,3,2.13,2.13,0,0,1-3,0,2.08,2.08,0,0,1,0-3ZM673,200.81a3.3,3.3,0,1,0,4.59,0,3.31,3.31,0,0,0-4.59,0Zm11.58-4.11a5.21,5.21,0,0,0,0,7.39,5.24,5.24,0,1,0,7.41-7.42,5.22,5.22,0,0,0-7.39,0Zm-5.45,14.68a3.48,3.48,0,0,0,4.92,4.93,3.48,3.48,0,0,0-4.92-4.93Zm14-2.23a5.3,5.3,0,0,0-.15,7.51A5.42,5.42,0,0,0,700.6,209a5.3,5.3,0,0,0-7.51.15Zm-1.82-4.41,2.38,3.86m-13.77,2.29-2.69-5m6,4.93,2.64-5.76m-7.39-2.58,4.65-1m-4.77,2.9,13.5,6.57m-17.15-4.54-1.52,7m11.85.37,6.46-.35m-17.37.54,10-10.25m-5.91,10.77-3.59.48"/><polyline class="cls-2" points="153.46 201.47 153.46 175.14 116.73 175.14 116.73 217.65 141.51 217.65"/><line class="cls-2" x1="121.2" y1="180.65" x2="130.57" y2="180.65"/><line class="cls-2" x1="128.24" y1="186.09" x2="141.31" y2="186.09"/><line class="cls-2" x1="134.77" y1="191.45" x2="147.56" y2="191.45"/><line class="cls-2" x1="134.77" y1="196.5" x2="144.38" y2="196.5"/><line class="cls-2" x1="137.41" y1="201.54" x2="128.24" y2="201.54"/><line class="cls-2" x1="128.24" y1="206.34" x2="141.31" y2="206.34"/><line class="cls-2" x1="130.57" y1="211.63" x2="121.2" y2="211.63"/><text class="cls-11" transform="translate(143.02 216.79)">PY</text></svg>
#########################################
Neural Network Intelligence(NNI)文档
#########################################
********
内容
********
.. toctree::
:caption: 目录
:maxdepth: 2
:titlesonly:
概述<Overview>
入门<QuickStart>
教程<Tutorials>
样例<Examples>
参考<Reference>
常见问答<FAQ>
贡献<Contribution>
版本日志<RELEASE>
\ No newline at end of file
# MNIST 样例
在深度学习中,用 CNN 来分类 MNIST 数据,就像介绍编程语言中的 `hello world` 样例。 因此,NNI 将 MNIST 作为样例来介绍功能。 样例如下:
- [MNIST 中使用 NNI API](#mnist)
- [MNIST 中使用 NNI 标记(annotation)](#mnist-annotation)
- [在 Keras 中使用 MNIST](#mnist-keras)
- [MNIST -- 用批处理调参器来调优](#mnist-batch)
- [MNIST -- 用 hyperband 调优](#mnist-hyperband)
- [MNIST -- 用嵌套搜索空间调优](#mnist-nested)
- [用 Kubeflow 运行分布式的 MNIST (tensorflow)](#mnist-kubeflow-tf)
- [用 Kubeflow 运行分布式的 MNIST (PyTorch)](#mnist-kubeflow-pytorch)
<a name="mnist"></a>
**MNIST 中使用 NNI API**
这是个简单的卷积网络,有两个卷积层,两个池化层和一个全连接层。 调优的超参包括 dropout 比率,卷积层大小,隐藏层(全连接层)大小等等。 它能用 NNI 中大部分内置的调参器来调优,如 TPE,SMAC,Random。 样例的 YAML 文件也启用了评估器来提前终止一些中间结果不好的尝试。
`代码目录: examples/trials/mnist/`
<a name="mnist-annotation"></a>
**MNIST 中使用 NNI 标记(annotation)**
此样例与上例类似,上例使用的是 NNI API 来指定搜索空间并返回结果,而此例使用的是 NNI 标记。
`代码目录: examples/trials/mnist-annotation/`
<a name="mnist-keras"></a>
**在 Keras 中使用 MNIST**
此样例由 Keras 实现。 这也是 MNIST 数据集的网络,包括两个卷积层,一个池化层和两个全连接层。
`代码目录: examples/trials/mnist-keras/`
<a name="mnist-batch"></a>
**MNIST -- 用批处理调参器来调优**
此样例演示了如何使用批处理调参器。 只需要在搜索空间文件中列出所有要尝试的配置, NNI 会逐个尝试。
`代码目录: examples/trials/mnist-batch-tune-keras/`
<a name="mnist-hyperband"></a>
**MNIST -- 用 hyperband 调优**
此样例演示了如何使用 hyperband 来调优模型。 在尝试收到的配置中,有个主键叫做 `STEPS`,尝试要用它来控制运行多长时间(例如,控制迭代的次数)。
`代码目录: examples/trials/mnist-hyperband/`
<a name="mnist-nested"></a>
**MNIST -- 用嵌套搜索空间调优**
此样例演示了 NNI 如何支持嵌套的搜索空间。 搜索空间文件示了如何定义嵌套的搜索空间。
`代码目录: examples/trials/mnist-cascading-search-space/`
<a name="mnist-kubeflow-tf"></a>
**用 Kubeflow 运行分布式的 MNIST (tensorflow)**
此样例展示了如何通过 NNI 来在 Kubeflow 上运行分布式训练。 只需要简单的提供分布式训练代码,并在配置文件中指定 kubeflow 模式。 例如,运行 ps 和 worker 的命令行,以及各自需要的资源。 此样例使用了 Tensorflow 来实现,因而,需要使用 Kubeflow 的 tf-operator。
`代码目录: examples/trials/mnist-distributed/`
<a name="mnist-kubeflow-pytorch"></a>
**用 Kubeflow 运行分布式的 MNIST (PyTorch)**
与前面的样例类似,不同之处是此样例是 Pytorch 实现的,因而需要使用 Kubeflow 的 pytorch-operator。
`代码目录: examples/trials/mnist-distributed-pytorch/`
\ No newline at end of file
## 创建多阶段的 Experiment
通常情况下,每个 Trial 作业只从 Tuner 获得一组配置(如超参),然后运行 Experiment。也就是说,通过这组超参来训练模型,并返回结果给 Tuner。 有时候,可能需要在一个 Trial 作业中训练多个模型,并在它们之间共享信息,或者通过创建更少的 Trial 任务来节省资源。例如:
1. 在一个 Trial 作业中依次训练多个模型。这样,后面的模型可以利用先前模型的权重和其它信息,并可以使用不同的超参组合。
2. 在有限的资源上训练大量的模型,将多个模型放到一个 Trial 作业中训练,能够节约系统创建 Trial 作业的时间。
3. 还有的情况,希望在一个 Trial 任务中训练多个需要不同超参的模型。注意,如果为一个 Trial 作业分配多个 GPU,并且会并发训练模型,需要在代码中正确分配 GPU 资源。
在上述情况中,可利用 NNI 的多阶段 Experiment 来在同一个 Trial 任务中训练具有不同超参的多个模型。
多阶段 Experiment,是指 Trial 作业会从 Tuner 请求多次超参,并多次返回最终结果。
参考以下步骤来使用多阶段 Experiment:
1. 实现 nni.multi_phase.MultiPhaseTuner。 例如,[ENAS tuner](https://github.com/countif/enas_nni/blob/master/nni/examples/tuners/enas/nni_controller_ptb.py) 就是一个实现了 nni.multi_phase.MultiPhaseTuner 的 Tuner。 在实现多阶段 Tuner 时,可能要用 generate_parameters 中的 trial_job_id 参数来为每个 Trial 作业生成超参。
2. 设置 `multiPhase` 的值为 `true`,并将第一步中实现的 Tuner 作为自定义 Tuner 进行配置,例如:
```yaml
...
multiPhase: true
tuner:
codeDir: tuners/enas
classFileName: nni_controller_ptb.py
className: ENASTuner
classArgs:
say_hello: "hello"
...
```
3. 根据需要,在 Trial 代码中可多次调用 nni.get_next_parameter() API,例如:
```python
for i in range(5):
# 从 Tuner 中获得参数
tuner_param = nni.get_next_parameter()
# 使用参数
# ...
# 为上面获取的参数返回最终结果
nni.report_final_result()
# ...
```
\ No newline at end of file
sphinx==1.8.3
sphinx-argparse==0.2.5
sphinx-markdown-tables==0.0.9
sphinx-rtd-theme==0.4.2
sphinxcontrib-websupport==1.1.0
recommonmark==0.5.0
nni==0.5
\ No newline at end of file
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