Unverified Commit 346721be authored by kvartet's avatar kvartet Committed by GitHub
Browse files

Update Chinese translation (#3413)

parent b122c63d
#################
Retiarii 概览
#################
`Retiarii <https://www.usenix.org/system/files/osdi20-zhang_quanlu.pdf>`__ 是一个支持神经体系架构搜索和超参数调优的新框架。 它允许用户以高度的灵活性表达各种搜索空间,重用许多前沿搜索算法,并利用系统级优化来加速搜索过程。 该框架提供了以下全新的用户体验。
.. toctree::
:maxdepth: 2
快速入门 <Tutorial>
自定义 Trainer <WriteTrainer>
自定义 Strategy <WriteStrategy>
Retiarii APIs <ApiReference>
\ No newline at end of file
.. role:: raw-html(raw)
:format: html
更改日志 更改日志
========= ==========
发布 2.0 - 1/14/2021
-----------------------
主要更新
^^^^^^^^^^^^^
神经网络架构搜索
""""""""""""""""""""""""""
* 支持全新的 NAS 框架:Retiarii(实验性)
* 功能路线图 `issue #3301 <https://github.com/microsoft/nni/issues/3301>`__
* `相关的 issues 和 pull requests <https://github.com/microsoft/nni/issues?q=label%3Aretiarii-v2.0>`__
* 文档 (#3221 #3282 #3287)
* 支持全新的 NAS 算法:Cream (#2705)
* 为 NLP 模型搜索增加新的 NAS 基准测试 (#3140)
训练平台
""""""""""""""""
* 支持混合训练平台 (#3097 #3251 #3252)
* 支持 AdlTrainingService,一个新的基于 Kubernetes 的训练平台 (#3022,感谢外部贡献者 Petuum @pw2393)
模型压缩
"""""""""""""""""
* 为 fpgm 剪枝算法增加剪枝调度 (#3110)
* 模型加速改进:支持 torch v1.7 (更新 graph_utils.py) (#3076)
* 改进模型压缩工具:模型 flops 计数器 (#3048 #3265)
Web 界面和 nnictl
""""""""""""""""""""""""""""
* 增加实验管理 Web 界面 (#3081 #3127)
* 改进概览页布局 (#3046 #3123)
* 支持在侧边栏查看日志和配置;为表格增加扩展图标 (#3069 #3103)
其它
""""""
* 支持从 Python 代码发起 Experiment (#3111 #3210 #3263)
* 重构内置/自定义 Tuner 的安装方法 (#3134)
* 支持全新的实验配置 V2 版本 (#3138 #3248 #3251)
* 重新组织源代码目录层次结构 (#2962 #2987 #3037)
* 本地模式下取消 Trial 任务时,修改 SIGKILL 信号 为 SIGTERM 信号 (#3173)
* 重构 hyperband (#3040)
文档
^^^^^^^^^^^^^
* 将 Markdown 文档转换为 reStructuredText 文档,并引入 ``githublink`` (#3107)
* 在文档中列出相关研究工作 (#3150)
* 增加保存和加载量化模型的教程 (#3192)
* 移除 paiYarn 文档并为远程模式下的 ``reuse`` 配置添加描述 (#3253)
* 更新 EfficientNet 文档 (#3158,感谢waibu贡献者 @ahundt)
修复的 Bug
^^^^^^^^^^^^^^^^^^
* 修复 NO_MORE_TRIAL 状态下 exp-duration 停止间隔 (#3043)
* 修复 NAS SPOS Trainer 的 Bug (#3051,感谢外部贡献者 @HeekangPark)
* 修复 NAS DARTS 中 ``_compute_hessian`` 的 Bug (PyTorch 版本) (#3058,感谢外部贡献者 @hroken)
* 修复 cdarts utils 中 conv1d 的 Bug (#3073,感谢外部贡献者 @athaker)
* 修复恢复实验时对于未知 Trial 处理办法 (#3096)
* 修复 Windows 下的 kill 命令 (#3106)
* 修复懒惰日志问题 (#3108,感谢外部贡献者 @HarshCasper)
* 修复 QAT Quantizer 中加载和保存检查点的问题 (#3124,感谢外部贡献者 @eedalong)
* 修复量化 grad 函数计算失误 (#3160,感谢外部贡献者 @eedalong)
* 修复量化算法中设备分配的 Bug (#3212,感谢外部贡献者 @eedalong)
* 修复模型加速中的 Bug,并加强了 UT (#3279)
* 和其他的 Bug (#3063 #3065 #3098 #3109 #3125 #3143 #3156 #3168 #3175 #3180 #3181 #3183 #3203 #3205 #3207 #3214 #3216 #3219 #3223 #3224 #3230 #3237 #3239 #3240 #3245 #3247 #3255 #3257 #3258 #3262 #3263 #3267 #3269 #3271 #3279 #3283 #3289 #3290 #3295)
发布 1.9 - 10/22/2020 发布 1.9 - 10/22/2020
======================== ------------------------
主要更新 主要更新
------------- ^^^^^^^^^^^^^
神经网络架构搜索 神经网络架构搜索
^^^^^^^^^^^^^^^^^^^^^^^^^^ """"""""""""""""""""""""""
* 在 NAS 中增加 regularized evolution 算法 (#2802) * 在 NAS 中增加 regularized evolution 算法 (#2802)
* 在搜索空间集合中增加 NASBench201 (#2766) * 在搜索空间集合中增加 NASBench201 (#2766)
模型压缩 模型压缩
^^^^^^^^^^^^^^^^^ """""""""""""""""
* AMC Pruner 改进:支持 resnet,复现 AMC 论文中的实验(示例代码使用默认参数) (#2876 #2906) * AMC Pruner 改进:支持 resnet,复现 AMC 论文中的实验(示例代码使用默认参数) (#2876 #2906)
...@@ -25,7 +108,7 @@ ...@@ -25,7 +108,7 @@
* 在 QAT quantizer 中增加量化的偏置 (#2914) * 在 QAT quantizer 中增加量化的偏置 (#2914)
训练平台 训练平台
^^^^^^^^^^^^^^^^ """"""""""""""""
* 支持在远程模式中使用 "preCommand" 配置 Python 环境 (#2875) * 支持在远程模式中使用 "preCommand" 配置 Python 环境 (#2875)
...@@ -33,7 +116,7 @@ ...@@ -33,7 +116,7 @@
* 为远程训练平台添加 reuse 模式 (#2923) * 为远程训练平台添加 reuse 模式 (#2923)
Web 界面和 nnictl Web 界面和 nnictl
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ """"""""""""""""""""""""""""
* 重新设计 Web 界面的 "Overview" 页面 (#2914) * 重新设计 Web 界面的 "Overview" 页面 (#2914)
...@@ -43,7 +126,7 @@ Web 界面和 nnictl ...@@ -43,7 +126,7 @@ Web 界面和 nnictl
* 支持使用 nnictl 命令自动补全 (#2857) * 支持使用 nnictl 命令自动补全 (#2857)
UT & IT UT & IT
------- ^^^^^^^
* 为 Experiment 导入导出数据增加集成测试 (#2878) * 为 Experiment 导入导出数据增加集成测试 (#2878)
...@@ -51,13 +134,13 @@ UT & IT ...@@ -51,13 +134,13 @@ UT & IT
* 为 nnictl 增加单元测试 (#2912) * 为 nnictl 增加单元测试 (#2912)
文档 文档
------------- ^^^^^^^^^^^^^
* 重构了模型压缩的文档结构 (#2919) * 重构了模型压缩的文档结构 (#2919)
修复的 Bug 修复的 Bug
-------------------- ^^^^^^^^^^^^^^^^^^
* 修复正确使用 naïve evolution Tuner,Trial 失败的 Bug (#2695) * 修复正确使用 naïve evolution Tuner,Trial 失败的 Bug (#2695)
...@@ -68,13 +151,13 @@ UT & IT ...@@ -68,13 +151,13 @@ UT & IT
* 在 Web 界面上自定义 Trial 时,支持为类型是 "choice" 的超参数配置布尔值 (#3003) * 在 Web 界面上自定义 Trial 时,支持为类型是 "choice" 的超参数配置布尔值 (#3003)
发布 1.8 - 8/27/2020 发布 1.8 - 8/27/2020
======================= -----------------------
主要更新 主要更新
------------- ^^^^^^^^^^^^^
训练平台 训练平台
^^^^^^^^^^^^^^^^ """"""""""""""""
* 在 Web 界面直接访问 Trial 日志 (仅支持本地模式) (#2718) * 在 Web 界面直接访问 Trial 日志 (仅支持本地模式) (#2718)
...@@ -85,7 +168,7 @@ UT & IT ...@@ -85,7 +168,7 @@ UT & IT
* 为在 OpenPAI 模式复制数据增加更多日志信息 (#2702) * 为在 OpenPAI 模式复制数据增加更多日志信息 (#2702)
Web 界面,nnictl 和 nnicli Web 界面,nnictl 和 nnicli
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ """"""""""""""""""""""""""""""""""""""""""""""""
* 改进超参数并行坐标图的绘制 (#2691) (#2759) * 改进超参数并行坐标图的绘制 (#2691) (#2759)
...@@ -98,44 +181,44 @@ Web 界面,nnictl 和 nnicli ...@@ -98,44 +181,44 @@ Web 界面,nnictl 和 nnicli
* 提升了 `nnicli <https://github.com/microsoft/nni/blob/v1.8/docs/zh_CN/nnicli_ref.rst>`__ 的用户体验,并附上 `示例 <https://github.com/microsoft/nni/blob/v1.8/examples/notebooks/retrieve_nni_info_with_python.ipynb>`__ (#2713) * 提升了 `nnicli <https://github.com/microsoft/nni/blob/v1.8/docs/zh_CN/nnicli_ref.rst>`__ 的用户体验,并附上 `示例 <https://github.com/microsoft/nni/blob/v1.8/examples/notebooks/retrieve_nni_info_with_python.ipynb>`__ (#2713)
神经网络架构搜索 神经网络架构搜索
^^^^^^^^^^^^^^^^^^^^^^^^^^ """"""""""""""""""""""""""
* `搜索空间集合:ENAS and DARTS <https://github.com/microsoft/nni/blob/v1.8/docs/zh_CN/NAS/SearchSpaceZoo.rst>`__ (#2589) * `搜索空间集合:ENAS DARTS <https://github.com/microsoft/nni/blob/v1.8/docs/zh_CN/NAS/SearchSpaceZoo.rst>`__ (#2589)
* 用于在 NAS 基准测试中查询中间结果的 API (#2728) * 用于在 NAS 基准测试中查询中间结果的 API (#2728)
模型压缩 模型压缩
^^^^^^^^^^^^^^^^^ """""""""""""""""
* 支持 TorchModuleGraph 的 List/Tuple Construct/Unpack 操作 (#2609) * 支持 TorchModuleGraph 的 List/Tuple Construct/Unpack 操作 (#2609)
* 模型加速改进: 支持 DenseNet 和 InceptionV3 (#2719) * 模型加速改进: 支持 DenseNet 和 InceptionV3 (#2719)
* 支持多个连续 tuple 的 unpack 操作 (#2768) * 支持多个连续 tuple 的 unpack 操作 (#2768)
* `比较支持的 Pruner 的表现的文档 <https://github.com/microsoft/nni/blob/v1.8/docs/zh_CN/CommunitySharings/ModelCompressionComparison.rst>`__ (#2742) * `比较支持的 Pruner 的表现的文档 <https://github.com/microsoft/nni/blob/v1.8/docs/zh_CN/CommunitySharings/ModelCompressionComparison.rst>`__ (#2742)
* 新的 Pruner:`Sensitivity pruner <https://github.com/microsoft/nni/blob/v1.8/docs/zh_CN/Compressor/Pruner.md#sensitivity-pruner>`__ (#2684) and `AMC pruner <https://github.com/microsoft/nni/blob/v1.8/docs/zh_CN/Compressor/Pruner.rst>`__ (#2573) (#2786) * 新的 Pruner:`Sensitivity pruner <https://github.com/microsoft/nni/blob/v1.8/docs/zh_CN/Compressor/Pruner.md#sensitivity-pruner>`__ (#2684) and `AMC pruner <https://github.com/microsoft/nni/blob/v1.8/docs/zh_CN/Compressor/Pruner.md>`__ (#2573) (#2786)
* 支持 TensorFlow v2 的模型压缩 (#2755) * 支持 TensorFlow v2 的模型压缩 (#2755)
不兼容的改动 不兼容的改动
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ """""""""""""""""""""""""""""
* 默认 Experiment 目录从 ``$HOME/nni/experiments`` 更新至 ``$HOME/nni-experiments``。 如果希望查看通过之前的 NNI 版本创建的 Experiment,可以将这些 Experiment 目录从 ``$HOME/nni/experiments`` 手动移动至 ``$HOME/nni-experiments``。 (#2686) (#2753) * 默认 Experiment 目录从 ``$HOME/nni/experiments`` 更新至 ``$HOME/nni-experiments``。 如果希望查看通过之前的 NNI 版本创建的 Experiment,可以将这些 Experiment 目录从 ``$HOME/nni/experiments`` 手动移动至 ``$HOME/nni-experiments``。 (#2686) (#2753)
* 不再支持 Python 3.5 和 scikit-learn 0.20 (#2778) (#2777) (2783) (#2787) (#2788) (#2790) * 不再支持 Python 3.5 和 scikit-learn 0.20 (#2778) (#2777) (2783) (#2787) (#2788) (#2790)
其它 其它
^^^^^^ """"""
* 更新 Docker 镜像中的 Tensorflow 版本 (#2732) (#2735) (#2720) * 更新 Docker 镜像中的 Tensorflow 版本 (#2732) (#2735) (#2720)
示例 示例
-------- ^^^^^^^^
* 在 Assessor 示例中移除 gpuNum (#2641) * 在 Assessor 示例中移除 gpuNum (#2641)
文档 文档
------------- ^^^^^^^^^^^^^
* 改进自定义 Tuner 的文档 (#2628) * 改进自定义 Tuner 的文档 (#2628)
...@@ -148,7 +231,7 @@ Web 界面,nnictl 和 nnicli ...@@ -148,7 +231,7 @@ Web 界面,nnictl 和 nnicli
* 改进模型压缩的文档结构 (#2676) * 改进模型压缩的文档结构 (#2676)
修复的 Bug 修复的 Bug
---------------------- ^^^^^^^^^^^^^^^^^^
* 修复训练平台的目录生成错误 (#2673) * 修复训练平台的目录生成错误 (#2673)
...@@ -164,56 +247,56 @@ Web 界面,nnictl 和 nnicli ...@@ -164,56 +247,56 @@ Web 界面,nnictl 和 nnicli
* 修复 nnictl experiment delete (#2791) * 修复 nnictl experiment delete (#2791)
发布 1.7 - 7/8/2020 发布 1.7 - 7/8/2020
====================== ----------------------
主要功能 主要功能
-------------- ^^^^^^^^^^^^^^
训练平台 训练平台
^^^^^^^^^^^^^^^^ """"""""""""""""
* 支持 AML (Azure Machine Learning) 作为训练平台。 * 支持 AML (Azure Machine Learning) 作为训练平台。
* OpenPAI 任务可被重用。 当 Trial 完成时, OpenPAI 任务不会停止, 而是等待下一个 Trial。 改进 `新的 OpenPAI 模式的文档 <https://github.com/microsoft/nni/blob/v1.7/docs/zh_CN/TrainingService/PaiMode.rst#openpai-configurations>`__. * OpenPAI 任务可被重用。 当 Trial 完成时, OpenPAI 任务不会停止, 而是等待下一个 Trial。 改进 `新的 OpenPAI 模式的文档 <https://github.com/microsoft/nni/blob/v1.7/docs/zh_CN/TrainingService/PaiMode.md#openpai-configurations>`__.
* `支持在向训练平台上传代码目录时使用 .nniignore 忽略代码目录中的文件和目录 <https://github.com/microsoft/nni/blob/v1.7/docs/zh_CN/TrainingService/Overview.rst#how-to-use-training-service>`__. * `支持在向训练平台上传代码目录时使用 .nniignore 忽略代码目录中的文件和目录 <https://github.com/microsoft/nni/blob/v1.7/docs/zh_CN/TrainingService/Overview.md#how-to-use-training-service>`__.
神经网络架构搜索(NAS) 神经网络架构搜索(NAS)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ """"""""""""""""""""""""""""""""
* *
`为 NAS 基准测试 (NasBench101, NasBench201, NDS) 提供了友好的 API <https://github.com/microsoft/nni/blob/v1.7/docs/zh_CN/NAS/Benchmarks.rst>`__。 `为 NAS 基准测试 (NasBench101, NasBench201, NDS) 提供了友好的 API <https://github.com/microsoft/nni/blob/v1.7/docs/zh_CN/NAS/Benchmarks.md>`__。
* *
`在 TensorFlow 2.X 支持 Classic NAS(即非权重共享模式) <https://github.com/microsoft/nni/blob/v1.7/docs/zh_CN/NAS/ClassicNas.rst>`__。 `在 TensorFlow 2.X 支持 Classic NAS(即非权重共享模式) <https://github.com/microsoft/nni/blob/v1.7/docs/zh_CN/NAS/ClassicNas.md>`__。
模型压缩 模型压缩
^^^^^^^^^^^^^^^^^ """""""""""""""""
* 改进模型加速:跟踪层之间的更多依赖关系,自动解决掩码冲突,支持剪枝 ResNet 的加速 * 改进模型加速:跟踪层之间的更多依赖关系,自动解决掩码冲突,支持剪枝 ResNet 的加速
* 增加新的 Pruner,包括三个模型剪枝算法: `NetAdapt Pruner <https://github.com/microsoft/nni/blob/v1.7/docs/zh_CN/Compressor/Pruner.md#netadapt-pruner>`__\ , `SimulatedAnnealing Pruner <https://github.com/microsoft/nni/blob/v1.7/docs/zh_CN/Compressor/Pruner.md#simulatedannealing-pruner>`__\ , `AutoCompress Pruner <https://github.com/microsoft/nni/blob/v1.7/docs/zh_CN/Compressor/Pruner.md#autocompress-pruner>`__\ , and `ADMM Pruner <https://github.com/microsoft/nni/blob/v1.7/docs/zh_CN/Compressor/Pruner.rst#admm-pruner>`__. * 增加新的 Pruner,包括三个模型剪枝算法: `NetAdapt Pruner <https://github.com/microsoft/nni/blob/v1.7/docs/zh_CN/Compressor/Pruner.md#netadapt-pruner>`__\ , `SimulatedAnnealing Pruner <https://github.com/microsoft/nni/blob/v1.7/docs/zh_CN/Compressor/Pruner.md#simulatedannealing-pruner>`__\ , `AutoCompress Pruner <https://github.com/microsoft/nni/blob/v1.7/docs/zh_CN/Compressor/Pruner.md#autocompress-pruner>`__\ , and `ADMM Pruner <https://github.com/microsoft/nni/blob/v1.7/docs/zh_CN/Compressor/Pruner.md#admm-pruner>`__.
* 增加 `模型灵敏度分析工具 <https://github.com/microsoft/nni/blob/v1.7/docs/zh_CN/Compressor/CompressionUtils.rst>`__ 来帮助用户发现各层对剪枝的敏感性。 * 增加 `模型灵敏度分析工具 <https://github.com/microsoft/nni/blob/v1.7/docs/zh_CN/Compressor/CompressionUtils.md>`__ 来帮助用户发现各层对剪枝的敏感性。
* *
`用于模型压缩和 NAS 的简易 FLOPs 计算工具 <https://github.com/microsoft/nni/blob/v1.7/docs/zh_CN/Compressor/CompressionUtils.rst#model-flops-parameters-counter>`__. `用于模型压缩和 NAS 的简易 FLOPs 计算工具 <https://github.com/microsoft/nni/blob/v1.7/docs/zh_CN/Compressor/CompressionUtils.md#model-flops-parameters-counter>`__.
* *
更新 Lottery Ticket Pruner 以导出中奖彩票 更新 Lottery Ticket Pruner 以导出中奖彩票
示例 示例
^^^^^^^^ """"""""
* 在 NNI 上使用新的 `自定义 Tuner OpEvo <https://github.com/microsoft/nni/blob/v1.7/docs/zh_CN/TrialExample/OpEvoExamples.rst>`__ 自动优化张量算子。 * 在 NNI 上使用新的 `自定义 Tuner OpEvo <https://github.com/microsoft/nni/blob/v1.7/docs/zh_CN/TrialExample/OpEvoExamples.md>`__ 自动优化张量算子。
内置 Tuner、Assessor、Advisor 内置 Tuner、Assessor、Advisor
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ """"""""""""""""""""""""""""""""""
* `允许自定义 Tuner、Assessor、Advisor 被安装为内置算法 <https://github.com/microsoft/nni/blob/v1.7/docs/zh_CN/Tutorial/InstallCustomizedAlgos.rst>`__. * `允许自定义 Tuner、Assessor、Advisor 被安装为内置算法 <https://github.com/microsoft/nni/blob/v1.7/docs/zh_CN/Tutorial/InstallCustomizedAlgos.md>`__.
Web 界面 Web 界面
^^^^^^^^^^^^^^ """"""""""
* 支持更友好的嵌套搜索空间可视化。 * 支持更友好的嵌套搜索空间可视化。
...@@ -221,24 +304,24 @@ Web 界面 ...@@ -221,24 +304,24 @@ Web 界面
* 增强 Trial 持续时间展示 * 增强 Trial 持续时间展示
其它 其它
^^^^^^ """"""
* 提供工具函数用于合并从 NNI 获取到的参数 * 提供工具函数用于合并从 NNI 获取到的参数
* 支持在 OpenPAI 模式中设置 paiStorageConfigName * 支持在 OpenPAI 模式中设置 paiStorageConfigName
文档 文档
------------- ^^^^^^^^^^^^^
* 改进 `模型压缩文档 <https://github.com/microsoft/nni/blob/v1.7/docs/zh_CN/Compressor/Overview.rst>`__ * 改进 `模型压缩文档 <https://github.com/microsoft/nni/blob/v1.7/docs/zh_CN/Compressor/Overview.md>`__
* 改进 `NAS 基准测试的文档 <https://github.com/microsoft/nni/blob/v1.7/docs/zh_CN/NAS/Benchmarks.rst>`__ * 改进 `NAS 基准测试的文档 <https://github.com/microsoft/nni/blob/v1.7/docs/zh_CN/NAS/Benchmarks.md>`__
和 `示例 <https://github.com/microsoft/nni/blob/v1.7/docs/zh_CN/NAS/BenchmarksExample.ipynb>`__ 。 和 `示例 <https://github.com/microsoft/nni/blob/v1.7/docs/zh_CN/NAS/BenchmarksExample.ipynb>`__ 。
* 改进 `AzureML 训练平台的文档 <https://github.com/microsoft/nni/blob/v1.7/docs/zh_CN/TrainingService/AMLMode.rst>`__ * 改进 `AzureML 训练平台的文档 <https://github.com/microsoft/nni/blob/v1.7/docs/zh_CN/TrainingService/AMLMode.md>`__
* 主页迁移到 readthedoc。 * 主页迁移到 readthedoc。
修复的 Bug 修复的 Bug
------------------ ^^^^^^^^^^^^^^^^^^
* 修复模型图中含有共享的 nn.Module 时的问题 * 修复模型图中含有共享的 nn.Module 时的问题
...@@ -263,7 +346,7 @@ Web 界面 ...@@ -263,7 +346,7 @@ Web 界面
* 支持 Windows 下开发模式安装 * 支持 Windows 下开发模式安装
Web 界面 Web 界面
^^^^^^^^^^^^^^^ ^^^^^^^^^^^^
* 显示 Trial 的错误消息 * 显示 Trial 的错误消息
...@@ -274,7 +357,7 @@ Web 界面 ...@@ -274,7 +357,7 @@ Web 界面
* 在超参图中显示最好的 Trial * 在超参图中显示最好的 Trial
超参优化更新 超参优化更新
^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^
* 改进 PBT 的错误处理,并支持恢复 Experiment * 改进 PBT 的错误处理,并支持恢复 Experiment
...@@ -299,11 +382,11 @@ NAS 更新 ...@@ -299,11 +382,11 @@ NAS 更新
* 改进 OpenPAI YAML 的合并逻辑 * 改进 OpenPAI YAML 的合并逻辑
* 支持 Windows 在远程模式中作为远程机器 `远程模式 <https://github.com/microsoft/nni/blob/v1.6/docs/zh_CN/TrainingService/RemoteMachineMode.rst#windows>`__ * 支持 Windows 在远程模式中作为远程机器 `远程模式 <https://github.com/microsoft/nni/blob/v1.6/docs/zh_CN/TrainingService/RemoteMachineMode.md#windows>`__
修复的 Bug 修复的 Bug
^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^
* 修复开发模式安装 * 修复开发模式安装
...@@ -321,32 +404,32 @@ NAS 更新 ...@@ -321,32 +404,32 @@ NAS 更新
^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^
* 全新 Tuner: `Population Based Training (PBT) <https://github.com/microsoft/nni/blob/v1.5/docs/zh_CN/Tuner/PBTTuner.rst>`__ * 全新 Tuner: `Population Based Training (PBT) <https://github.com/microsoft/nni/blob/v1.5/docs/zh_CN/Tuner/PBTTuner.md>`__
* Trial 现在可以返回无穷大和 NaN 结果 * Trial 现在可以返回无穷大和 NaN 结果
神经网络架构搜索 神经网络架构搜索
^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^
* 全新 NAS 算法:`TextNAS <https://github.com/microsoft/nni/blob/v1.5/docs/zh_CN/NAS/TextNAS.rst>`__ * 全新 NAS 算法:`TextNAS <https://github.com/microsoft/nni/blob/v1.5/docs/zh_CN/NAS/TextNAS.md>`__
* 在 Web 界面 支持 ENAS 和 DARTS的 `可视化 <https://github.com/microsoft/nni/blob/v1.5/docs/zh_CN/NAS/Visualization.rst>`__ * 在 Web 界面 支持 ENAS 和 DARTS的 `可视化 <https://github.com/microsoft/nni/blob/v1.5/docs/zh_CN/NAS/Visualization.md>`__
模型压缩 模型压缩
^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^
* 全新 Pruner: `GradientRankFilterPruner <https://github.com/microsoft/nni/blob/v1.5/docs/zh_CN/Compressor/Pruner.rst#gradientrankfilterpruner>`__ * 全新 Pruner: `GradientRankFilterPruner <https://github.com/microsoft/nni/blob/v1.5/docs/zh_CN/Compressor/Pruner.md#gradientrankfilterpruner>`__
* 默认情况下,Compressor 会验证配置 * 默认情况下,Compressor 会验证配置
* 重构:可将优化器作为 Pruner 的输入参数,从而更容易支持 DataParallel 和其它迭代剪枝方法。 这是迭代剪枝算法用法上的重大改动。 * 重构:可将优化器作为 Pruner 的输入参数,从而更容易支持 DataParallel 和其它迭代剪枝方法。 这是迭代剪枝算法用法上的重大改动。
* 重构了模型压缩示例 * 重构了模型压缩示例
* 改进 `模型压缩算法 <https://github.com/microsoft/nni/blob/v1.5/docs/zh_CN/Compressor/Framework.rst>`__ * 改进 `模型压缩算法 <https://github.com/microsoft/nni/blob/v1.5/docs/zh_CN/Compressor/Framework.md>`__
训练平台 训练平台
^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^
* Kubeflow 现已支持 pytorchjob crd v1 (感谢贡献者 @jiapinai) * Kubeflow 现已支持 pytorchjob crd v1 (感谢贡献者 @jiapinai)
* 实验性地支持 `DLTS <https://github.com/microsoft/nni/blob/v1.5/docs/zh_CN/TrainingService/DLTSMode.rst>`__ * 实验性地支持 `DLTS <https://github.com/microsoft/nni/blob/v1.5/docs/zh_CN/TrainingService/DLTSMode.md>`__
文档的整体改进 文档的整体改进
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...@@ -355,7 +438,7 @@ NAS 更新 ...@@ -355,7 +438,7 @@ NAS 更新
* 语法、拼写以及措辞上的修改 (感谢贡献者 @AHartNtkn) * 语法、拼写以及措辞上的修改 (感谢贡献者 @AHartNtkn)
修复的 Bug 修复的 Bug
^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^
* ENAS 不能使用多个 LSTM 层 (感谢贡献者 @marsggbo) * ENAS 不能使用多个 LSTM 层 (感谢贡献者 @marsggbo)
...@@ -377,8 +460,8 @@ NAS 更新 ...@@ -377,8 +460,8 @@ NAS 更新
^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^
* 支持 `C-DARTS <https://github.com/microsoft/nni/blob/v1.4/docs/zh_CN/NAS/CDARTS.rst>`__ 算法并增加 `the 示例 <https://github.com/microsoft/nni/tree/v1.4/examples/nas/cdarts>`__ using it * 支持 `C-DARTS <https://github.com/microsoft/nni/blob/v1.4/docs/zh_CN/NAS/CDARTS.md>`__ 算法并增加 `the 示例 <https://github.com/microsoft/nni/tree/v1.4/examples/nas/cdarts>`__ using it
* 初步支持 `ProxylessNAS <https://github.com/microsoft/nni/blob/v1.4/docs/zh_CN/NAS/Proxylessnas.rst>`__ 并增加 `示例 <https://github.com/microsoft/nni/tree/v1.4/examples/nas/proxylessnas>`__ * 初步支持 `ProxylessNAS <https://github.com/microsoft/nni/blob/v1.4/docs/zh_CN/NAS/Proxylessnas.md>`__ 并增加 `示例 <https://github.com/microsoft/nni/tree/v1.4/examples/nas/proxylessnas>`__
* 为 NAS 框架增加单元测试 * 为 NAS 框架增加单元测试
模型压缩 模型压缩
...@@ -386,7 +469,7 @@ NAS 更新 ...@@ -386,7 +469,7 @@ NAS 更新
* 为压缩模型增加 DataParallel,并提供 `示例 <https://github.com/microsoft/nni/blob/v1.4/examples/model_compress/multi_gpu.py>`__ * 为压缩模型增加 DataParallel,并提供 `示例 <https://github.com/microsoft/nni/blob/v1.4/examples/model_compress/multi_gpu.py>`__
* 支持模型压缩的 `加速 <https://github.com/microsoft/nni/blob/v1.4/docs/zh_CN/Compressor/ModelSpeedup.rst>`__ (试用版) * 支持模型压缩的 `加速 <https://github.com/microsoft/nni/blob/v1.4/docs/zh_CN/Compressor/ModelSpeedup.md>`__ (试用版)
训练平台 训练平台
^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^
...@@ -397,7 +480,7 @@ NAS 更新 ...@@ -397,7 +480,7 @@ NAS 更新
* 支持删除远程模式下使用 sshkey 的 Experiment (感谢外部贡献者 @tyusr) * 支持删除远程模式下使用 sshkey 的 Experiment (感谢外部贡献者 @tyusr)
Web 界面 Web 界面
^^^^^^^^^^^^ ^^^^^^^^^^
* Web 界面重构:采用 fabric 框架 * Web 界面重构:采用 fabric 框架
...@@ -415,13 +498,13 @@ Web 界面 ...@@ -415,13 +498,13 @@ Web 界面
* 改进 NNI readthedocs 的 `索引目录结果 <https://nni.readthedocs.io/zh/latest/>`__ of NNI readthedocs * 改进 NNI readthedocs 的 `索引目录结果 <https://nni.readthedocs.io/zh/latest/>`__ of NNI readthedocs
* 改进 `NAS 文档 <https://github.com/microsoft/nni/blob/v1.4/docs/zh_CN/NAS/NasGuide.rst>`__ * 改进 `NAS 文档 <https://github.com/microsoft/nni/blob/v1.4/docs/zh_CN/NAS/NasGuide.md>`__
* 增加 `PAI 模式的文档 <https://github.com/microsoft/nni/blob/v1.4/docs/zh_CN/TrainingService/PaiMode.rst>`__ * 增加 `PAI 模式的文档 <https://github.com/microsoft/nni/blob/v1.4/docs/zh_CN/TrainingService/PaiMode.md>`__
* 为 `NAS <https://github.com/microsoft/nni/blob/v1.4/docs/zh_CN/NAS/QuickStart.md>`__ 和 `模型压缩 <https://github.com/microsoft/nni/blob/v1.4/docs/zh_CN/Compressor/QuickStart.md>`__ 增加快速入门指南 * 为 `NAS <https://github.com/microsoft/nni/blob/v1.4/docs/zh_CN/NAS/QuickStart.md>`__ 和 `模型压缩 <https://github.com/microsoft/nni/blob/v1.4/docs/zh_CN/Compressor/QuickStart.md>`__ 增加快速入门指南
* 改进 `EfficientNet 的文档 <https://github.com/microsoft/nni/blob/v1.4/docs/zh_CN/TrialExample/EfficientNet.rst>`__ * 改进 `EfficientNet 的文档 <https://github.com/microsoft/nni/blob/v1.4/docs/zh_CN/TrialExample/EfficientNet.md>`__
修复的 Bug 修复的 Bug
^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^
* 修复在指标数据和 JSON 格式中对 NaN 的支持 * 修复在指标数据和 JSON 格式中对 NaN 的支持
...@@ -445,15 +528,18 @@ Web 界面 ...@@ -445,15 +528,18 @@ Web 界面
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
* 增加 `知识蒸馏 <https://github.com/microsoft/nni/blob/v1.3/docs/zh_CN/TrialExample/KDExample.rst>`__ 算法和示例 * 增加 `知识蒸馏 <https://github.com/microsoft/nni/blob/v1.3/docs/zh_CN/TrialExample/KDExample.md>`__ 算法和示例
* Pruners * Pruners
* `L2Filter Pruner <https://github.com/microsoft/nni/blob/v1.3/docs/zh_CN/Compressor/Pruner.rst#3-l2filter-pruner>`__ * `L2Filter Pruner <https://github.com/microsoft/nni/blob/v1.3/docs/zh_CN/Compressor/Pruner.md#3-l2filter-pruner>`__
* `ActivationAPoZRankFilterPruner <https://github.com/microsoft/nni/blob/v1.3/docs/zh_CN/Compressor/Pruner.md#1-activationapozrankfilterpruner>`__ * `ActivationAPoZRankFilterPruner <https://github.com/microsoft/nni/blob/v1.3/docs/zh_CN/Compressor/Pruner.md#1-activationapozrankfilterpruner>`__
* `ActivationMeanRankFilterPruner <https://github.com/microsoft/nni/blob/v1.3/docs/zh_CN/Compressor/Pruner.md#2-activationmeanrankfilterpruner>`__ * `ActivationMeanRankFilterPruner <https://github.com/microsoft/nni/blob/v1.3/docs/zh_CN/Compressor/Pruner.md#2-activationmeanrankfilterpruner>`__
* `BNN Quantizer <https://github.com/microsoft/nni/blob/v1.3/docs/zh_CN/Compressor/Quantizer.md#bnn-quantizer>`__ * `BNN Quantizer <https://github.com/microsoft/nni/blob/v1.3/docs/zh_CN/Compressor/Quantizer.md#bnn-quantizer>`__
训练平台
训练平台
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
* *
OpenPAI 的 NFS 支持 OpenPAI 的 NFS 支持
...@@ -471,7 +557,7 @@ Web 界面 ...@@ -471,7 +557,7 @@ Web 界面
* 启用 `ESLint <https://eslint.org/>`__ 静态代码分析 * 启用 `ESLint <https://eslint.org/>`__ 静态代码分析
小改动和 Bug 修复 小改动和 Bug 修复
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
* 正确识别内置 Tuner 和定制 Tuner * 正确识别内置 Tuner 和定制 Tuner
...@@ -487,16 +573,16 @@ Web 界面 ...@@ -487,16 +573,16 @@ Web 界面
^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^
* `特征工程 <https://github.com/microsoft/nni/blob/v1.2/docs/zh_CN/FeatureEngineering/Overview.rst>`__ * `特征工程 <https://github.com/microsoft/nni/blob/v1.2/docs/zh_CN/FeatureEngineering/Overview.md>`__
* 新增特征工程接口 * 新增特征工程接口
* 新增特征选择算法:`Gradient feature selector <https://github.com/microsoft/nni/blob/v1.2/docs/zh_CN/FeatureEngineering/GradientFeatureSelector.md>`__ & `GBDT selector <https://github.com/microsoft/nni/blob/v1.2/docs/zh_CN/FeatureEngineering/GBDTSelector.md>`__ * 新增特征选择算法:`Gradient feature selector <https://github.com/microsoft/nni/blob/v1.2/docs/zh_CN/FeatureEngineering/GradientFeatureSelector.md>`__ `GBDT selector <https://github.com/microsoft/nni/blob/v1.2/docs/zh_CN/FeatureEngineering/GBDTSelector.md>`__
* `特征工程示例 <https://github.com/microsoft/nni/tree/v1.2/examples/feature_engineering>`__ * `特征工程示例 <https://github.com/microsoft/nni/tree/v1.2/examples/feature_engineering>`__
* 神经网络结构搜索在 NNI 上的应用 * 神经网络结构搜索在 NNI 上的应用
* `全新 NAS 接口 <https://github.com/microsoft/nni/blob/v1.2/docs/zh_CN/NAS/NasInterface.md>`__ * `全新 NAS 接口 <https://github.com/microsoft/nni/blob/v1.2/docs/zh_CN/NAS/NasInterface.md>`__
* NAS 算法:`ENAS <https://github.com/microsoft/nni/blob/v1.2/docs/zh_CN/NAS/Overview.md#enas>`__\ , `DARTS <https://github.com/microsoft/nni/blob/v1.2/docs/zh_CN/NAS/Overview.md#darts>`__\ , `P-DARTS <https://github.com/microsoft/nni/blob/v1.2/docs/zh_CN/NAS/Overview.rst#p-darts>`__ (PyTorch) * NAS 算法:`ENAS <https://github.com/microsoft/nni/blob/v1.2/docs/zh_CN/NAS/Overview.md#enas>`__\ , `DARTS <https://github.com/microsoft/nni/blob/v1.2/docs/zh_CN/NAS/Overview.md#darts>`__\ , `P-DARTS <https://github.com/microsoft/nni/blob/v1.2/docs/zh_CN/NAS/Overview.md#p-darts>`__ (PyTorch)
* 经典模式下的 NAS(每次 Trial 独立运行) * 经典模式下的 NAS(每次 Trial 独立运行)
* 模型压缩 * 模型压缩
...@@ -529,7 +615,7 @@ Web 界面 ...@@ -529,7 +615,7 @@ Web 界面
* 改进了 NNI API 文档,增加了更多的 docstring。 * 改进了 NNI API 文档,增加了更多的 docstring。
Bug 修复 Bug 修复
^^^^^^^^^^^^^ ^^^^^^^^^^^^^^
* 修复当失败的 Trial 没有指标时,表格的排序问题。 -Issue #1773 * 修复当失败的 Trial 没有指标时,表格的排序问题。 -Issue #1773
...@@ -555,12 +641,12 @@ Bug 修复 ...@@ -555,12 +641,12 @@ Bug 修复
* 更多示例 * 更多示例
* `EfficientNet PyTorch 示例 <https://github.com/ultmaster/EfficientNet-PyTorch>`__ * `EfficientNet PyTorch 示例 <https://github.com/ultmaster/EfficientNet-PyTorch>`__
* `Cifar10 NAS 示例 <https://github.com/microsoft/nni/blob/v1.1/examples/trials/nas_cifar10/README.rst>`__ * `Cifar10 NAS 示例 <https://github.com/microsoft/nni/blob/v1.1/examples/trials/nas_cifar10/README.md>`__
* `模型压缩工具包 - Alpha 阶段 <https://github.com/microsoft/nni/blob/v1.1/docs/zh_CN/Compressor/Overview.md>`__:我们很高兴的宣布 NNI 的模型压缩工具包发布了。它还处于试验阶段,会根据使用反馈来改进。 诚挚邀请您使用、反馈,或更多贡献 * `模型压缩工具包 - Alpha 阶段 <https://github.com/microsoft/nni/blob/v1.1/docs/zh_CN/Compressor/Overview.md>`__:我们很高兴的宣布 NNI 的模型压缩工具包发布了。它还处于试验阶段,会根据使用反馈来改进。 诚挚邀请您使用、反馈,或更多贡献
修复的 Bug 修复的 Bug
^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^
* 当搜索空间结束后,多阶段任务会死锁 (issue #1204) * 当搜索空间结束后,多阶段任务会死锁 (issue #1204)
...@@ -581,7 +667,7 @@ Bug 修复 ...@@ -581,7 +667,7 @@ Bug 修复
* 提供自动特征接口 * 提供自动特征接口
* 基于 Beam 搜索的 Tuner * 基于 Beam 搜索的 Tuner
* `增加 Pakdd 示例 <https://github.com/microsoft/nni/tree/v1.9/examples/trials/auto-feature-engineering>`__ * `增加 Pakdd 示例<https://github.com/microsoft/nni/tree/v1.0/examples/trials/auto-feature-engineering>`__
* 添加并行算法提高 TPE 在高并发下的性能。 -PR #1052 * 添加并行算法提高 TPE 在高并发下的性能。 -PR #1052
* 为 hyperband 支持多阶段 -PR #1257 * 为 hyperband 支持多阶段 -PR #1257
...@@ -630,7 +716,7 @@ Bug 修复 ...@@ -630,7 +716,7 @@ Bug 修复
* `改进 WebUI 描述 <Tutorial/WebUI.rst>`__ -PR #1419 * `改进 WebUI 描述 <Tutorial/WebUI.rst>`__ -PR #1419
Bug 修复 Bug 修复
^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^
* (Bug 修复)修复 0.9 版本中的链接 -Issue #1236 * (Bug 修复)修复 0.9 版本中的链接 -Issue #1236
...@@ -683,7 +769,9 @@ Bug 修复 ...@@ -683,7 +769,9 @@ Bug 修复
* ``nnictl experiment delete``:删除一个或多个 Experiment,包括其日志,结果,环境信息核缓存。 用于删除无用的 Experiment 结果,或节省磁盘空间。 * ``nnictl experiment delete``:删除一个或多个 Experiment,包括其日志,结果,环境信息核缓存。 用于删除无用的 Experiment 结果,或节省磁盘空间。
* ``nnictl platform clean``:用于清理目标平台的磁盘空间。 所提供的 YAML 文件包括了目标平台的信息,与 NNI 配置文件的格式相同。 * ``nnictl platform clean``:用于清理目标平台的磁盘空间。 所提供的 YAML 文件包括了目标平台的信息,与 NNI 配置文件的格式相同。
Bug 修复和其它更新
Bug 修复和其它更新
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
* 改进 Tuner 安装过程:增加 < `sklearn <https://scikit-learn.org/stable/>`__ 依赖。 * 改进 Tuner 安装过程:增加 < `sklearn <https://scikit-learn.org/stable/>`__ 依赖。
* (Bug 修复) 连接 OpenPAI 失败的 HTTP 代码 - `Issue #1076 <https://github.com/microsoft/nni/issues/1076>`__ * (Bug 修复) 连接 OpenPAI 失败的 HTTP 代码 - `Issue #1076 <https://github.com/microsoft/nni/issues/1076>`__
...@@ -728,7 +816,7 @@ Bug 修复 ...@@ -728,7 +816,7 @@ Bug 修复
* 使用 ComponentUpdate 来避免不必要的刷新 * 使用 ComponentUpdate 来避免不必要的刷新
Bug 修复和其它更新 Bug 修复和其它更新
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
* 修复 ``nnictl update`` 不一致的命令行风格 * 修复 ``nnictl update`` 不一致的命令行风格
...@@ -777,7 +865,7 @@ Bug 修复和其它更新 ...@@ -777,7 +865,7 @@ Bug 修复和其它更新
* 为 YAML 文件格式错误提供更有意义的错误信息 * 为 YAML 文件格式错误提供更有意义的错误信息
Bug 修复 Bug 修复
^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^
* 运行 nnictl stop 的异步 Dispatcher 模式时,无法杀掉所有的 Python 线程 * 运行 nnictl stop 的异步 Dispatcher 模式时,无法杀掉所有的 Python 线程
...@@ -807,7 +895,7 @@ Bug 修复 ...@@ -807,7 +895,7 @@ Bug 修复
* 为所有 Trial 增加中间结果的视图 * 为所有 Trial 增加中间结果的视图
Bug 修复 Bug 修复
^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^
* `为 OpenPAI 增加 shmMB 配置 <https://github.com/microsoft/nni/issues/842>`__ * `为 OpenPAI 增加 shmMB 配置 <https://github.com/microsoft/nni/issues/842>`__
...@@ -835,7 +923,7 @@ Bug 修复 ...@@ -835,7 +923,7 @@ Bug 修复
* Tuner、Assessor 参考:https://nni.readthedocs.io/zh/latest/sdk_reference.html#tuner * Tuner、Assessor 参考:https://nni.readthedocs.io/zh/latest/sdk_reference.html#tuner
Bug 修复和其它更新 Bug 修复和其它更新
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
* 修复了在某些极端条件下,不能正确存储任务的取消状态。 * 修复了在某些极端条件下,不能正确存储任务的取消状态。
...@@ -859,10 +947,10 @@ Bug 修复和其它更新 ...@@ -859,10 +947,10 @@ Bug 修复和其它更新
^^^^^^^^^^^^^ ^^^^^^^^^^^^^
* 重新组织文档,新的主页位置:https://nni.readthedocs.io/zh/latest/ * 重新组织文档,新的主页位置:https://nni.readthedocs.io/en/latest/
Bug 修复和其它更新 Bug 修复和其它更新
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
* 修复了 Python 虚拟环境中安装的 Bug,并重构了安装逻辑。 * 修复了 Python 虚拟环境中安装的 Bug,并重构了安装逻辑。
...@@ -947,8 +1035,8 @@ Bug 修复和其它更新 ...@@ -947,8 +1035,8 @@ Bug 修复和其它更新
^^^^^^^^^^^^ ^^^^^^^^^^^^
* `FashionMnist <https://github.com/microsoft/nni/tree/v1.9/examples/trials/network_morphism>`__ 使用 network morphism Tuner * `FashionMnist <https://github.com/microsoft/nni/tree/v0.5/examples/trials/network_morphism>`__ 使用 network morphism Tuner
* 改进 PyTorch 中的 `分布式 MNIST 示例 <https://github.com/microsoft/nni/tree/v1.9/examples/trials/mnist-distributed-pytorch>`__ * 改进 PyTorch 中的 `分布式 MNIST 示例 <https://github.com/microsoft/nni/tree/v0.5/examples/trials/mnist-distributed-pytorch>`__
发布 0.4 - 12/6/2018 发布 0.4 - 12/6/2018
----------------------- -----------------------
...@@ -960,7 +1048,7 @@ Bug 修复和其它更新 ...@@ -960,7 +1048,7 @@ Bug 修复和其它更新
* `Kubeflow 训练平台 <TrainingService/KubeflowMode.rst>`__ * `Kubeflow 训练平台 <TrainingService/KubeflowMode.rst>`__
* 支持 tf-operator * 支持 tf-operator
* Kubeflow 上的 `分布式 Trial 示例 <https://github.com/microsoft/nni/tree/v1.9/examples/trials/mnist-distributed/dist_mnist.py>`__ * Kubeflow 上的 `分布式 Trial 示例 <https://github.com/microsoft/nni/tree/v0.4/examples/trials/mnist-distributed/dist_mnist.py>`__
* `Grid search tuner <Tuner/GridsearchTuner.rst>`__ * `Grid search tuner <Tuner/GridsearchTuner.rst>`__
* `Hyperband tuner <Tuner/HyperbandAdvisor.rst>`__ * `Hyperband tuner <Tuner/HyperbandAdvisor.rst>`__
...@@ -1014,7 +1102,7 @@ API 的新功能和更新 ...@@ -1014,7 +1102,7 @@ API 的新功能和更新
* *
:raw-html:`<span style="color:red">**不兼容的变化**</span>`\ : nn.get_parameters() 改为 nni.get_next_parameter。 所有以前版本的样例将无法在 v0.3 上运行,需要重新克隆 NNI 代码库获取新样例。 如果在自己的代码中使用了 NNI,也需要相应的更新。 不兼容的变化:nn.get_parameters() 改为 nni.get_next_parameter。 所有以前版本的样例将无法在 v0.3 上运行,需要重新克隆 NNI 代码库获取新样例。 如果在自己的代码中使用了 NNI,也需要相应的更新。
* *
新 API **nni.get_sequence_id()**。 新 API **nni.get_sequence_id()**。
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* :githublink:`MNIST-pytorch <examples/trials/mnist-distributed-pytorch>` * :githublink:`MNIST-pytorch <examples/trials/mnist-distributed-pytorch>`
* `CIFAR-10 <./TrialExample/Cifar10Examples.rst>`__ * `CIFAR-10 <./TrialExample/Cifar10Examples.rst>`__
* :githublink:`TGS salt identification chanllenge <examples/trials/kaggle-tgs-salt/README.md>` * :githublink:`TGS 盐识别挑战 <examples/trials/kaggle-tgs-salt/README.md>`
* :githublink:`Network_morphism <examples/trials/network_morphism/README.md>` * :githublink:`Network_morphism <examples/trials/network_morphism/README.md>`
* `TensorFlow <https://github.com/tensorflow/tensorflow>`__ * `TensorFlow <https://github.com/tensorflow/tensorflow>`__
...@@ -31,18 +31,19 @@ ...@@ -31,18 +31,19 @@
* `MXNet <https://github.com/apache/incubator-mxnet>`__ * `MXNet <https://github.com/apache/incubator-mxnet>`__
* `Caffe2 <https://github.com/BVLC/caffe>`__ * `Caffe2 <https://github.com/BVLC/caffe>`__
* `CNTK (Python language) <https://github.com/microsoft/CNTK>`__ * `CNTKPython <https://github.com/microsoft/CNTK>`__
* `Spark MLlib <http://spark.apache.org/mllib/>`__ * `Spark MLlib <http://spark.apache.org/mllib/>`__
* `Chainer <https://chainer.org/>`__ * `Chainer <https://chainer.org/>`__
* `Theano <https://pypi.org/project/Theano/>`__ * `Theano <https://pypi.org/project/Theano/>`__
鼓励您为其他的 NNI 用户\ `贡献更多示例 <Tutorial/Contributing.rst>`__ 鼓励您 `贡献更多示例 <Tutorial/Contributing.rst>`__ 为其他的 NNI 用户
支持的库 支持的库
----------------- -----------------
NNI 也支持其它 Python 库,包括一些基于 GBDT 的算法:XGBoost, CatBoost 以及 lightGBM。 NNI 也支持其它 Python 库,包括一些基于 GBDT 的算法:XGBoost, CatBoost 以及 lightGBM。
* `Scikit-learn <https://scikit-learn.org/stable/>`__ * `Scikit-learn <https://scikit-learn.org/stable/>`__
* `Scikit-learn <TrialExample/SklearnExamples.rst>`__ * `Scikit-learn <TrialExample/SklearnExamples.rst>`__
......
...@@ -10,7 +10,7 @@ NNI 支持在 `AML <https://azure.microsoft.com/zh-cn/services/machine-learning/ ...@@ -10,7 +10,7 @@ NNI 支持在 `AML <https://azure.microsoft.com/zh-cn/services/machine-learning/
步骤 2. 通过此 `链接 <https://azure.microsoft.com/zh-cn/free/services/machine-learning/>`__ 创建 Azure 账户/订阅。 如果已有 Azure 账户/订阅,跳过此步骤。 步骤 2. 通过此 `链接 <https://azure.microsoft.com/zh-cn/free/services/machine-learning/>`__ 创建 Azure 账户/订阅。 如果已有 Azure 账户/订阅,跳过此步骤。
步骤 3. 在机器上安装 Azure CLI,参照 `此 <https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest>`__ 安装指南。 步骤 3. 在机器上安装 Azure CLI,参照 `此 <https://docs.microsoft.com/zh-cn/cli/azure/install-azure-cli?view=azure-cli-latest>`__ 安装指南。
步骤 4. 从 CLI 验证您的 Azure 订阅。 要进行交互式身份验证,请打开命令行或终端并使用以下命令: 步骤 4. 从 CLI 验证您的 Azure 订阅。 要进行交互式身份验证,请打开命令行或终端并使用以下命令:
...@@ -42,7 +42,7 @@ NNI 支持在 `AML <https://azure.microsoft.com/zh-cn/services/machine-learning/ ...@@ -42,7 +42,7 @@ NNI 支持在 `AML <https://azure.microsoft.com/zh-cn/services/machine-learning/
运行实验 运行实验
----------------- -----------------
以 ``examples/trials/mnist-tfv1`` 为例。 NNI 的 YAML 配置文件如下: 以 ``examples/trials/mnist-pytorch`` 为例。 NNI 的 YAML 配置文件如下:
.. code-block:: yaml .. code-block:: yaml
...@@ -81,9 +81,8 @@ NNI 支持在 `AML <https://azure.microsoft.com/zh-cn/services/machine-learning/ ...@@ -81,9 +81,8 @@ NNI 支持在 `AML <https://azure.microsoft.com/zh-cn/services/machine-learning/
* image * image
* 必填。 作业中使用的 Docker 映像名称。 NNI 支持 ``msranni/nni`` 的映像来跑 jobs。 * 必填。 作业中使用的 Docker 映像名称。 NNI 支持 ``msranni/nni`` 的映像来跑 jobs。
.. code-block:: bash
注意:映像是基于 cuda 环境来打包的,可能并不适用于 aml 模式 CPU 集群。 .. Note:: 映像是基于 cuda 环境来打包的,可能并不适用于 aml 模式 CPU 集群。
amlConfig: amlConfig:
...@@ -119,10 +118,10 @@ amlConfig 需要的信息可以从步骤 5 下载的 ``config.json`` 找到。 ...@@ -119,10 +118,10 @@ amlConfig 需要的信息可以从步骤 5 下载的 ``config.json`` 找到。
.. code-block:: bash .. code-block:: bash
git clone -b ${NNI_VERSION} https://github.com/microsoft/nni git clone -b ${NNI_VERSION} https://github.com/microsoft/nni
cd nni/examples/trials/mnist-tfv1 cd nni/examples/trials/mnist-pytorch
# modify config_aml.yml ... # modify config_aml.yml ...
nnictl create --config config_aml.yml nnictl create --config config_aml.yml
将 ``${NNI_VERSION}`` 替换为发布的版本或分支名称,例如:``v1.9``。 将 ``${NNI_VERSION}`` 替换为发布的版本或分支名称,例如:``v2.0``。
在 AdaptDL 上运行 Experiment 在 AdaptDL 上运行 Experiment
============================ ============================
NNI 支持在 `AdaptDL <https://github.com/petuum/adaptdl>`__ 上运行,称为 AdaptDL 模式。 在开始使用 NNI 的 AdaptDL 模式前,需要有一个 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 集群。 在 AdaptDL 模式下,每个 Trial 程序会在 AdaptDL 集群中作为一个 Kubeflow 作业来运行。 NNI 支持在 `AdaptDL <https://github.com/petuum/adaptdl>`__ 上运行,称为 AdaptDL 模式。 在开始使用 NNI 的 AdaptDL 模式前,需要有一个 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 集群。 在 AdaptDL 模式下,每个 Trial 程序会在 AdaptDL 集群中作为一个 Kubeflow 作业来运行。
AdaptDL 旨在使动态资源环境(例如共享集群和云)中的分布式深度学习变得轻松高效。 AdaptDL 旨在使动态资源环境(例如共享集群和云)中的分布式深度学习变得轻松高效。
...@@ -9,9 +9,9 @@ AdaptDL 旨在使动态资源环境(例如共享集群和云)中的分布式 ...@@ -9,9 +9,9 @@ AdaptDL 旨在使动态资源环境(例如共享集群和云)中的分布式
----------------------------------- -----------------------------------
#. 采用 **Kubernetes 1.14** 或更高版本。 根据下面的指南设置 Kubernetes 环境: `on Azure <https://azure.microsoft.com/zh-cn/services/kubernetes-service/>`__\ , `on-premise <https://kubernetes.io/docs/setup/>`__ , `cephfs <https://kubernetes.io/docs/concepts/storage/storage-classes/#ceph-rbd>`__\ `microk8s with storage add-on enabled <https://microk8s.io/docs/addons>`__。 #. 采用 **Kubernetes 1.14** 或更高版本。 根据下面的指南设置 Kubernetes 环境: `on Azure <https://azure.microsoft.com/zh-cn/services/kubernetes-service/>`__\ , `on-premise <https://kubernetes.io/docs/setup/>`__ , `cephfs <https://kubernetes.io/docs/concepts/storage/storage-classes/#ceph-rbd>`__\ `microk8s with storage add-on enabled <https://microk8s.io/docs/addons>`__。
#. Helm 将 **AdaptDL Scheduler** 安装到 Kubernetes 集群中。 参照 `指南 <https://adaptdl.readthedocs.io/en/latest/installation/install-adaptdl.html>`__ 来设置 AdaptDL scheduler。 #. Helm 将 **AdaptDL Scheduler** 安装到 Kubernetes 集群中。 参照 `指南 <https://adaptdl.readthedocs.io/en/latest/installation/install-adaptdl.html>`__ 来设置 AdaptDL scheduler。
#. 配置 **kubeconfig** 文件,NNI 将使用此配置与 Kubernetes API 服务交互。 默认情况下,NNI 管理器会使用 $(HOME)/.kube/config 作为 kubeconfig 文件的路径。 也可以通过环境变量 **KUBECONFIG** 来指定其它 kubeconfig 文件。 根据 `指南 <https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig>`__ 了解更多 kubeconfig 的信息。 #. 配置 **kubeconfig** 文件,NNI 将使用此配置与 Kubernetes API 服务交互。 默认情况下,NNI 管理器会使用 ``$(HOME)/.kube/config`` 作为 kubeconfig 文件的路径。 也可以通过环境变量 **KUBECONFIG** 来指定其它 kubeconfig 文件。 根据 `指南 <https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig>`__ 了解更多 kubeconfig 的信息。
#. 如果 NNI Trial 作业需要 GPU 资源,需按照 `指南 <https://github.com/NVIDIA/k8s-device-plugin>`__ 来配置 **Kubernetes 下的 Nvidia 插件**。 #. 如果 NNI Trial 作业需要 GPU 资源,需按照 `指南 <https://github.com/NVIDIA/k8s-device-plugin>`__ 来配置 **Kubernetes 下的 Nvidia 插件**。
#. (可选)准备 **NFS服务器** 并导出通用装载作为外部存储。 #. (可选)准备 **NFS服务器** 并导出通用装载作为外部存储。
#. 参考 `指南 <../Tutorial/QuickStart.rst>`__ 安装 **NNI**。 #. 参考 `指南 <../Tutorial/QuickStart.rst>`__ 安装 **NNI**。
...@@ -76,7 +76,7 @@ AdaptDL 旨在使动态资源环境(例如共享集群和云)中的分布式 ...@@ -76,7 +76,7 @@ AdaptDL 旨在使动态资源环境(例如共享集群和云)中的分布式
storageSize: 1Gi storageSize: 1Gi
下文中没有提及的 config 可以参考这篇文档: 下文中没有提及的 config 可以参考这篇文档:
`default specs defined in the NNI doc </Tutorial/ExperimentConfig.html#configuration-spec>`__。 `默认配置说明 </Tutorial/ExperimentConfig.rst#configuration-spec>`__。
* **trainingServicePlatform**\ : 选择 ``adl`` 以将 Kubernetes 集群与 AdaptDL 调度程序一起使用。 * **trainingServicePlatform**\ : 选择 ``adl`` 以将 Kubernetes 集群与 AdaptDL 调度程序一起使用。
...@@ -133,7 +133,7 @@ NFS 存储 ...@@ -133,7 +133,7 @@ NFS 存储
简而言之,并没有限制 trial 如何读取或写入 NFS 存储,因此可以根据需要灵活使用它。 简而言之,并没有限制 trial 如何读取或写入 NFS 存储,因此可以根据需要灵活使用它。
通过日志流监控 通过日志流监控
---------------------- ---------------------------------------------
遵循特定 trial 的日志流: 遵循特定 trial 的日志流:
......
在 FrameworkController 上运行 Experiment 在 FrameworkController 上运行 Experiment
======================================== ========================================
NNI 支持使用 `FrameworkController <https://github.com/Microsoft/frameworkcontroller>`__,来运行 Experiment,称之为 frameworkcontroller 模式。 FrameworkController 构建于 Kubernetes 上,用于编排各种应用。这样,可以不用为某个深度学习框架安装 Kubeflow 的 tf-operator 或 pytorch-operator 等。 而直接用 FrameworkController 作为 NNI Experiment 的训练平台。 NNI 支持使用 `FrameworkController <https://github.com/Microsoft/frameworkcontroller>`__,来运行 Experiment,称之为 frameworkcontroller 模式。 FrameworkController 构建于 Kubernetes 上,用于编排各种应用。这样,可以不用为某个深度学习框架安装 Kubeflow 的 tf-operator 或 pytorch-operator 等。 而直接用 FrameworkController 作为 NNI Experiment 的训练平台。
私有部署的 Kubernetes 的准备工作 私有部署的 Kubernetes 的准备工作
...@@ -9,7 +8,7 @@ NNI 支持使用 `FrameworkController <https://github.com/Microsoft/frameworkcon ...@@ -9,7 +8,7 @@ NNI 支持使用 `FrameworkController <https://github.com/Microsoft/frameworkcon
#. 采用 **Kubernetes 1.8** 或更高版本。 根据 `指南 <https://kubernetes.io/docs/setup/>`__ 来安装 Kubernetes。 #. 采用 **Kubernetes 1.8** 或更高版本。 根据 `指南 <https://kubernetes.io/docs/setup/>`__ 来安装 Kubernetes。
#. 配置 **kubeconfig** 文件,NNI 将使用此配置与 Kubernetes API 服务交互。 默认情况下,NNI 管理器会使用 ``$(HOME)/.kube/config`` 作为 kubeconfig 文件的路径。 也可以通过环境变量 **KUBECONFIG** 来指定其它 kubeconfig 文件。 根据 `指南 <https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig>`__ 了解更多 kubeconfig 的信息。 #. 配置 **kubeconfig** 文件,NNI 将使用此配置与 Kubernetes API 服务交互。 默认情况下,NNI 管理器会使用 $(HOME)/.kube/config 作为 kubeconfig 文件的路径。 也可以通过环境变量 **KUBECONFIG** 来指定其它 kubeconfig 文件。 根据 `指南 <https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig>`__ 了解更多 kubeconfig 的信息。
#. 如果 NNI Trial 作业需要 GPU 资源,需按照 `指南 <https://github.com/NVIDIA/k8s-device-plugin>`__ 来配置 **Kubernetes 下的 Nvidia 插件**。 #. 如果 NNI Trial 作业需要 GPU 资源,需按照 `指南 <https://github.com/NVIDIA/k8s-device-plugin>`__ 来配置 **Kubernetes 下的 Nvidia 插件**。
#. 准备 **NFS 服务器** 并导出通用的装载 (mount),推荐将 NFS 服务器路径映射到 **root_squash 选项**,否则可能会在 NNI 复制文件到 NFS 时出现权限问题。 参考 `页面 <https://linux.die.net/man/5/exports>`__,来了解关于 root_squash 选项,或 **Azure File Storage**。 #. 准备 **NFS 服务器** 并导出通用的装载 (mount),推荐将 NFS 服务器路径映射到 **root_squash 选项**,否则可能会在 NNI 复制文件到 NFS 时出现权限问题。 参考 `页面 <https://linux.die.net/man/5/exports>`__,来了解关于 root_squash 选项,或 **Azure File Storage**。
#. 在安装 NNI 并运行 nnictl 的计算机上安装 **NFS 客户端**。 运行此命令安装 NFSv4 客户端: #. 在安装 NNI 并运行 nnictl 的计算机上安装 **NFS 客户端**。 运行此命令安装 NFSv4 客户端:
...@@ -18,15 +17,15 @@ NNI 支持使用 `FrameworkController <https://github.com/Microsoft/frameworkcon ...@@ -18,15 +17,15 @@ NNI 支持使用 `FrameworkController <https://github.com/Microsoft/frameworkcon
apt-get install nfs-common apt-get install nfs-common
#. 参考 `指南 <../Tutorial/QuickStart.rst>`__ 安装 **NNI**。 7. 参考 `指南 <../Tutorial/QuickStart.rst>`__ 安装 **NNI**。
Azure 部署的 Kubernetes 的准备工作 Azure 部署的 Kubernetes 的准备工作
----------------------------------------- -----------------------------------------
#. NNI 支持基于 Azure Kubernetes Service 的 Kubeflow,参考 `指南 <https://azure.microsoft.com/zh-cn/services/kubernetes-service/>`__ 来设置 Azure Kubernetes Service。 #. NNI 支持基于 Azure Kubernetes Service 的 Kubeflow,参考 `指南 <https://azure.microsoft.com/zh-cn/services/kubernetes-service/>`__ 来设置 Azure Kubernetes Service。
#. 安装 `Azure CLI <https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest>`__ 和 ``kubectl``。 使用 ``az login`` 命令来设置 Azure 账户,并将 kubectl 客户端连接到 AKS,参考此 `指南 <https://docs.microsoft.com/zh-cn/azure/aks/kubernetes-walkthrough#connect-to-the-cluster>`__。 #. 安装 `Azure CLI <https://docs.microsoft.com/zh-cn/cli/azure/install-azure-cli?view=azure-cli-latest>`__ 和 ``kubectl``。 使用 ``az login`` 命令来设置 Azure 账户,并将 kubectl 客户端连接到 AKS,参考此 `指南 <https://docs.microsoft.com/zh-cn/azure/aks/kubernetes-walkthrough#connect-to-the-cluster>`__。
#. 参考此 `指南 <https://docs.microsoft.com/zh-cn/azure/storage/common/storage-quickstart-create-account?tabs=portal>`__ 来创建 Azure 文件存储账户。 NNI 需要 Azure Storage Service 来存取代码和输出文件。 #. 参考此 `指南 <https://docs.microsoft.com/zh-cn/azure/storage/common/storage-quickstart-create-account?tabs=portal>`__ 来创建 Azure 文件存储账户。 NNI 需要 Azure Storage Service 来存取代码和输出文件。
#. NNI 需要访问密钥来连接 Azure 存储服务,NNI 使用 `Azure Key Vault <https://azure.microsoft.com/zh-cn/services/key-vault/>`__ 服务来保护私钥。 设置 Azure Key Vault 服务,并添加密钥到 Key Vault 中来存取 Azure 存储账户。 参考 `指南 <https://docs.microsoft.com/zh-cn/azure/key-vault/quick-create-cli>`__ 来存储访问密钥。 #. NNI 需要访问密钥来连接 Azure 存储服务,NNI 使用 `Azure Key Vault <https://azure.microsoft.com/zh-cn/services/key-vault/>`__ 服务来保护私钥。 设置 Azure Key Vault 服务,并添加密钥到 Key Vault 中来存取 Azure 存储账户。 参考 `指南 <https://docs.microsoft.com/zh-cn/azure/key-vault/quick-create-cli>`__ 来存储访问密钥。
安装 FrameworkController 安装 FrameworkController
...@@ -101,7 +100,7 @@ FrameworkController 配置文件的格式如下: ...@@ -101,7 +100,7 @@ FrameworkController 配置文件的格式如下:
注意:如果用 FrameworkController 模式运行,需要在 YAML 文件中显式设置 ``trainingServicePlatform: frameworkcontroller``。 注意:如果用 FrameworkController 模式运行,需要在 YAML 文件中显式设置 ``trainingServicePlatform: frameworkcontroller``。
FrameworkController 模式的 Trial 配置格式,是 FrameworkController 官方配置的简化版。参考 `frameworkcontroller 的 tensorflow 示例 <https://github.com/Microsoft/frameworkcontroller/blob/master/example/framework/scenario/tensorflow/cpu/tensorflowdistributedtrainingwithcpu.yaml>`__ 了解详情。 FrameworkController 模式的 Trial 配置格式,是 FrameworkController 官方配置的简化版。参考 `frameworkcontroller 的 tensorflow 示例 <https://github.com/microsoft/frameworkcontroller/blob/master/example/framework/scenario/tensorflow/ps/cpu/tensorflowdistributedtrainingwithcpu.yaml>`__ 了解详情。
frameworkcontroller 模式中的 Trial 配置使用以下主键: frameworkcontroller 模式中的 Trial 配置使用以下主键:
...@@ -115,7 +114,7 @@ frameworkcontroller 模式中的 Trial 配置使用以下主键: ...@@ -115,7 +114,7 @@ frameworkcontroller 模式中的 Trial 配置使用以下主键:
* cpuNum: 容器中要使用的 CPU 数量。 * cpuNum: 容器中要使用的 CPU 数量。
* memoryMB: 容器的内存限制。 * memoryMB: 容器的内存限制。
* image: 用来创建 pod,并运行程序的 Docker 映像。 * image: 用来创建 pod,并运行程序的 Docker 映像。
* frameworkAttemptCompletionPolicy: 运行框架的策略,参考 `用户手册 <https://github.com/Microsoft/frameworkcontroller/blob/master/doc/user-manual.rst#frameworkattemptcompletionpolicy>`__ 了解更多信息。 这些策略可以用来控制 pod,例如,如果 worker 任务停止了,但 ps 还在运行,要通过完成策略来停止 ps。 * frameworkAttemptCompletionPolicy: 运行框架的策略,参考 `用户手册 <https://github.com/Microsoft/frameworkcontroller/blob/master/doc/user-manual.md#frameworkattemptcompletionpolicy>`__ 了解更多信息。 这些策略可以用来控制 pod,例如,如果 worker 任务停止了,但 ps 还在运行,要通过完成策略来停止 ps。
如何运行示例 如何运行示例
------------------ ------------------
......
...@@ -15,8 +15,8 @@ TrainingService 是与平台管理、任务调度相关的模块。 TrainingServ ...@@ -15,8 +15,8 @@ TrainingService 是与平台管理、任务调度相关的模块。 TrainingServ
:alt: :alt:
NNI 的架构如图所示。 NNIManager 是系统的核心管理模块,负责调用 TrainingService 来管理 Trial,并负责不同模块之间的通信。 Dispatcher 是消息处理中心。 TrainingService 是管理任务的模块,它和 NNIManager 通信,并且根据平台的特点有不同的实现。 NNI 目前支持的平台有 `local platfrom <LocalMode.md>`__\ NNI 的架构如图所示。 NNIManager 是系统的核心管理模块,负责调用 TrainingService 来管理 Trial,并负责不同模块之间的通信。 Dispatcher 是消息处理中心。 TrainingService 是管理任务的模块,它和 NNIManager 通信,并且根据平台的特点有不同的实现。 NNI 目前支持的平台有 `本地平台 <LocalMode.rst>`__\
,`remote platfrom <RemoteMachineMode.md>`__\ , `PAI platfrom <PaiMode.md>`__\ , `kubeflow platform <KubeflowMode.md>`__ 和 `FrameworkController platfrom <FrameworkControllerMode.rst>`__。 ,`远程平台 <RemoteMachineMode.rst>`__\ , `PAI <PaiMode.rst>`__\ , `kubeflow <KubeflowMode.rst>`__ 和 `FrameworkController <FrameworkControllerMode.rst>`__。
本文中,会介绍 TrainingService 的简要设计。 如果要添加新的 TrainingService,只需要继承 TrainingServcie 类并实现相应的方法,不需要理解NNIManager、Dispatcher 等其它模块的细节。 本文中,会介绍 TrainingService 的简要设计。 如果要添加新的 TrainingService,只需要继承 TrainingServcie 类并实现相应的方法,不需要理解NNIManager、Dispatcher 等其它模块的细节。
......
**在异构模式下运行 Experiment** **以混合模式进行实验**
=========================================== ===========================================
异构模式下运行 NNI 意味着 NNI 将同时在多种培训平台上运行试验工作。 例如,NNI 可以同时将试用作业提交到远程计算机和 AML。 混合模式下运行 NNI 意味着 NNI 将在多种培训平台上运行试验工作。 例如,NNI 可以同时将试用作业提交到远程计算机和 AML。
设置环境 设置环境
---------------------- -----------------
NNI 的异构模式目前支持 `local <./LocalMode.rst>`__\ , `remote <./RemoteMachineMode.rst>`__\ , `PAI <./PaiMode.rst>`__\ 和 `AML <./AMLMode.rst>`__ 四种训练环境。在使用这些模式开始实验之前,应在平台上设置对应的环境。环境设置的详细信息,参见以上文档。
对于混合模式,NNI 目前支持的平台有 `本地平台 <LocalMode.rst>`__\ ,`远程平台 <RemoteMachineMode.rst>`__\ , `PAI <PaiMode.rst>`__ 和 `AML <./AMLMode.rst>`__\ 。 使用这些模式开始 Experiment 之前,用户应为平台设置相应的环境。 有关环境设置的详细信息,请参见相应的文档。
运行实验 运行实验
-------------------- -----------------
以 `examples/trials/mnist-tfv1` 为例。 NNI 的 YAML 配置文件如下: ``examples/trials/mnist-tfv1`` 为例。 NNI 的 YAML 配置文件如下:
.. code-block:: yaml .. code-block:: yaml
...@@ -21,20 +20,20 @@ NNI 的异构模式目前支持 `local <./LocalMode.rst>`__\ , `remote <./Remote ...@@ -21,20 +20,20 @@ NNI 的异构模式目前支持 `local <./LocalMode.rst>`__\ , `remote <./Remote
trialConcurrency: 2 trialConcurrency: 2
maxExecDuration: 1h maxExecDuration: 1h
maxTrialNum: 10 maxTrialNum: 10
trainingServicePlatform: heterogeneous trainingServicePlatform: hybrid
searchSpacePath: search_space.json searchSpacePath: search_space.json
#choice: true, false # 可选项:true, false
useAnnotation: false useAnnotation: false
tuner: tuner:
builtinTunerName: TPE builtinTunerName: TPE
classArgs: classArgs:
#choice: maximize, minimize # 可选项: maximize, minimize
optimize_mode: maximize optimize_mode: maximize
trial: trial:
command: python3 mnist.py command: python3 mnist.py
codeDir: . codeDir: .
gpuNum: 1 gpuNum: 1
heterogeneousConfig: hybridConfig:
trainingServicePlatforms: trainingServicePlatforms:
- local - local
- remote - remote
...@@ -45,11 +44,11 @@ NNI 的异构模式目前支持 `local <./LocalMode.rst>`__\ , `remote <./Remote ...@@ -45,11 +44,11 @@ NNI 的异构模式目前支持 `local <./LocalMode.rst>`__\ , `remote <./Remote
username: bob username: bob
passwd: bob123 passwd: bob123
异构模式的配置: 混合模式的配置:
heterogeneousConfig: hybridConfig:
* trainingServicePlatforms. 必填。 该字段指定用于异构模式的平台,值使用 yaml 列表格式。 NNI 支持在此字段中设置 `local`, `remote`, `aml`, `pai` 。 * trainingServicePlatforms. 必填。 该字段指定用于混合模式的平台,值使用 yaml 列表格式。 NNI 支持在此字段中设置 ``local``, ``remote``, ``aml``, ``pai``
.. Note:: 如果将平台设置为 trainingServicePlatforms 模式,则用户还应该为平台设置相应的配置。 例如,如果使用 ``remote`` 作为平台,还应设置 ``machineList`` 和 ``remoteConfig`` 配置。 .. Note:: 如果将平台设置为 trainingServicePlatforms 模式,则用户还应该为平台设置相应的配置。 例如,如果使用 ``remote`` 作为平台,还应设置 ``machineList`` 和 ``remoteConfig`` 配置。 混合模式下的本地平台暂时不支持Windows。
在 Kubeflow 上运行 Experiment 在 Kubeflow 上运行 Experiment
============================= =============================
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 作业来运行。 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 作业来运行。
私有部署的 Kubernetes 的准备工作 私有部署的 Kubernetes 的准备工作
...@@ -20,16 +18,16 @@ NNI 支持在 `Kubeflow <https://github.com/kubeflow/kubeflow>`__ 上运行, ...@@ -20,16 +18,16 @@ NNI 支持在 `Kubeflow <https://github.com/kubeflow/kubeflow>`__ 上运行,
apt-get install nfs-common apt-get install nfs-common
#. 参考 `指南 <../Tutorial/QuickStart.rst>`__ 安装 **NNI**。 7. 参考 `指南 <../Tutorial/QuickStart.rst>`__ 安装 **NNI**。
Azure 部署的 Kubernetes 的准备工作 Azure 部署的 Kubernetes 的准备工作
----------------------------------------- -----------------------------------------
#. NNI 支持基于 Azure Kubernetes Service 的 Kubeflow,参考 `指南 <https://azure.microsoft.com/zh-cn/services/kubernetes-service/>`__ 来设置 Azure Kubernetes Service。 #. NNI 支持基于 Azure Kubernetes Service 的 Kubeflow,参考 `指南 <https://azure.microsoft.com/zh-cn/services/kubernetes-service/>`__ 来设置 Azure Kubernetes Service。
#. 安装 `Azure CLI <https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest>`__ 和 ``kubectl``。 使用 ``az login`` 命令来设置 Azure 账户,并将 kubectl 客户端连接到 AKS,参考此 `指南 <https://docs.microsoft.com/zh-cn/azure/aks/kubernetes-walkthrough#connect-to-the-cluster>`__。 #. 安装 `Azure CLI <https://docs.microsoft.com/zh-cn/cli/azure/install-azure-cli?view=azure-cli-latest>`__ 和 ``kubectl``。 使用 ``az login`` 命令来设置 Azure 账户,并将 kubectl 客户端连接到 AKS,参考此 `指南 <https://docs.microsoft.com/zh-cn/azure/aks/kubernetes-walkthrough#connect-to-the-cluster>`__。
#. 在 Azure Kubernetes Service 上部署 Kubeflow,参考此 `指南 <https://www.kubeflow.org/docs/started/getting-started/>`__。 #. 在 Azure Kubernetes Service 上部署 Kubeflow,参考此 `指南 <https://www.kubeflow.org/docs/started/getting-started/>`__。
#. 参考此 `指南 <https://docs.microsoft.com/zh-cn/azure/storage/common/storage-quickstart-create-account?tabs=portal>`__ 来创建 Azure 文件存储账户。 NNI 需要 Azure Storage Service 来存取代码和输出文件。 #. 参考此 `指南 <https://docs.microsoft.com/zh-cn/azure/storage/common/storage-quickstart-create-account?tabs=portal>`__ 来创建 Azure 文件存储账户。 NNI 需要 Azure Storage Service 来存取代码和输出文件。
#. NNI 需要访问密钥来连接 Azure 存储服务,NNI 使用 `Azure Key Vault <https://azure.microsoft.com/zh-cn/services/key-vault/>`__ 服务来保护私钥。 设置 Azure Key Vault 服务,并添加密钥到 Key Vault 中来存取 Azure 存储账户。 参考 `指南 <https://docs.microsoft.com/zh-cn/azure/key-vault/quick-create-cli>`__ 来存储访问密钥。 #. NNI 需要访问密钥来连接 Azure 存储服务,NNI 使用 `Azure Key Vault <https://azure.microsoft.com/zh-cn/services/key-vault/>`__ 服务来保护私钥。 设置 Azure Key Vault 服务,并添加密钥到 Key Vault 中来存取 Azure 存储账户。 参考 `指南 <https://docs.microsoft.com/zh-cn/azure/key-vault/quick-create-cli>`__ 来存储访问密钥。
设计 设计
...@@ -42,10 +40,10 @@ Azure 部署的 Kubernetes 的准备工作 ...@@ -42,10 +40,10 @@ Azure 部署的 Kubernetes 的准备工作
Kubeflow 训练平台会实例化一个 Kubernetes 客户端来与 Kubernetes 集群的 API 服务器交互。 Kubeflow 训练平台会实例化一个 Kubernetes 客户端来与 Kubernetes 集群的 API 服务器交互。
对于每个 Trial,会上传本机 codeDir 路径(在 nni_config.yml 中配置)中的所有文件,包括 parameter.cfg 这样的生成的文件到存储卷中。 当前支持两种存储卷:`nfs <https://zh.wikipedia.org/wiki/Network_File_System>`__ 和 `azure file storage <https://azure.microsoft.com/zh-cn/services/storage/files/>`__,需要在 NNI 的 YAML 文件中进行配置。 当文件准备好后,Kubeflow 训练平台会调用 Kubernetes 的 API 来创建 Kubeflow 作业 (\ `tf-operator <https://github.com/kubeflow/tf-operator>`__ 作业或 `pytorch-operator <https://github.com/kubeflow/pytorch-operator>`__ 作业) ,并将存储卷挂载到作业的 pod 中。 Kubeflow 作业的输出文件,例如 stdout, stderr, trial.log 以及模型文件,也会被复制回存储卷。 NNI 会在网页中显示每个 Trial 的存储卷的 URL,以便浏览日志和输出文件。 对于每个 Trial,会上传本机 codeDir 路径(在 nni_config.yml 中配置)中的所有文件,包括 parameter.cfg 这样的生成的文件到存储卷中。 当前支持两种存储卷:`nfs <https://en.wikipedia.org/wiki/Network_File_System>`__ 和 `azure file storage <https://azure.microsoft.com/zh-cn/services/storage/files/>`__,需要在 NNI 的 YAML 文件中进行配置。 当文件准备好后,Kubeflow 训练平台会调用 Kubernetes 的 API 来创建 Kubeflow 作业 (\ `tf-operator <https://github.com/kubeflow/tf-operator>`__ 作业或 `pytorch-operator <https://github.com/kubeflow/pytorch-operator>`__ 作业) ,并将存储卷挂载到作业的 pod 中。 Kubeflow 作业的输出文件,例如 stdout, stderr, trial.log 以及模型文件,也会被复制回存储卷。 NNI 会在网页中显示每个 Trial 的存储卷的 URL,以便浏览日志和输出文件。
支持的操作符(operator) 支持的操作符(operator)
----------------------------------------- ------------------------------------
NNI 仅支持 Kubeflow 的 tf-operator 和 pytorch-operator,其它操作符未经测试。 NNI 仅支持 Kubeflow 的 tf-operator 和 pytorch-operator,其它操作符未经测试。
可以在配置文件中设置操作符类型。 可以在配置文件中设置操作符类型。
...@@ -231,6 +229,8 @@ kubeflow 模式的配置有下列主键: ...@@ -231,6 +229,8 @@ kubeflow 模式的配置有下列主键:
* 必填。 Kubeflow 的 API 版本。 * 必填。 Kubeflow 的 API 版本。
.. cannot find :githublink:`msranni/nni <deployment/docker/Dockerfile>`
* ps (可选)。 此部分用于配置 TensorFlow 的 parameter 服务器角色。 * ps (可选)。 此部分用于配置 TensorFlow 的 parameter 服务器角色。
* master (可选)。 此部分用于配置 PyTorch 的 parameter 服务器角色。 * master (可选)。 此部分用于配置 PyTorch 的 parameter 服务器角色。
......
**教程:使用 NNI API 在本地创建和运行 Experiment** **教程:使用 NNI API 在本地创建和运行 Experiment**
==================================================================== ================================================================================================================================
本教程会使用 [~/examples/trials/mnist-tfv1] 示例来解释如何在本地使用 NNI API 来创建并运行 Experiment。 本教程会使用 [~/examples/trials/mnist-pytorch] 示例来解释如何在本地使用 NNI API 来创建并运行 Experiment。
.. ..
...@@ -17,23 +17,25 @@ ...@@ -17,23 +17,25 @@
对代码进行以下改动来启用 NNI API: 对代码进行以下改动来启用 NNI API:
* 声明 NNI API 在 Trial 代码中通过 ``import nni`` 来导入 NNI API。 1.1 声明 NNI API 在 Trial 代码中通过 ``import nni`` 来导入 NNI API。
* 获取预定义参数
1.2 获取预定义参数
使用一下代码段: 使用一下代码段:
.. code-block:: python .. code-block:: python
RECEIVED_PARAMS = nni.get_next_parameter() tuner_params = nni.get_next_parameter()
获得 tuner 分配的超参数值。 ``RECEIVED_PARAMS`` 是一个对象,如: 获得 tuner 分配的超参数值。 ``tuner_params`` 是一个对象,如:
.. code-block:: json .. code-block:: json
{"conv_size": 2, "hidden_size": 124, "learning_rate": 0.0307, "dropout_rate": 0.2029} {"batch_size": 32, "hidden_size": 128, "lr": 0.01, "momentum": 0.2029}
..
* 导出 NNI results API:``nni.report_intermediate_result(accuracy)`` 发送 ``accuracy`` 给 assessor。 1.3 导出 NNI results API:``nni.report_intermediate_result(accuracy)`` 发送 ``accuracy`` 给 assessor。 使用 API: ``nni.report_final_result(accuracy)`` 返回 ``accuracy`` 的值给 Tuner。
使用 API: ``nni.report_final_result(accuracy)`` 返回 ``accuracy`` 的值给 Tuner。
将改动保存到 ``mnist.py`` 文件中。 将改动保存到 ``mnist.py`` 文件中。
...@@ -54,12 +56,12 @@ ...@@ -54,12 +56,12 @@
.. code-block:: bash .. code-block:: bash
{ {
"dropout_rate":{"_type":"uniform","_value":[0.1,0.5]}, "batch_size": {"_type":"choice", "_value": [16, 32, 64, 128]},
"conv_size":{"_type":"choice","_value":[2,3,5,7]}, "hidden_size":{"_type":"choice","_value":[128, 256, 512, 1024]},
"hidden_size":{"_type":"choice","_value":[124, 512, 1024]}, "lr":{"_type":"choice","_value":[0.0001, 0.001, 0.01, 0.1]},
"learning_rate":{"_type":"uniform","_value":[0.0001, 0.1]} "momentum":{"_type":"uniform","_value":[0, 1]}
} }
参考 `define search space <../Tutorial/SearchSpaceSpec.rst>`__ 进一步了解搜索空间。 参考 `define search space <../Tutorial/SearchSpaceSpec.rst>`__ 进一步了解搜索空间。
...@@ -91,7 +93,7 @@ ...@@ -91,7 +93,7 @@
.. ..
在克隆代码后,可以在 ~/nni/examples 中找到一些示例,运行 ``ls examples/trials`` 查看所有 Trial 示例 安装 NNI 之后,NNI 的样例已经在目录 ``nni/examples`` 下,运行 ``ls nni/examples/trials`` 可以看到所有的 examples
以一个简单的 trial 来举例。 NNI 提供了 mnist 样例。 安装 NNI 之后,NNI 的样例已经在目录 ~/nni/examples下,运行 ``ls ~/nni/examples/trials`` 可以看到所有的 examples。 执行下面的命令可轻松运行 NNI 的 mnist 样例: 以一个简单的 trial 来举例。 NNI 提供了 mnist 样例。 安装 NNI 之后,NNI 的样例已经在目录 ~/nni/examples下,运行 ``ls ~/nni/examples/trials`` 可以看到所有的 examples。 执行下面的命令可轻松运行 NNI 的 mnist 样例:
......
...@@ -6,14 +6,14 @@ ...@@ -6,14 +6,14 @@
NNI 训练平台让用户专注于 AutoML 任务,不需要关心 Trial 实际运行的计算基础架构平台。 当从一个集群迁移到另一个集群时 (如,从本机迁移到 Kubeflow),用户只需要调整几项配置,能很容易的扩展计算资源。 NNI 训练平台让用户专注于 AutoML 任务,不需要关心 Trial 实际运行的计算基础架构平台。 当从一个集群迁移到另一个集群时 (如,从本机迁移到 Kubeflow),用户只需要调整几项配置,能很容易的扩展计算资源。
用户可以使用 NNI 提供的训练平台来跑 trial, 训练平台有:`local machine <./LocalMode.rst>`__\ , `remote machines <./RemoteMachineMode.rst>`__\ 以及集群类的 `PAI <./PaiMode.rst>`__\ ,`Kubeflow <./KubeflowMode.rst>`__\ ,`AdaptDL <./AdaptDLMode.rst>`__\ , `FrameworkController <./FrameworkControllerMode.rst>`__\ , `DLTS <./DLTSMode.rst>`__ 和 `AML <./AMLMode.rst>`__。 这些都是\ *内置的训练平台*。 用户可以使用 NNI 提供的训练平台来跑 trial, 训练平台有:`local machine <./LocalMode.rst>`__\ , `remote machines <./RemoteMachineMode.rst>`__\ 以及集群类的 `PAI <./PaiMode.rst>`__\ ,`Kubeflow <./KubeflowMode.rst>`__\ ,`AdaptDL <./AdaptDLMode.rst>`__\ , `FrameworkController <./FrameworkControllerMode.rst>`__\ , `DLTS <./DLTSMode.rst>`__ 和 `AML <./AMLMode.rst>`__。 这些都是 *内置的训练平台*。
如果需要在计算资源上使用 NNI,可以根据相关接口,轻松构建对其它训练平台的支持。 详情请参考 `NNI 中如何实训练平台 <./HowToImplementTrainingService.rst>`__ 如果需要在计算资源上使用 NNI,可以根据相关接口,轻松构建对其它训练平台的支持。 详情请参考 `如何实训练平台 <./HowToImplementTrainingService.rst>`__ 。
如何使用训练平台? 如何使用训练平台?
---------------------------- ----------------------------
在 Experiment 的 YAML 配置文件中选择并配置好训练平台。 参考相应训练平台的文档来了解如何配置。 同时, `Experiment 文档 <../Tutorial/ExperimentConfig.rst>`__ 提供了更多详细信息。 在 Experiment 的 YAML 配置文件中选择并配置好训练平台。 参考相应训练平台的文档来了解如何配置。 `此文档 <../Tutorial/ExperimentConfig.rst>`__ 提供了更多详细信息。
然后,需要准备代码目录,将路径填入配置文件的 ``codeDir`` 字段。 注意,非本机模式下,代码目录会在 Experiment 运行前上传到远程或集群中。 因此,NNI 将文件数量限制到 2000,总大小限制为 300 MB。 如果 codeDir 中包含了过多的文件,可添加 ``.nniignore`` 文件来排除部分,与 ``.gitignore`` 文件用法类似。 写好这个文件请参考 :githublink:`示例 <examples/trials/mnist-tfv1/.nniignore>` 和 `git 文档 <https://git-scm.com/docs/gitignore#_pattern_format>`__。 然后,需要准备代码目录,将路径填入配置文件的 ``codeDir`` 字段。 注意,非本机模式下,代码目录会在 Experiment 运行前上传到远程或集群中。 因此,NNI 将文件数量限制到 2000,总大小限制为 300 MB。 如果 codeDir 中包含了过多的文件,可添加 ``.nniignore`` 文件来排除部分,与 ``.gitignore`` 文件用法类似。 写好这个文件请参考 :githublink:`示例 <examples/trials/mnist-tfv1/.nniignore>` 和 `git 文档 <https://git-scm.com/docs/gitignore#_pattern_format>`__。
...@@ -35,9 +35,9 @@ NNI 训练平台让用户专注于 AutoML 任务,不需要关心 Trial 实际 ...@@ -35,9 +35,9 @@ NNI 训练平台让用户专注于 AutoML 任务,不需要关心 Trial 实际
* - `PAI <./PaiMode.rst>`__ * - `PAI <./PaiMode.rst>`__
- NNI 支持在 `OpenPAI <https://github.com/Microsoft/pai>`__ (aka PAI) 上运行 Experiment,即 pai 模式。 在使用 NNI 的 pai 模式前, 需要有 `OpenPAI <https://github.com/Microsoft/pai>`__ 群集的账户。 如果没有 OpenPAI 账户,参考 `这里 <https://github.com/Microsoft/pai#how-to-deploy>`__ 来进行部署。 在 pai 模式中,会在 Docker 创建的容器中运行 Trial 程序。 - NNI 支持在 `OpenPAI <https://github.com/Microsoft/pai>`__ (aka 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.rst>`__ * - `Kubeflow <./KubeflowMode.rst>`__
- 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 作业来运行。 - 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 作业来运行。
* - `AdaptDL <./AdaptDLMode.rst>`__ * - `AdaptDL <./AdaptDLMode.rst>`__
- NNI 支持在 `AdaptDL <https://github.com/petuum/adaptdl>`__ 上运行,称为 AdaptDL 模式。 在开始使用 NNI kubeflow 模式之前,应该具有 Kubernetes 集群。 - NNI 支持在 `AdaptDL <https://github.com/petuum/adaptdl>`__ 上运行,称为 AdaptDL 模式。 在开始使用 AdaptDL 模式之前,应该具有 Kubernetes 集群。
* - `FrameworkController <./FrameworkControllerMode.rst>`__ * - `FrameworkController <./FrameworkControllerMode.rst>`__
- NNI 支持使用 `FrameworkController <https://github.com/Microsoft/frameworkcontroller>`__,来运行 Experiment,称之为 frameworkcontroller 模式。 FrameworkController 构建于 Kubernetes 上,用于编排各种应用。这样,可以不用为某个深度学习框架安装 Kubeflow 的 tf-operator 或 pytorch-operator 等。 而直接用 FrameworkController 作为 NNI Experiment 的训练平台。 - NNI 支持使用 `FrameworkController <https://github.com/Microsoft/frameworkcontroller>`__,来运行 Experiment,称之为 frameworkcontroller 模式。 FrameworkController 构建于 Kubernetes 上,用于编排各种应用。这样,可以不用为某个深度学习框架安装 Kubeflow 的 tf-operator 或 pytorch-operator 等。 而直接用 FrameworkController 作为 NNI Experiment 的训练平台。
* - `DLTS <./DLTSMode.rst>`__ * - `DLTS <./DLTSMode.rst>`__
...@@ -57,7 +57,7 @@ NNI 训练平台让用户专注于 AutoML 任务,不需要关心 Trial 实际 ...@@ -57,7 +57,7 @@ NNI 训练平台让用户专注于 AutoML 任务,不需要关心 Trial 实际
</p> </p>
根据 `概述 <../Overview>`__ 中展示的架构,训练平台会做三件事:1) 启动 Trial; 2) 收集指标,并与 NNI 核心(NNI 管理器)通信;3) 监控 Trial 任务状态。 为了展示训练平台的详细工作原理,下面介绍了训练平台从最开始到第一个 Trial 运行成功的过程。 根据 `概述 <../Overview.rst>`__ 中展示的架构,训练平台会做三件事:1) 启动 Trial; 2) 收集指标,并与 NNI 核心(NNI 管理器)通信;3) 监控 Trial 任务状态。 为了展示训练平台的详细工作原理,下面介绍了训练平台从最开始到第一个 Trial 运行成功的过程。
步骤 1. **验证配置,并准备训练平台。** 训练平台会首先检查用户配置是否正确(例如,身份验证是否有错)。 然后,训练平台会为 Experiment 做准备,创建训练平台可访问的代码目录( ``codeDir`` )。 步骤 1. **验证配置,并准备训练平台。** 训练平台会首先检查用户配置是否正确(例如,身份验证是否有错)。 然后,训练平台会为 Experiment 做准备,创建训练平台可访问的代码目录( ``codeDir`` )。
......
...@@ -12,7 +12,7 @@ NNI 支持在 `OpenPAI <https://github.com/Microsoft/pai>`__ 上运行 Experime ...@@ -12,7 +12,7 @@ NNI 支持在 `OpenPAI <https://github.com/Microsoft/pai>`__ 上运行 Experime
设置环境 设置环境
----------------- -----------------
**步骤 1. 参考** `指南 <../Tutorial/QuickStart.rst>`__ **安装 NNI。** **步骤 1. 参考 `指南 <../Tutorial/QuickStart.rst>`__ 安装 NNI。**
**步骤 2. 获得令牌(token)。** **步骤 2. 获得令牌(token)。**
...@@ -111,7 +111,7 @@ NNI 支持在 `OpenPAI <https://github.com/Microsoft/pai>`__ 上运行 Experime ...@@ -111,7 +111,7 @@ NNI 支持在 `OpenPAI <https://github.com/Microsoft/pai>`__ 上运行 Experime
Trial 配置 Trial 配置
^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^
与 `LocalMode <LocalMode.md>`__ 和 `RemoteMachineMode <RemoteMachineMode.rst>`__\ 相比, pai 模式下的 ``trial`` 配置有下面所列的其他 keys: 与 `LocalMode <LocalMode.rst>`__ 和 `RemoteMachineMode <RemoteMachineMode.rst>`__\ 相比, pai 模式下的 ``trial`` 配置有下面所列的其他 keys:
* *
...@@ -131,6 +131,8 @@ Trial 配置 ...@@ -131,6 +131,8 @@ Trial 配置
我们已经 build 了一个 docker image :githublink:`nnimsra/nni <deployment/docker/Dockerfile>`。 可以直接使用此映像,或参考它来生成自己的映像。 如果没在 Trial 配置中设置,则需要在 ``paiConfigPath`` 指定的配置文件中设置。 我们已经 build 了一个 docker image :githublink:`nnimsra/nni <deployment/docker/Dockerfile>`。 可以直接使用此映像,或参考它来生成自己的映像。 如果没在 Trial 配置中设置,则需要在 ``paiConfigPath`` 指定的配置文件中设置。
.. cannot find :githublink:`nnimsra/nni <deployment/docker/Dockerfile>`
* *
virtualCluster virtualCluster
...@@ -166,7 +168,7 @@ Trial 配置 ...@@ -166,7 +168,7 @@ Trial 配置
#. #.
OpenPAI 配置文件中的作业名称会由 NNI 指定,格式为:nni\ *exp*\ ${this.experimentId}*trial*\ ${trialJobId}。 OpenPAI 配置文件中的作业名称会由 NNI 指定,格式为:``nni_exp_${this.experimentId}_trial_${trialJobId}``
#. #.
如果在 OpenPAI 配置文件中有多个 taskRoles,NNI 会将这些 taksRoles 作为一个 Trial 任务,用户需要确保只有一个 taskRole 会将指标上传到 NNI 中,否则可能会产生错误。 如果在 OpenPAI 配置文件中有多个 taskRoles,NNI 会将这些 taksRoles 作为一个 Trial 任务,用户需要确保只有一个 taskRole 会将指标上传到 NNI 中,否则可能会产生错误。
...@@ -218,7 +220,7 @@ OpenPAI 配置 ...@@ -218,7 +220,7 @@ OpenPAI 配置
在 Trial 列表页面中展开 Trial 信息,点击如下的 logPath: 在 Trial 列表页面中展开 Trial 信息,点击如下的 logPath:
.. image:: ../../img/nni_webui_joblist.jpg .. image:: ../../img/nni_webui_joblist.png
:scale: 30% :scale: 30%
接着将会打开 HDFS 的 WEB 界面,并浏览到 Trial 的输出文件: 接着将会打开 HDFS 的 WEB 界面,并浏览到 Trial 的输出文件:
...@@ -248,5 +250,5 @@ OpenPAI 配置 ...@@ -248,5 +250,5 @@ OpenPAI 配置
如果 Experiment 无法运行,而且不能确认是否是因为版本不匹配造成的,可以在 Web 界面检查是否有相关的错误消息。 如果 Experiment 无法运行,而且不能确认是否是因为版本不匹配造成的,可以在 Web 界面检查是否有相关的错误消息。
.. image:: ../../img/version_check.png .. image:: ../../img/webui-img/experimentError.png
:scale: 80% :scale: 80%
.. role:: raw-html(raw)
:format: html
**在 OpenPAIYarn 上运行 Experiment**
========================================
原始的 ``pai`` 模式改为了 ``paiYarn`` 模式,这是基于 Yarn 的分布式训练平台。
设置环境
-----------------
参考 `指南 <../Tutorial/QuickStart.rst>`__ 安装 NNI。
运行实验
-----------------
以 ``examples/trials/mnist-tfv1`` 为例。 NNI 的 YAML 配置文件如下:
.. code-block:: yaml
authorName: your_name
experimentName: auto_mnist
# how many trials could be concurrently running
trialConcurrency: 2
# maximum experiment running duration
maxExecDuration: 3h
# empty means never stop
maxTrialNum: 100
# choice: local, remote, pai, paiYarn
trainingServicePlatform: paiYarn
# search space file
searchSpacePath: search_space.json
# choice: true, false
useAnnotation: false
tuner:
builtinTunerName: TPE
classArgs:
optimize_mode: maximize
trial:
command: python3 mnist.py
codeDir: ~/nni/examples/trials/mnist-tfv1
gpuNum: 0
cpuNum: 1
memoryMB: 8196
image: msranni/nni:latest
# Configuration to access OpenpaiYarn Cluster
paiYarnConfig:
userName: your_paiYarn_nni_user
passWord: your_paiYarn_password
host: 10.1.1.1
注意:如果用 paiYarn 模式运行,需要在 YAML 文件中设置 ``trainingServicePlatform: paiYarn`` 。
与 `LocalMode <LocalMode.md>`__ 和 `RemoteMachineMode <RemoteMachineMode.rst>`__\ 相比, paiYarn 模式下的 trial 配置有其他 keys:
* cpuNum
* 必填。 Trial 程序的 CPU 需求,必须为正数。
* memoryMB
* 必填。 Trial 程序的内存需求,必须为正数。
* image
* 必填。 在 paiYarn 模式下,OpenpaiYarn 将安排试用程序在 `Docker 容器 <https://www.docker.com/>`__ 中运行。 此键用来指定 Trial 程序的容器使用的 Docker 映像。
* 我们已经 build 了一个 docker image :githublink:`nnimsra/nni <deployment/docker/Dockerfile>`。 可以直接使用此映像,或参考它来生成自己的映像。
* virtualCluster
* 可选。 设置 OpenPAIYarn 的 virtualCluster,即虚拟集群。 如果未设置此参数,将使用默认的虚拟集群。
* shmMB
* 可选。 设置 OpenPAIYarn 的 shmMB,即 Docker 中的共享内存。
* authFile
* 可选。在使用 paiYarn 模式时,为私有 Docker 仓库设置认证文件,`见参考文档 <https://github.com/microsoft/paiYarn/blob/2ea69b45faa018662bc164ed7733f6fdbb4c42b3/docs/faq.rst#q-how-to-use-private-docker-registry-job-image-when-submitting-an-openpaiYarn-job>`__\。提供 authFile 的本地路径即可, NNI 会上传此文件。
*
portList
*
可选。 设置 OpenPAIYarn 的 portList。指定了容器中使用的端口列表,`参考文档 <https://github.com/microsoft/paiYarn/blob/b2324866d0280a2d22958717ea6025740f71b9f0/docs/job_tutorial.rst#specification>`__。\ :raw-html:`<br>`
NNI 中的配置架构如下所示:
.. code-block:: bash
portList:
- label: test
beginAt: 8080
portNumber: 2
假设需要在 MNIST 示例中使用端口来运行 TensorBoard。 第一步是编写 ``mnist.py`` 的包装脚本 ``launch_paiYarn.sh``。
.. code-block:: bash
export TENSORBOARD_PORT=paiYarn_PORT_LIST_${paiYarn_CURRENT_TASK_ROLE_NAME}_0_tensorboard
tensorboard --logdir . --port ${!TENSORBOARD_PORT} &
python3 mnist.py
portList 的配置部分如下:
.. code-block:: yaml
trial:
command: bash launch_paiYarn.sh
portList:
- label: tensorboard
beginAt: 0
portNumber: 1
NNI 支持 OpenPAIYarn 中的两种认证授权方法,即密码和 paiYarn 令牌(token),`参考 <https://github.com/microsoft/paiYarn/blob/b6bd2ab1c8890f91b7ac5859743274d2aa923c22/docs/rest-server/API.rst#2-authentication>`__。 授权在 ``paiYarnConfig`` 字段中配置。\ :raw-html:`<br>`
密码认证的 ``paiYarnConfig`` 配置如下:
.. code-block:: bash
paiYarnConfig:
userName: your_paiYarn_nni_user
passWord: your_paiYarn_password
host: 10.1.1.1
paiYarn 令牌认证的 ``paiYarnConfi`` 配置如下:
.. code-block:: bash
paiYarnConfig:
userName: your_paiYarn_nni_user
token: your_paiYarn_token
host: 10.1.1.1
完成并保存 NNI Experiment 配置文件后(例如可保存为:exp_paiYarn.yml),运行以下命令:
.. code-block:: bash
nnictl create --config exp_paiYarn.yml
来在 paiYarn 模式下启动 Experiment。 NNI 会为每个 Trial 创建 OpenpaiYarn 作业,作业名称的格式为 ``nni_exp_{experiment_id}_trial_{trial_id}``。
可以在 OpenPAIYarn 集群的网站中看到 NNI 创建的作业,例如:
.. image:: ../../img/nni_pai_joblist.jpg
:target: ../../img/nni_pai_joblist.jpg
:alt:
注意:paiYarn 模式下,NNIManager 会启动 RESTful 服务,监听端口为 NNI 网页服务器的端口加 1。 例如,如果网页端口为 ``8080``,那么 RESTful 服务器会监听在 ``8081`` 端口,来接收运行在 Kubernetes 中的 Trial 作业的指标。 因此,需要在防火墙中启用端口 ``8081`` 的 TCP 协议,以允许传入流量。
当一个 Trial 作业完成后,可以在 NNI 网页的概述页面(如:http://localhost:8080/oview)中查看 Trial 的信息。
在 Trial 列表页面中展开 Trial 信息,点击如下的 logPath:
.. image:: ../../img/nni_webui_joblist.jpg
:target: ../../img/nni_webui_joblist.jpg
:alt:
接着将会打开 HDFS 的 WEB 界面,并浏览到 Trial 的输出文件:
.. image:: ../../img/nni_trial_hdfs_output.jpg
:target: ../../img/nni_trial_hdfs_output.jpg
:alt:
在输出目录中可以看到三个文件:stderr,stdout 以及 trial.log。
数据管理
---------------
如果训练数据集不大,可放在 codeDir中,NNI会将其上传到 HDFS,或者构建 Docker 映像来包含数据。 如果数据集非常大,则不可放在 codeDir 中,可参考此 `指南 <https://github.com/microsoft/paiYarn/blob/master/docs/user/storage.rst>`__ 来将数据目录挂载到容器中。
如果要将 Trial 的其它输出保存到 HDFS 上,如模型文件等,需要在 Trial 代码中使用 ``NNI_OUTPUT_DIR`` 来保存输出文件。NNI 的 SDK 会将文件从 Trial 容器的 ``NNI_OUTPUT_DIR`` 复制到 HDFS 上,目标路径为:``hdfs://host:port/{username}/nni/{experiments}/{experimentId}/trials/{trialId}/nnioutput``。
版本校验
-------------
从 0.6 开始,NNI 支持版本校验。 确保 NNIManager 与 trialKeeper 的版本一致,避免兼容性错误。
检查策略:
#. 0.6 以前的 NNIManager 可与任何版本的 trialKeeper 一起运行,trialKeeper 支持向后兼容。
#. 从 NNIManager 0.6 开始,与 triakKeeper 的版本必须一致。 例如,如果 NNIManager 是 0.6 版,则 trialKeeper 也必须是 0.6 版。
#. 注意,只有版本的前两位数字才会被检查。例如,NNIManager 0.6.1 可以和 trialKeeper 的 0.6 或 0.6.2 一起使用,但不能与 trialKeeper 的 0.5.1 或 0.7 版本一起使用。
如果 Experiment 无法运行,而且不能确认是否是因为版本不匹配造成的,可以在 Web 界面检查是否有相关的错误消息。
.. image:: ../../img/version_check.png
:target: ../../img/version_check.png
:alt:
...@@ -13,7 +13,7 @@ NNI 可以通过 SSH 在多个远程计算机上运行同一个 Experiment,称 ...@@ -13,7 +13,7 @@ NNI 可以通过 SSH 在多个远程计算机上运行同一个 Experiment,称
确保远程计算机的默认环境符合 Trial 代码的需求。 如果默认环境不符合要求,可以将设置脚本添加到 NNI 配置的 ``command`` 字段。 确保远程计算机的默认环境符合 Trial 代码的需求。 如果默认环境不符合要求,可以将设置脚本添加到 NNI 配置的 ``command`` 字段。
* *
确保远程计算机能被运行 ``nnictl`` 命令的计算机通过 SSH 访问。 同时支持 SSH 的密码和密钥验证方法。 高级用法请参考 `实验配置参考 <../Tutorial/ExperimentConfig.rst>`__ 。 确保远程计算机能被运行 ``nnictl`` 命令的计算机通过 SSH 访问。 同时支持 SSH 的密码和密钥验证方法。 高级用法请参考 `machineList part of configuration <../Tutorial/ExperimentConfig.rst>`__ 。
* *
确保每台计算机上的 NNI 版本一致。 确保每台计算机上的 NNI 版本一致。
...@@ -25,14 +25,14 @@ Linux ...@@ -25,14 +25,14 @@ Linux
^^^^^ ^^^^^
* 按照 `安装教程 <../Tutorial/InstallationLinux.rst>`__ 在远程计算机上安装 NNI 。 * 按照 `安装教程 <../Tutorial/InstallationLinux.rst>`__ 在远程计算机上安装 NNI 。
Windows Windows
^^^^^^^ ^^^^^^^
* *
按照 `安装教程 <../Tutorial/InstallationLinux.rst>`__ 在远程计算机上安装 NNI 。 按照 `安装教程 <../Tutorial/InstallationLinux.rst>`__ 在远程计算机上安装 NNI 。
* *
安装并启动 ``OpenSSH Server``。 安装并启动 ``OpenSSH Server``。
...@@ -176,44 +176,13 @@ Windows ...@@ -176,44 +176,13 @@ Windows
- ip: ${replace_to_your_remote_machine_ip} - ip: ${replace_to_your_remote_machine_ip}
username: ${replace_to_your_remote_machine_username} username: ${replace_to_your_remote_machine_username}
sshKeyPath: ${replace_to_your_remote_machine_sshKeyPath} sshKeyPath: ${replace_to_your_remote_machine_sshKeyPath}
# Pre-command will be executed before the remote machine executes other commands.
# Below is an example of specifying python environment. # Below is an example of specifying python environment.
# If you want to execute multiple commands, please use "&&" to connect them. pythonPath: ${replace_to_python_environment_path_in_your_remote_machine}
# preCommand: source ${replace_to_absolute_path_recommended_here}/bin/activate
# preCommand: source ${replace_to_conda_path}/bin/activate ${replace_to_conda_env_name}
preCommand: export PATH=${replace_to_python_environment_path_in_your_remote_machine}:$PATH
在远程机器执行其他命令之前,将执行 **预命令**。 因此,可以像这样配置 python 环境路径: 远程计算机支持以重用模式运行实验。 在这种模式下,NNI 将重用远程机器任务来运行尽可能多的 Trial. 这样可以节省创建新作业的时间。 用户需要确保同一作业中的每个 Trial 相互独立,例如,要避免从之前的 Trial 中读取检查点。
按照以下设置启用重用模式:
.. code-block:: yaml .. code-block:: yaml
# Linux remote machine remoteConfig:
preCommand: export PATH=${replace_to_python_environment_path_in_your_remote_machine}:$PATH reuse: true
# Windows remote machine \ No newline at end of file
preCommand: set path=${replace_to_python_environment_path_in_your_remote_machine};%path%
或者,如果想激活 ``virtualen`` 环境:
.. code-block:: yaml
# Linux remote machine
preCommand: source ${replace_to_absolute_path_recommended_here}/bin/activate
# Windows remote machine
preCommand: ${replace_to_absolute_path_recommended_here}\\scripts\\activate
或者,如果想激活 ``conda`` 环境:
.. code-block:: yaml
# Linux remote machine
preCommand: source ${replace_to_conda_path}/bin/activate ${replace_to_conda_env_name}
# Windows remote machine
preCommand: call activate ${replace_to_conda_env_name}
如果要执行多个命令,可以使用 ``&&`` 连接以下命令:
.. code-block:: yaml
preCommand: command1 && command2 && command3
**注意**:因为 ``preCommand`` 每次都会在其他命令之前执行,所以强烈建议不要设置 **preCommand** 来对系统进行更改,即 ``mkdir`` or ``touch``.
...@@ -13,7 +13,7 @@ CIFAR-10 示例 ...@@ -13,7 +13,7 @@ CIFAR-10 示例
本例中,选择了以下常见的深度学习优化器: 本例中,选择了以下常见的深度学习优化器:
.. .. code-block:: bash
"SGD", "Adadelta", "Adagrad", "Adam", "Adamax" "SGD", "Adadelta", "Adagrad", "Adam", "Adamax"
...@@ -48,7 +48,7 @@ NNI 与 CIFAR-10 ...@@ -48,7 +48,7 @@ NNI 与 CIFAR-10
"model":{"_type":"choice", "_value":["vgg", "resnet18", "googlenet", "densenet121", "mobilenet", "dpn92", "senet18"]} "model":{"_type":"choice", "_value":["vgg", "resnet18", "googlenet", "densenet121", "mobilenet", "dpn92", "senet18"]}
} }
示例: :githublink:`search_space.json <examples/trials/cifar10_pytorch/search_space.json>` 代码示例: :githublink:`search_space.json <examples/trials/cifar10_pytorch/search_space.json>`
**Trial** **Trial**
...@@ -59,7 +59,7 @@ NNI 与 CIFAR-10 ...@@ -59,7 +59,7 @@ NNI 与 CIFAR-10
* 使用 ``nni.report_intermediate_result(acc)`` 在每个 epoch 结束时返回中间结果。 * 使用 ``nni.report_intermediate_result(acc)`` 在每个 epoch 结束时返回中间结果。
* 使用 ``nni.report_final_result(acc)`` 在每个 Trial 结束时返回最终结果。 * 使用 ``nni.report_final_result(acc)`` 在每个 Trial 结束时返回最终结果。
示例: :githublink:`main.py <examples/trials/cifar10_pytorch/main.py>` 代码示例: :githublink:`main.py <examples/trials/cifar10_pytorch/main.py>`
还可直接修改现有的代码来支持 Nni,参考:`如何实现 Trial <Trials.rst>`__。 还可直接修改现有的代码来支持 Nni,参考:`如何实现 Trial <Trials.rst>`__。
...@@ -71,9 +71,9 @@ NNI 与 CIFAR-10 ...@@ -71,9 +71,9 @@ NNI 与 CIFAR-10
这是在 OpenPAI 上运行 Experiment 的示例: 这是在 OpenPAI 上运行 Experiment 的示例:
代码 :githublink:`examples/trials/cifar10_pytorch/config_pai.yml <examples/trials/cifar10_pytorch/config_pai.yml>` 代码 :githublink:`examples/trials/cifar10_pytorch/config_pai.yml <examples/trials/cifar10_pytorch/config_pai.yml>`
完整示例 :githublink:`examples/trials/cifar10_pytorch/ <examples/trials/cifar10_pytorch>` 完整示例 :githublink:`examples/trials/cifar10_pytorch/ <examples/trials/cifar10_pytorch>`
运行 Experiment 运行 Experiment
^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^
......
...@@ -4,14 +4,13 @@ NNI 上的知识蒸馏 ...@@ -4,14 +4,13 @@ NNI 上的知识蒸馏
知识蒸馏 (Knowledge Distillation) 知识蒸馏 (Knowledge Distillation)
--------------------------------------- ---------------------------------------
知识蒸馏,在 `Distilling the Knowledge in a Neural Network <https://arxiv.org/abs/1503.02531>`__ 中,压缩模型被训练成模拟预训练的模型。 这种训练设置也称为"师生(teacher-student)"方式,其中大模型是教师,小模型是学生。 在 `Distilling the Knowledge in a Neural Network <https://arxiv.org/abs/1503.02531>`__\提出了知识蒸馏(KD)的概念, 压缩后的模型被训练去模仿预训练的、较大的模型。 这种训练设置也称为"师生(teacher-student)"方式,其中大模型是教师,小模型是学生。 KD 通常用于微调剪枝后的模型。
.. image:: ../../img/distill.png .. image:: ../../img/distill.png
:target: ../../img/distill.png :target: ../../img/distill.png
:alt: :alt:
用法 用法
^^^^^ ^^^^^
...@@ -19,24 +18,29 @@ PyTorch 代码 ...@@ -19,24 +18,29 @@ PyTorch 代码
.. code-block:: python .. code-block:: python
from knowledge_distill.knowledge_distill import KnowledgeDistill for batch_idx, (data, target) in enumerate(train_loader):
kd = KnowledgeDistill(kd_teacher_model, kd_T=5) data, target = data.to(device), target.to(device)
alpha = 1 optimizer.zero_grad()
beta = 0.8 y_s = model_s(data)
for batch_idx, (data, target) in enumerate(train_loader): y_t = model_t(data)
data, target = data.to(device), target.to(device) loss_cri = F.cross_entropy(y_s, target)
optimizer.zero_grad()
output = model(data) # kd 损失值
loss = F.cross_entropy(output, target) p_s = F.log_softmax(y_s/kd_T, dim=1)
# 只需要添加以下行来使用知识蒸馏微调模型 p_t = F.softmax(y_t/kd_T, dim=1)
loss = alpha * loss + beta * kd.loss(data=data, student_out=output) loss_kd = F.kl_div(p_s, p_t, size_average=False) * (self.T**2) / y_s.shape[0]
loss.backward()
# 总损失
loss = loss_cir + loss_kd
loss.backward()
微调剪枝模型的完整代码在 :githublink:`这里 <examples/model_compress/pruning/finetune_kd_torch.py>`
.. code-block:: python
知识蒸馏的用户配置 python finetune_kd_torch.py --model [model name] --teacher-model-dir [pretrained checkpoint path] --student-model-dir [pruned checkpoint path] --mask-path [mask file path]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
请注意:要微调剪枝后的模型,请先运行 :githublink:`basic_pruners_torch.py <examples/model_compress/pruning/basic_pruners_torch.py>` 来获取掩码文件,然后将掩码路径作为参数传递给脚本。
* **kd_teacher_model**:预训练过的教师模型
* **kd_T**:用于平滑教师模型输出的温度。
完整代码在 `这里 <https://github.com/microsoft/nni/tree/v1.3/examples/model_compress/knowledge_distill/>`__。
...@@ -8,8 +8,9 @@ MNIST 示例 ...@@ -8,8 +8,9 @@ MNIST 示例
在深度学习中,用 CNN 来分类 MNIST 数据,就像介绍编程语言中的 ``hello world`` 示例。 因此,NNI 将 MNIST 作为示例来介绍功能。 示例如下: 在深度学习中,用 CNN 来分类 MNIST 数据,就像介绍编程语言中的 ``hello world`` 示例。 因此,NNI 将 MNIST 作为示例来介绍功能。 示例如下:
* `MNIST 中使用 NNI API (TensorFlow v1.x) <#mnist-tfv1>`__ * `MNIST 中使用 NNI API (PyTorch) <#mnist-pytorch>`__
* `MNIST 中使用 NNI API (TensorFlow v2.x) <#mnist-tfv2>`__ * `MNIST 中使用 NNI API (TensorFlow v2.x) <#mnist-tfv2>`__
* `MNIST 中使用 NNI API (TensorFlow v1.x) <#mnist-tfv1>`__
* `MNIST 中使用 NNI 标记(annotation) <#mnist-annotation>`__ * `MNIST 中使用 NNI 标记(annotation) <#mnist-annotation>`__
* `在 keras 中使用 MNIST <#mnist-keras>`__ * `在 keras 中使用 MNIST <#mnist-keras>`__
* `MNIST -- 用批处理 tuner 来调优 <#mnist-batch>`__ * `MNIST -- 用批处理 tuner 来调优 <#mnist-batch>`__
...@@ -18,65 +19,70 @@ MNIST 示例 ...@@ -18,65 +19,70 @@ MNIST 示例
* `用 Kubeflow 运行分布式的 MNIST(TensorFlow) <#mnist-kubeflow-tf>`__ * `用 Kubeflow 运行分布式的 MNIST(TensorFlow) <#mnist-kubeflow-tf>`__
* `用 Kubeflow 运行分布式的 MNIST(PyTorch) <#mnist-kubeflow-pytorch>`__ * `用 Kubeflow 运行分布式的 MNIST(PyTorch) <#mnist-kubeflow-pytorch>`__
:raw-html:`<a name="mnist-tfv1"></a>` :raw-html:`<a name="mnist-pytorch"></a>`
**MNIST 中使用 NNI API (TensorFlow v1.x)** **MNIST 中使用 NNI API (PyTorch)**
这是个简单的卷积网络,有两个卷积层,两个池化层和一个全连接层。 调优的超参包括 dropout 比率,卷积层大小,隐藏层(全连接层)大小等等。 它能用 NNI 中大部分内置的 Tuner 来调优,如 TPE,SMAC,Random。 示例的 YAML 文件也启用了评估器来提前终止一些中间结果不好的尝试。 这是个简单的卷积网络,有两个卷积层,两个池化层和一个全连接层。
调优的超参包括 dropout 比率,卷积层大小,隐藏层(全连接层)大小等等。
它能用 NNI 中大部分内置的 Tuner 来调优,如 TPE,SMAC,Random。
示例的 YAML 文件也启用了评估器来提前终止一些中间结果不好的尝试。
``代码目录:examples/trials/mnist-tfv1/`` 代码示例: :githublink:`mnist-pytorch/ <examples/trials/mnist-pytorch/>`
:raw-html:`<a name="mnist-tfv2"></a>` :raw-html:`<a name="mnist-tfv2"></a>`
**MNIST 中使用 NNI API (TensorFlow v2.x)** **MNIST 中使用 NNI API (TensorFlow v2.x)**
与上述示例的网络相同,但使用了 TensorFlow v2.x Keras API 与上述示例的网络相同,但使用了 TensorFlow。
``代码目录:examples/trials/mnist-tfv2/`` 代码示例: :githublink:`mnist-tfv2/ <examples/trials/mnist-tfv2/>`
:raw-html:`<a name="mnist-annotation"></a>` :raw-html:`<a name="mnist-tfv1"></a>`
**MNIST 中使用 NNI 标记(annotation)** **MNIST 中使用 NNI API (TensorFlow v1.x)**
此样例与上例类似,上例使用的是 NNI API 来指定搜索空间并返回结果,而此例使用的是 NNI 标记 与上述示例的网络相同,但使用了 TensorFlow v1.x Keras API
``代码目录:examples/trials/mnist-annotation/`` 代码示例: :githublink:`mnist-tfv1/ <examples/trials/mnist-tfv1/>`
:raw-html:`<a name="mnist-keras"></a>` :raw-html:`<a name="mnist-annotation"></a>`
**在 Keras 中使用 MNIST** **MNIST 中使用 NNI 标记(annotation)**
此样例由 Keras 实现。 这也MNIST 数据集的网络,包括两个卷积层,一个池化层和两个全连接层 此样例与上例类似,上例使用的是 NNI API 来指定搜索空间并返回结果,而此例使用的NNI 标记
``代码目录:examples/trials/mnist-keras/`` 代码示例: :githublink:`mnist-annotation/ <examples/trials/mnist-annotation/>`
:raw-html:`<a name="mnist-batch"></a>` :raw-html:`<a name="mnist-batch"></a>`
**MNIST -- 用批处理 Tuner 来调优** **MNIST -- 用批处理 Tuner 来调优**
此样例演示了如何使用批处理 Tuner。 只需要在搜索空间文件中列出所有要尝试的配置, NNI 会逐个尝试。 此样例演示了如何使用批处理 Tuner。 只需要在搜索空间文件中列出所有要尝试的配置, NNI 会逐个尝试。
``代码目录:examples/trials/mnist-batch-tune-keras/`` 代码示例: :githublink:`mnist-batch-tune-keras/ <examples/trials/mnist-batch-tune-keras/>`
:raw-html:`<a name="mnist-hyperband"></a>` :raw-html:`<a name="mnist-hyperband"></a>`
**MNIST -- 用 hyperband 调优** **MNIST -- 用 hyperband 调优**
此样例演示了如何使用 hyperband 来调优模型。 在尝试收到的配置中,有个主键叫做 ``STEPS``,尝试要用它来控制运行多长时间(例如,控制迭代的次数)。 此样例演示了如何使用 hyperband 来调优模型。 在尝试收到的配置中,有个主键叫做 ``STEPS``,尝试要用它来控制运行多长时间(例如,控制迭代的次数)。
``代码目录:examples/trials/mnist-hyperband/`` .. cannot find :githublink:`mnist-hyperband/ <examples/trials/mnist-hyperband/>`
代码示例: :githublink:`mnist-hyperband/ <examples/trials/mnist-hyperband/>`
:raw-html:`<a name="mnist-nested"></a>` :raw-html:`<a name="mnist-nested"></a>`
**MNIST -- 用嵌套搜索空间调优** **MNIST -- 用嵌套搜索空间调优**
此样例演示了 NNI 如何支持嵌套的搜索空间。 搜索空间文件示了如何定义嵌套的搜索空间。 此样例演示了 NNI 如何支持嵌套的搜索空间。 搜索空间文件示了如何定义嵌套的搜索空间。
``代码目录:examples/trials/mnist-nested-search-space/`` 代码示例: :githublink:`mnist-nested-search-space/ <examples/trials/mnist-nested-search-space/>`
:raw-html:`<a name="mnist-kubeflow-tf"></a>` :raw-html:`<a name="mnist-kubeflow-tf"></a>`
**用 Kubeflow 运行分布式的 MNIST (tensorflow)** **用 Kubeflow 运行分布式的 MNIST (tensorflow)**
此样例展示了如何通过 NNI 来在 Kubeflow 上运行分布式训练。 只需要简单的提供分布式训练代码,并在配置文件中指定 kubeflow 模式。 例如,运行 ps 和 worker 的命令行,以及各自需要的资源。 此样例使用了 Tensorflow 来实现,因而,需要使用 Kubeflow 的 tf-operator。 此样例展示了如何通过 NNI 来在 Kubeflow 上运行分布式训练。 只需要简单的提供分布式训练代码,并在配置文件中指定 kubeflow 模式。 例如,运行 ps 和 worker 的命令行,以及各自需要的资源。 此样例使用了 Tensorflow 来实现,因而,需要使用 Kubeflow 的 tf-operator。
``代码目录:examples/trials/mnist-distributed/`` 代码示例: :githublink:`mnist-distributed/ <examples/trials/mnist-distributed/>`
:raw-html:`<a name="mnist-kubeflow-pytorch"></a>` :raw-html:`<a name="mnist-kubeflow-pytorch"></a>`
**用 Kubeflow 运行分布式的 MNIST (PyTorch)** **用 Kubeflow 运行分布式的 MNIST (PyTorch)**
与前面的样例类似,不同之处是此样例是 Pytorch 实现的,因而需要使用 Kubeflow 的 pytorch-operator。 与前面的样例类似,不同之处是此样例是 Pytorch 实现的,因而需要使用 Kubeflow 的 pytorch-operator。
``代码目录:examples/trials/mnist-distributed-pytorch/`` 代码示例: :githublink:`mnist-distributed-pytorch/ <examples/trials/mnist-distributed-pytorch/>`
...@@ -111,7 +111,7 @@ NNI 上调优张量算子 ...@@ -111,7 +111,7 @@ NNI 上调优张量算子
请注意,G-BFS 和 N-A2C 这两种方法是专为优化行和列为2的幂的矩阵相乘的平铺(tiling)策略而设计的,所以他们不能够兼容其他类型的搜索空间,因此不能够用来优化批量矩阵乘和2维卷积这两种张量算子。 这里,AutoTVM是由作者在 TVM 项目中实现的,因此调优结果打印在屏幕上,而不是报告给 NNI 管理器。 容器的端口 8080 绑定到主机的同一端口,因此可以通过 ``host_ip_addr:8080`` 访问 NNI Web 界面,并监视调优过程,如下面的屏幕截图所示。 请注意,G-BFS 和 N-A2C 这两种方法是专为优化行和列为2的幂的矩阵相乘的平铺(tiling)策略而设计的,所以他们不能够兼容其他类型的搜索空间,因此不能够用来优化批量矩阵乘和2维卷积这两种张量算子。 这里,AutoTVM是由作者在 TVM 项目中实现的,因此调优结果打印在屏幕上,而不是报告给 NNI 管理器。 容器的端口 8080 绑定到主机的同一端口,因此可以通过 ``host_ip_addr:8080`` 访问 NNI Web 界面,并监视调优过程,如下面的屏幕截图所示。
:raw-html:`<img src="https://github.com/microsoft/nni/blob/v2.0/docs/img/opevo.png?raw=true" />` .. image:: ../../img/opevo.png
引用 OpEvo 引用 OpEvo
------------ ------------
......
...@@ -8,11 +8,11 @@ ...@@ -8,11 +8,11 @@
RocksDB 的性能表现非常依赖于调优操作。 但由于其底层技术较复杂,可配置参数非常多,很难获得较好的配置。 NNI 可帮助解决此问题。 NNI 支持多种调优算法来为 RocksDB 搜索最好的配置,并支持本机、远程服务器和云服务等多种环境。 RocksDB 的性能表现非常依赖于调优操作。 但由于其底层技术较复杂,可配置参数非常多,很难获得较好的配置。 NNI 可帮助解决此问题。 NNI 支持多种调优算法来为 RocksDB 搜索最好的配置,并支持本机、远程服务器和云服务等多种环境。
本示例展示了如何使用 NNI,通过评测工具 ``db_bench`` 来找到 ``fillrandom`` 基准的最佳配置,此工具是 RocksDB 官方提供的评测工具。 在运行示例前,需要检查 NNI 已安装, `db_bench <https://github.com/facebook/rocksdb/wiki/Benchmarking-tools>`__ 已经加入到了 ``PATH`` 中。 参考 `这里 <../Tutorial/QuickStart.rst>`__ ,了解如何安装并准备 NNI 环境,参考 `这里 <https://github.com/facebook/rocksdb/blob/master/INSTALL.rst>`__ 来编译 RocksDB 以及 ``db_bench``。 本示例展示了如何使用 NNI,通过评测工具 ``db_bench`` 来找到 ``fillrandom`` 基准的最佳配置,此工具是 RocksDB 官方提供的评测工具。 在运行示例前,需要检查 NNI 已安装, `db_bench <https://github.com/facebook/rocksdb/wiki/Benchmarking-tools>`__ 已经加入到了 ``PATH`` 中。 参考 `这里 <../Tutorial/QuickStart.rst>`__ ,了解如何安装并准备 NNI 环境,参考 `这里 <https://github.com/facebook/rocksdb/blob/master/INSTALL.md>`__ 来编译 RocksDB 以及 ``db_bench``。
此简单脚本 :githublink:`db_bench_installation.sh <examples/trials/systems/rocksdb-fillrandom/db_bench_installation.sh>` 可帮助编译并在 Ubuntu 上安装 ``db_bench`` 及其依赖包。 可遵循相同的过程在其它系统中安装 RocksDB。 此简单脚本 :githublink:`db_bench_installation.sh <examples/trials/systems_auto_tuning/rocksdb-fillrandom/db_bench_installation.sh>` 可帮助编译并在 Ubuntu 上安装 ``db_bench`` 及其依赖包。 可遵循相同的过程在其它系统中安装 RocksDB。
代码目录: :githublink:`example/trials/systems/rocksdb-fillrandom <examples/trials/systems/rocksdb-fillrandom>` :githublink:`代码文件 <examples/trials/systems_auto_tuning/rocksdb-fillrandom>`
Experiment 设置 Experiment 设置
---------------- ----------------
...@@ -43,7 +43,7 @@ Experiment 设置 ...@@ -43,7 +43,7 @@ Experiment 设置
} }
} }
代码目录 :githublink:`example/trials/systems/rocksdb-fillrandom/search_space.json <examples/trials/systems/rocksdb-fillrandom/search_space.json>` :githublink:`代码文件 <examples/trials/systems_auto_tuning/rocksdb-fillrandom/search_space.json>`
基准测试 基准测试
^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^
...@@ -54,7 +54,7 @@ Experiment 设置 ...@@ -54,7 +54,7 @@ Experiment 设置
* 使用 ``nni.get_next_parameter()`` 来获取下一个系统配置。 * 使用 ``nni.get_next_parameter()`` 来获取下一个系统配置。
* 使用 ``nni.report_final_result(metric)`` 来返回测试结果。 * 使用 ``nni.report_final_result(metric)`` 来返回测试结果。
代码目录 :githublink:`example/trials/systems/rocksdb-fillrandom/main.py <examples/trials/systems/rocksdb-fillrandom/main.py>` :githublink:`代码文件 <examples/trials/systems_auto_tuning/rocksdb-fillrandom/main.py>`
配置文件 配置文件
^^^^^^^^^^^ ^^^^^^^^^^^
...@@ -63,11 +63,11 @@ Experiment 设置 ...@@ -63,11 +63,11 @@ Experiment 设置
这是使用 SMAC 算法调优 RocksDB 的示例: 这是使用 SMAC 算法调优 RocksDB 的示例:
代码目录 :githublink:`example/trials/systems/rocksdb-fillrandom/config_smac.yml <examples/trials/systems/rocksdb-fillrandom/config_smac.yml>` :githublink:`代码文件 <examples/trials/systems_auto_tuning/rocksdb-fillrandom/config_smac.yml>`
这是使用 TPE 算法调优 RocksDB 的示例: 这是使用 TPE 算法调优 RocksDB 的示例:
代码目录 :githublink:`example/trials/systems/rocksdb-fillrandom/config_tpe.yml <examples/trials/systems/rocksdb-fillrandom/config_tpe.yml>` :githublink:`代码文件 <examples/trials/systems_auto_tuning/rocksdb-fillrandom/config_tpe.yml>`
其它 Tuner 算法可以通过相同的方式来使用。 参考 `这里 <../Tuner/BuiltinTuner.rst>`__ 了解详情。 其它 Tuner 算法可以通过相同的方式来使用。 参考 `这里 <../Tuner/BuiltinTuner.rst>`__ 了解详情。
...@@ -97,7 +97,9 @@ Experiment 结果 ...@@ -97,7 +97,9 @@ Experiment 结果
详细的实验结果如下图所示。 水平轴是 Trial 的顺序。 垂直轴是指标,此例中为写入的 OPS。 蓝点表示使用的是 SMAC Tuner,橙色表示使用的是 TPE Tuner。 详细的实验结果如下图所示。 水平轴是 Trial 的顺序。 垂直轴是指标,此例中为写入的 OPS。 蓝点表示使用的是 SMAC Tuner,橙色表示使用的是 TPE Tuner。
.. image:: https://github.com/microsoft/nni/blob/v2.0/docs/img/rocksdb-fillrandom-plot.png?raw=true .. image:: ../../img/rocksdb-fillrandom-plot.png
:target: ../../img/rocksdb-fillrandom-plot.png
:alt: image
下表列出了两个 Tuner 获得的最佳 Trial 以及相应的参数和指标。 不出所料,两个 Tuner 都为 ``fillrandom`` 测试找到了一样的最佳配置。 下表列出了两个 Tuner 获得的最佳 Trial 以及相应的参数和指标。 不出所料,两个 Tuner 都为 ``fillrandom`` 测试找到了一样的最佳配置。
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
或手动下载 或手动下载
#. 在 https://rajpurkar.github.io/SQuAD-explorer/ 下载 "dev-v1.1.json""train-v1.1.json"。 #. 在 `这里 <https://rajpurkar.github.io/SQuAD-explorer/>`__ 下载 ``dev-v1.1.json````train-v1.1.json``
.. code-block:: bash .. code-block:: bash
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
wget https://rajpurkar.github.io/SQuAD-explorer/dataset/dev-v1.1.json wget https://rajpurkar.github.io/SQuAD-explorer/dataset/dev-v1.1.json
#. 在 https://nlp.stanford.edu/projects/glove/ 下载 "glove.840B.300d.txt"。 #. 在 `这里 <https://nlp.stanford.edu/projects/glove/>`__ 下载 ``glove.840B.300d.txt``
.. code-block:: bash .. code-block:: bash
...@@ -120,7 +120,7 @@ ...@@ -120,7 +120,7 @@
# 你的 nni_manager ip 地址 # 你的 nni_manager ip 地址
nniManagerIp: 10.10.10.10 nniManagerIp: 10.10.10.10
tuner: tuner:
codeDir: https://github.com/Microsoft/nni/tree/v1.9/examples/tuners/ga_customer_tuner codeDir: https://github.com/Microsoft/nni/tree/v2.0/examples/tuners/ga_customer_tuner
classFileName: customer_tuner.py classFileName: customer_tuner.py
className: CustomerTuner className: CustomerTuner
classArgs: classArgs:
......
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