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

Update Chinese translation (#3413)

parent b122c63d
Web 界面 Web 界面
=============== ===============
Experiment 管理
-----------------------
点击导航栏上的 ``All experiments`` 标签。
.. image:: ../../img/webui-img/managerExperimentList/experimentListNav.png
:target: ../../img/webui-img/managerExperimentList/experimentListNav.png
:alt: ExperimentList nav
* 在 ``All experiments`` 页面,可以看到机器上的所有 Experiment。
.. image:: ../../img/webui-img/managerExperimentList/expList.png
:target: ../../img/webui-img/managerExperimentList/expList.png
:alt: Experiments list
* 当您想查看 Experiment 的更多详细信息时,可以单击试验 ID ,如下所示:
.. image:: ../../img/webui-img/managerExperimentList/toAnotherExp.png
:target: ../../img/webui-img/managerExperimentList/toAnotherExp.png
:alt: See this experiment detail
* 如果在表格上有很多 Experiment ,可以使用 ``filter`` 按钮
.. image:: ../../img/webui-img/managerExperimentList/expFilter.png
:target: ../../img/webui-img/managerExperimentList/expFilter.png
:alt: filter button
查看概要页面 查看概要页面
----------------- -----------------
点击标签 "Overview" 点击 ``Overview`` 标签
* 在 Overview 标签上,可看到 Experiment Trial 的概况、搜索空间、以及最好的 Trial 结果。 如果想查看实验配置和搜索空间,点击右边的按钮 "Config" 和 "Search space" * 在 Overview 标签上,可看到 Experiment Trial 的概况、搜索空间、以及 ``top trials`` 的结果
.. image:: ../../img/webui-img/full-oview.png .. image:: ../../img/webui-img/full-oview.png
:target: ../../img/webui-img/full-oview.png :target: ../../img/webui-img/full-oview.png
:alt: :alt: overview
如果想查看 Experiment 配置和搜索空间,点击右边的 ``Search space`` 和 ``Config`` 按钮。
1. 搜索空间文件:
.. image:: ../../img/webui-img/searchSpace.png
:target: ../../img/webui-img/searchSpace.png
:alt: searchSpace
2. 配置文件:
.. image:: ../../img/webui-img/config.png
:target: ../../img/webui-img/config.png
:alt: config
* 你可以在这里查看和下载 ``nni-manager/dispatcher log files``。
.. image:: ../../img/webui-img/review-log.png
:target: ../../img/webui-img/review-log.png
:alt: logfile
...@@ -21,100 +85,100 @@ Web 界面 ...@@ -21,100 +85,100 @@ Web 界面
.. image:: ../../img/webui-img/refresh-interval.png .. image:: ../../img/webui-img/refresh-interval.png
:target: ../../img/webui-img/refresh-interval.png :target: ../../img/webui-img/refresh-interval.png
:alt: :alt: refresh
* "download" 按钮支持查看并下载 Experiment 结果,以及 NNI Manager、Dispatcher 的日志文件 * 单击按钮 ``Experiment summary`` 时,可以查看和下载实验结果(``实验配置``,``试验消息`` 和 ``中间指标`` )
.. image:: ../../img/webui-img/download.png .. image:: ../../img/webui-img/summary.png
:target: ../../img/webui-img/download.png :target: ../../img/webui-img/summary.png
:alt: :alt: summary
* 在这里修改实验配置(例如 maxExecDuration, maxTrialNum 和 trial concurrency) * 在这里修改 Experiment 配置(例如 ``maxExecDuration``, ``maxTrialNum````trial concurrency``
.. image:: ../../img/webui-img/edit-experiment-param.png .. image:: ../../img/webui-img/edit-experiment-param.png
:target: ../../img/webui-img/edit-experiment-param.png :target: ../../img/webui-img/edit-experiment-param.png
:alt: :alt: editExperimentParams
* 如果实验的状态为错误,可以单击错误框中的感叹号来查看日志消息。 * 通过单击 ``Learn about`` ,可以查看特定的错误消息和 ``nni-manager/dispatcher 日志文件``
.. image:: ../../img/webui-img/log-error.png .. image:: ../../img/webui-img/experimentError.png
:target: ../../img/webui-img/log-error.png :target: ../../img/webui-img/experimentError.png
:alt: :alt: experimentError
.. image:: ../../img/webui-img/review-log.png
:target: ../../img/webui-img/review-log.png
:alt:
* 可点击 "About" 查看版本信息和反馈任何问题。 * 可点击 ``About`` 查看版本信息和反馈任何问题。
查看任务默认指标 查看任务默认指标
----------------------- ----------------------------------------------
* 点击 "Default Metric" 来查看所有 Trial 的点图。 悬停鼠标来查看默认指标和搜索空间信息。 * 点击 ``Default Metric`` 来查看所有 Trial 的点图。 悬停鼠标来查看默认指标和搜索空间信息。
.. image:: ../../img/webui-img/default-metric.png .. image:: ../../img/webui-img/default-metric.png
:target: ../../img/webui-img/default-metric.png :target: ../../img/webui-img/default-metric.png
:alt: :alt: defaultMetricGraph
* 点击开关 "optimization curve" 来查看 Experiment 的优化曲线。 * 点击开关 ``optimization curve`` 来查看 Experiment 的优化曲线。
.. image:: ../../img/webui-img/best-curve.png .. image:: ../../img/webui-img/best-curve.png
:target: ../../img/webui-img/best-curve.png :target: ../../img/webui-img/best-curve.png
:alt: :alt: bestCurveGraph
查看超参 查看超参
-------------------- --------------------
点击 "Hyper Parameter" 标签查看图像。 点击 ``Hyper Parameter`` 标签查看图像。
* 可以添加/删除轴,或者拖动以交换图表上的轴。 * 可以 ``添加/删除`` 轴,或者拖动以交换图表上的轴。
* 可选择百分比查看最好的 Trial。 * 可选择百分比查看最好的 Trial。
.. image:: ../../img/webui-img/hyperPara.png .. image:: ../../img/webui-img/hyperPara.png
:target: ../../img/webui-img/hyperPara.png :target: ../../img/webui-img/hyperPara.png
:alt: :alt: hyperParameterGraph
查看 Trial 运行时间 查看 Trial 运行时间
------------------- -------------------
点击 "Trial Duration" 标签来查看柱状图。 点击 ``Trial Duration`` 标签来查看柱状图。
.. image:: ../../img/webui-img/trial_duration.png .. image:: ../../img/webui-img/trial_duration.png
:target: ../../img/webui-img/trial_duration.png :target: ../../img/webui-img/trial_duration.png
:alt: :alt: trialDurationGraph
查看 Trial 中间结果 查看 Trial 中间结果
------------------------------------ ------------------------------------
单击 "Intermediate Result" 标签查看折线图。 单击 ``Intermediate Result`` 标签查看折线图。
.. image:: ../../img/webui-img/trials_intermeidate.png .. image:: ../../img/webui-img/trials_intermeidate.png
:target: ../../img/webui-img/trials_intermeidate.png :target: ../../img/webui-img/trials_intermeidate.png
:alt: :alt: trialIntermediateGraph
Trial 可能在训练过程中有大量中间结果。 为了更清楚的理解一些 Trial 的趋势,可以为中间结果图设置过滤。 Trial 可能在训练过程中有大量中间结果。 为了更清楚的理解一些 Trial 的趋势,可以为中间结果图设置过滤。
...@@ -124,13 +188,14 @@ Trial 可能在训练过程中有大量中间结果。 为了更清楚的理解 ...@@ -124,13 +188,14 @@ Trial 可能在训练过程中有大量中间结果。 为了更清楚的理解
.. image:: ../../img/webui-img/filter-intermediate.png .. image:: ../../img/webui-img/filter-intermediate.png
:target: ../../img/webui-img/filter-intermediate.png :target: ../../img/webui-img/filter-intermediate.png
:alt: :alt: filterIntermediateGraph
查看 Trial 状态 查看 Trial 状态
------------------ ------------------
点击 "Trials Detail" 标签查看所有 Trial 的状态。 特别是: 点击 ``Trials Detail`` 标签查看所有 Trial 的状态。 特别是:
* Trial 详情:Trial 的 id,持续时间,开始时间,结束时间,状态,精度和搜索空间文件。 * Trial 详情:Trial 的 id,持续时间,开始时间,结束时间,状态,精度和搜索空间文件。
...@@ -138,30 +203,30 @@ Trial 可能在训练过程中有大量中间结果。 为了更清楚的理解 ...@@ -138,30 +203,30 @@ Trial 可能在训练过程中有大量中间结果。 为了更清楚的理解
.. image:: ../../img/webui-img/detail-local.png .. image:: ../../img/webui-img/detail-local.png
:target: ../../img/webui-img/detail-local.png :target: ../../img/webui-img/detail-local.png
:alt: :alt: detailLocalImage
* "Add column" 按钮可选择在表格中显示的列。 如果 Experiment 的最终结果是 dict,则可以在表格中查看其它键。 可选择 "Intermediate count" 列来查看 Trial 进度。 * ``Add column`` 按钮可选择在表格中显示的列。 如果 Experiment 的最终结果是 dict,则可以在表格中查看其它键。 可选择 ``Intermediate count`` 列来查看 Trial 进度。
.. image:: ../../img/webui-img/addColumn.png .. image:: ../../img/webui-img/addColumn.png
:target: ../../img/webui-img/addColumn.png :target: ../../img/webui-img/addColumn.png
:alt: :alt: addColumnGraph
* 如果要比较某些 Trial,可选择并点击 "Compare" 来查看结果。 * 如果要比较某些 Trial,可选择并点击 ``Compare`` 来查看结果。
.. image:: ../../img/webui-img/select-trial.png .. image:: ../../img/webui-img/select-trial.png
:target: ../../img/webui-img/select-trial.png :target: ../../img/webui-img/select-trial.png
:alt: :alt: selectTrialGraph
.. image:: ../../img/webui-img/compare.png .. image:: ../../img/webui-img/compare.png
:target: ../../img/webui-img/compare.png :target: ../../img/webui-img/compare.png
:alt: :alt: compareTrialsGraph
...@@ -170,16 +235,16 @@ Trial 可能在训练过程中有大量中间结果。 为了更清楚的理解 ...@@ -170,16 +235,16 @@ Trial 可能在训练过程中有大量中间结果。 为了更清楚的理解
.. image:: ../../img/webui-img/search-trial.png .. image:: ../../img/webui-img/search-trial.png
:target: ../../img/webui-img/search-trial.png :target: ../../img/webui-img/search-trial.png
:alt: :alt: searchTrial
* 可使用 "Copy as python" 按钮来拷贝 Trial 的参数。 * 可使用 ``Copy as python`` 按钮来拷贝 Trial 的参数。
.. image:: ../../img/webui-img/copyParameter.png .. image:: ../../img/webui-img/copyParameter.png
:target: ../../img/webui-img/copyParameter.png :target: ../../img/webui-img/copyParameter.png
:alt: :alt: copyTrialParameters
...@@ -188,7 +253,7 @@ Trial 可能在训练过程中有大量中间结果。 为了更清楚的理解 ...@@ -188,7 +253,7 @@ Trial 可能在训练过程中有大量中间结果。 为了更清楚的理解
.. image:: ../../img/webui-img/detail-pai.png .. image:: ../../img/webui-img/detail-pai.png
:target: ../../img/webui-img/detail-pai.png :target: ../../img/webui-img/detail-pai.png
:alt: :alt: detailPai
...@@ -197,7 +262,7 @@ Trial 可能在训练过程中有大量中间结果。 为了更清楚的理解 ...@@ -197,7 +262,7 @@ Trial 可能在训练过程中有大量中间结果。 为了更清楚的理解
.. image:: ../../img/webui-img/intermediate.png .. image:: ../../img/webui-img/intermediate.png
:target: ../../img/webui-img/intermediate.png :target: ../../img/webui-img/intermediate.png
:alt: :alt: intermeidateGraph
...@@ -206,5 +271,5 @@ Trial 可能在训练过程中有大量中间结果。 为了更清楚的理解 ...@@ -206,5 +271,5 @@ Trial 可能在训练过程中有大量中间结果。 为了更清楚的理解
.. image:: ../../img/webui-img/kill-running.png .. image:: ../../img/webui-img/kill-running.png
:target: ../../img/webui-img/kill-running.png :target: ../../img/webui-img/kill-running.png
:alt: :alt: killTrial
{
"cells": [
{
"cell_type": "markdown",
"id": "white-electron",
"metadata": {},
"source": [
"## 连接并管理已存在的 Experiment"
]
},
{
"cell_type": "markdown",
"id": "recent-italic",
"metadata": {},
"source": [
"### 1. 连接 Experiment"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "statistical-repair",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[2021-02-25 07:50:38] Tuner not set, wait for connect...\n",
"[2021-02-25 07:50:38] Connect to port 8080 success, experiment id is IF0JnfLE, status is RUNNING.\n"
]
}
],
"source": [
"from nni.experiment import Experiment\n",
"experiment = Experiment.connect(8080)"
]
},
{
"cell_type": "markdown",
"id": "defensive-scratch",
"metadata": {},
"source": [
"### 2. Experiment 查看和管理"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "independent-touch",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'id': 'IF0JnfLE',\n",
" 'revision': 6,\n",
" 'execDuration': 28,\n",
" 'logDir': '/home/ningshang/nni-experiments/IF0JnfLE',\n",
" 'nextSequenceId': 2,\n",
" 'params': {'authorName': 'default',\n",
" 'experimentName': 'example_sklearn-classification',\n",
" 'trialConcurrency': 1,\n",
" 'maxExecDuration': 3600,\n",
" 'maxTrialNum': 5,\n",
" 'searchSpace': '{\"C\": {\"_type\": \"uniform\", \"_value\": [0.1, 1]}, \"kernel\": {\"_type\": \"choice\", \"_value\": [\"linear\", \"rbf\", \"poly\", \"sigmoid\"]}, \"degree\": {\"_type\": \"choice\", \"_value\": [1, 2, 3, 4]}, \"gamma\": {\"_type\": \"uniform\", \"_value\": [0.01, 0.1]}, \"coef0\": {\"_type\": \"uniform\", \"_value\": [0.01, 0.1]}}',\n",
" 'trainingServicePlatform': 'local',\n",
" 'tuner': {'builtinTunerName': 'TPE',\n",
" 'classArgs': {'optimize_mode': 'maximize'},\n",
" 'checkpointDir': '/home/ningshang/nni-experiments/IF0JnfLE/checkpoint'},\n",
" 'versionCheck': True,\n",
" 'clusterMetaData': [{'key': 'trial_config',\n",
" 'value': {'command': 'python3 main.py',\n",
" 'codeDir': '/home/ningshang/nni/examples/trials/sklearn/classification/.',\n",
" 'gpuNum': 0}}]},\n",
" 'startTime': 1614239412494}"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"experiment.get_experiment_profile()"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "printable-bookmark",
"metadata": {},
"outputs": [],
"source": [
"experiment.update_max_trial_number(10)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "marine-serial",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'id': 'IF0JnfLE',\n",
" 'revision': 8,\n",
" 'execDuration': 32,\n",
" 'logDir': '/home/ningshang/nni-experiments/IF0JnfLE',\n",
" 'nextSequenceId': 2,\n",
" 'params': {'authorName': 'default',\n",
" 'experimentName': 'example_sklearn-classification',\n",
" 'trialConcurrency': 1,\n",
" 'maxExecDuration': 3600,\n",
" 'maxTrialNum': 10,\n",
" 'searchSpace': '{\"C\": {\"_type\": \"uniform\", \"_value\": [0.1, 1]}, \"kernel\": {\"_type\": \"choice\", \"_value\": [\"linear\", \"rbf\", \"poly\", \"sigmoid\"]}, \"degree\": {\"_type\": \"choice\", \"_value\": [1, 2, 3, 4]}, \"gamma\": {\"_type\": \"uniform\", \"_value\": [0.01, 0.1]}, \"coef0\": {\"_type\": \"uniform\", \"_value\": [0.01, 0.1]}}',\n",
" 'trainingServicePlatform': 'local',\n",
" 'tuner': {'builtinTunerName': 'TPE',\n",
" 'classArgs': {'optimize_mode': 'maximize'},\n",
" 'checkpointDir': '/home/ningshang/nni-experiments/IF0JnfLE/checkpoint'},\n",
" 'versionCheck': True,\n",
" 'clusterMetaData': [{'key': 'trial_config',\n",
" 'value': {'command': 'python3 main.py',\n",
" 'codeDir': '/home/ningshang/nni/examples/trials/sklearn/classification/.',\n",
" 'gpuNum': 0}}]},\n",
" 'startTime': 1614239412494}"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"experiment.get_experiment_profile()"
]
},
{
"cell_type": "markdown",
"id": "opened-lounge",
"metadata": {},
"source": [
"### 3. 停止 Experiment"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "emotional-machinery",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[2021-02-25 07:50:49] Stopping experiment, please wait...\n",
"[2021-02-25 07:50:49] Experiment stopped\n"
]
}
],
"source": [
"experiment.stop()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "nni-dev",
"language": "python",
"name": "nni-dev"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.9"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
{
"cells": [
{
"cell_type": "markdown",
"id": "technological-script",
"metadata": {},
"source": [
"## 启动并管理一个新的 Experiment"
]
},
{
"cell_type": "markdown",
"id": "immediate-daily",
"metadata": {},
"source": [
"### 1. 初始化 Tuner"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "formed-grounds",
"metadata": {},
"outputs": [],
"source": [
"from nni.algorithms.hpo.gridsearch_tuner import GridSearchTuner\n",
"tuner = GridSearchTuner()"
]
},
{
"cell_type": "markdown",
"id": "reported-somerset",
"metadata": {},
"source": [
"### 2. 定义搜索空间"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "potential-williams",
"metadata": {},
"outputs": [],
"source": [
"search_space = {\n",
" \"C\": {\"_type\":\"quniform\",\"_value\":[0.1, 1, 0.1]},\n",
" \"kernel\": {\"_type\":\"choice\",\"_value\":[\"linear\", \"rbf\", \"poly\", \"sigmoid\"]},\n",
" \"degree\": {\"_type\":\"choice\",\"_value\":[1, 2, 3, 4]},\n",
" \"gamma\": {\"_type\":\"quniform\",\"_value\":[0.01, 0.1, 0.01]},\n",
" \"coef0\": {\"_type\":\"quniform\",\"_value\":[0.01, 0.1, 0.01]}\n",
"}"
]
},
{
"cell_type": "markdown",
"id": "greek-archive",
"metadata": {},
"source": [
"### 3. 配置 Experiment "
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "fiscal-expansion",
"metadata": {},
"outputs": [],
"source": [
"from nni.experiment import Experiment\n",
"experiment = Experiment(tuner, 'local')\n",
"experiment.config.experiment_name = 'test'\n",
"experiment.config.trial_concurrency = 2\n",
"experiment.config.max_trial_number = 5\n",
"experiment.config.search_space = search_space\n",
"experiment.config.trial_command = 'python3 main.py'\n",
"experiment.config.trial_code_directory = './'"
]
},
{
"cell_type": "markdown",
"id": "received-tattoo",
"metadata": {},
"source": [
"### 4. 启动 Experiment"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "pleasant-patent",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[2021-02-22 12:27:11] Creating experiment, Experiment ID: bj025qo4\n",
"[2021-02-22 12:27:11] Connecting IPC pipe...\n",
"[2021-02-22 12:27:15] Statring web server...\n",
"[2021-02-22 12:27:16] Setting up...\n",
"[2021-02-22 12:27:16] Dispatcher started\n",
"[2021-02-22 12:27:16] Web UI URLs: http://127.0.0.1:8081 http://10.0.1.5:8081 http://172.17.0.1:8081\n"
]
}
],
"source": [
"experiment.start(8081)"
]
},
{
"cell_type": "markdown",
"id": "miniature-prison",
"metadata": {},
"source": [
"### 5. Experiment 查看和管理"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "animated-english",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'RUNNING'"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"experiment.get_status()"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "alpha-ottawa",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[TrialResult(parameter={'coef0': 0.01, 'gamma': 0.01, 'degree': 1, 'kernel': 'linear', 'C': 0.1}, value=0.9866666666666667, trialJobId='B55mT'),\n",
" TrialResult(parameter={'coef0': 0.02, 'gamma': 0.01, 'degree': 1, 'kernel': 'linear', 'C': 0.1}, value=0.9866666666666667, trialJobId='QkhD0')]"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"experiment.export_data()"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "unique-rendering",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'B55mT': [TrialMetricData(timestamp=1613996853005, trialJobId='B55mT', parameterId='0', type='FINAL', sequence=0, data=0.9866666666666667)],\n",
" 'QkhD0': [TrialMetricData(timestamp=1613996853843, trialJobId='QkhD0', parameterId='1', type='FINAL', sequence=0, data=0.9866666666666667)]}"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"experiment.get_job_metrics()"
]
},
{
"cell_type": "markdown",
"id": "welsh-difference",
"metadata": {},
"source": [
"### 6. 停止 Experiment"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "technological-cleanup",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[2021-02-22 12:28:16] Stopping experiment, please wait...\n",
"[2021-02-22 12:28:16] Dispatcher exiting...\n",
"[2021-02-22 12:28:17] Experiment stopped\n",
"[2021-02-22 12:28:19] Dispatcher terminiated\n"
]
}
],
"source": [
"experiment.stop()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "nni-dev",
"language": "python",
"name": "nni-dev"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.9"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
<div class="command">python3 -m pip install --upgrade nni</div> <div class="command">python3 -m pip install --upgrade nni</div>
<div class="command-intro">Windows</div> <div class="command-intro">Windows</div>
<div class="command">python -m pip install --upgrade nni</div> <div class="command">python -m pip install --upgrade nni</div>
<p class="topMargin">如果想要尝试最新代码,可通过源代码<a href="{{ pathto('Installation') }}">安装 <p class="topMargin">如果想要尝试最新代码,可通过源代码<a href="{{ pathto('installation') }}">安装
NNI</a> NNI</a>
</p> </p>
<p>Linux 和 macOS 下 NNI 系统需求<a href="{{ pathto('Tutorial/InstallationLinux') }}">参考这里</a>,Windows <a href="{{ pathto('Tutorial/InstallationWin') }}">参考这里</a></p> <p>Linux 和 macOS 下 NNI 系统需求<a href="{{ pathto('Tutorial/InstallationLinux') }}">参考这里</a>,Windows <a href="{{ pathto('Tutorial/InstallationWin') }}">参考这里</a></p>
...@@ -241,7 +241,7 @@ ...@@ -241,7 +241,7 @@
<li>如果遇到任何权限问题,可添加 --user 在用户目录中安装 NNI。</li> <li>如果遇到任何权限问题,可添加 --user 在用户目录中安装 NNI。</li>
<li>目前,Windows 上的 NNI 支持本机,远程和 OpenPAI 模式。 强烈推荐使用 Anaconda 或 Miniconda <a href="{{ pathto('Tutorial/InstallationWin') }}">在 Windows 上安装 NNI</a></li> <li>目前,Windows 上的 NNI 支持本机,远程和 OpenPAI 模式。 强烈推荐使用 Anaconda 或 Miniconda <a href="{{ pathto('Tutorial/InstallationWin') }}">在 Windows 上安装 NNI</a></li>
<li>如果遇到如 Segmentation fault 这样的任何错误请参考 <a <li>如果遇到如 Segmentation fault 这样的任何错误请参考 <a
href="{{ pathto('Tutorial/Installation') }}">常见问题</a>。 Windows 上的常见问题,参考在 <a href="{{ pathto('Tutorial/InstallationWin') }}">Windows 上使用 NNI</a></li> href="{{ pathto('installation') }}">常见问题</a>。 Windows 上的常见问题,参考在 <a href="{{ pathto('Tutorial/InstallationWin') }}">Windows 上使用 NNI</a></li>
</ul> </ul>
</div> </div>
<div> <div>
...@@ -361,8 +361,7 @@ You can use these commands to get more information about the experiment ...@@ -361,8 +361,7 @@ You can use these commands to get more information about the experiment
<li>在 NNI 中运行 <a href="{{ pathto('NAS/ENAS') }}">ENAS</a></li> <li>在 NNI 中运行 <a href="{{ pathto('NAS/ENAS') }}">ENAS</a></li>
<li> <li>
<a <a
href="https://github.com/microsoft/nni/blob/master/examples/feature_engineering/auto-feature-engineering/README.rst">Automatic href="https://github.com/microsoft/nni/blob/master/examples/feature_engineering/auto-feature-engineering/README_zh_CN.md">NNI 中的自动特征工程</a>
Feature Engineering</a> with NNI
</li> </li>
<li>使用 NNI 的 <a <li>使用 NNI 的 <a
href="https://github.com/microsoft/recommenders/blob/master/examples/04_model_select_and_optimize/nni_surprise_svd.ipynb">矩阵分解超参调优</a></li> href="https://github.com/microsoft/recommenders/blob/master/examples/04_model_select_and_optimize/nni_surprise_svd.ipynb">矩阵分解超参调优</a></li>
...@@ -430,7 +429,7 @@ You can use these commands to get more information about the experiment ...@@ -430,7 +429,7 @@ You can use these commands to get more information about the experiment
<div> <div>
<h1 class="title">相关项目</h1> <h1 class="title">相关项目</h1>
<p> <p>
以探索先进技术和开放为目标,<a href="https://www.microsoft.com/en-us/research/group/systems-research-group-asia/">Microsoft Research (MSR)</a> 还发布了一些相关的开源项目。</p> 以探索先进技术和开放为目标,<a href="https://www.microsoft.com/zh-cn/research/group/systems-and-networking-research-group-asia/">Microsoft Research (MSR)</a> 还发布了一些相关的开源项目。</p>
<ul id="relatedProject"> <ul id="relatedProject">
<li> <li>
<a href="https://github.com/Microsoft/pai">OpenPAI</a>:作为开源平台,提供了完整的 AI 模型训练和资源管理能力,能轻松扩展,并支持各种规模的私有部署、云和混合环境。 <a href="https://github.com/Microsoft/pai">OpenPAI</a>:作为开源平台,提供了完整的 AI 模型训练和资源管理能力,能轻松扩展,并支持各种规模的私有部署、云和混合环境。
...@@ -451,7 +450,7 @@ You can use these commands to get more information about the experiment ...@@ -451,7 +450,7 @@ You can use these commands to get more information about the experiment
<!-- License --> <!-- License -->
<div> <div>
<h1 class="title">许可协议</h1> <h1 class="title">许可协议</h1>
<p>The entire codebase is under <a href="https://github.com/microsoft/nni/blob/master/LICENSE">MIT license</a></p> <p>代码库遵循 <a href="https://github.com/microsoft/nni/blob/master/LICENSE">MIT 许可协议</a></p>
</div> </div>
</div> </div>
{% endblock %} {% endblock %}
...@@ -7,7 +7,7 @@ Assessor 从 Trial 中接收中间结果,并通过指定的算法决定此 Tri ...@@ -7,7 +7,7 @@ Assessor 从 Trial 中接收中间结果,并通过指定的算法决定此 Tri
这是 MNIST 在 "最大化" 模式下使用 "曲线拟合" Assessor 的实验结果。 可以看到 Assessor 成功的 **提前终止** 了许多结果不好超参组合的 Trial。 使用 Assessor,能在相同的计算资源下,得到更好的结果。 这是 MNIST 在 "最大化" 模式下使用 "曲线拟合" Assessor 的实验结果。 可以看到 Assessor 成功的 **提前终止** 了许多结果不好超参组合的 Trial。 使用 Assessor,能在相同的计算资源下,得到更好的结果。
代码: :githublink:`config_assessor.yml <examples/trials/mnist-tfv1/config_assessor.yml>` 代码 :githublink:`config_assessor.yml <examples/trials/mnist-pytorch/config_assessor.yml>`
.. image:: ../img/Assessor.png .. image:: ../img/Assessor.png
...@@ -16,4 +16,4 @@ Assessor 从 Trial 中接收中间结果,并通过指定的算法决定此 Tri ...@@ -16,4 +16,4 @@ Assessor 从 Trial 中接收中间结果,并通过指定的算法决定此 Tri
概述<./Assessor/BuiltinAssessor> 概述<./Assessor/BuiltinAssessor>
Medianstop<./Assessor/MedianstopAssessor> Medianstop<./Assessor/MedianstopAssessor>
Curvefitting(曲线拟合)<./Assessor/CurvefittingAssessor> Curvefitting(曲线拟合)<./Assessor/CurvefittingAssessor>
\ No newline at end of file
...@@ -21,13 +21,13 @@ sys.path.insert(0, os.path.abspath('../..')) ...@@ -21,13 +21,13 @@ sys.path.insert(0, os.path.abspath('../..'))
# -- Project information --------------------------------------------------- # -- Project information ---------------------------------------------------
project = 'NNI' project = 'NNI'
copyright = '2020, Microsoft' copyright = '2021, Microsoft'
author = 'Microsoft' author = 'Microsoft'
# The short X.Y version # The short X.Y version
version = '' version = ''
# The full version, including alpha/beta/rc tags # The full version, including alpha/beta/rc tags
release = 'v1.9' release = 'v2.0'
# -- General configuration --------------------------------------------------- # -- General configuration ---------------------------------------------------
...@@ -47,10 +47,11 @@ extensions = [ ...@@ -47,10 +47,11 @@ extensions = [
'sphinx.ext.intersphinx', 'sphinx.ext.intersphinx',
'nbsphinx', 'nbsphinx',
'sphinx.ext.extlinks', 'sphinx.ext.extlinks',
'IPython.sphinxext.ipython_console_highlighting',
] ]
# 添加示例模块 # 添加示例模块
autodoc_mock_imports = ['apex'] autodoc_mock_imports = ['apex', 'nni_node']
# Add any paths that contain templates here, relative to this directory. # Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates'] templates_path = ['_templates']
...@@ -72,7 +73,7 @@ language = None ...@@ -72,7 +73,7 @@ language = None
# List of patterns, relative to source directory, that match files and # List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files. # directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path. # This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', 'Release_v1.0.md'] exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', 'Release_v1.0.md', '**.ipynb_checkpoints']
# The name of the Pygments (syntax highlighting) style to use. # The name of the Pygments (syntax highlighting) style to use.
pygments_style = None pygments_style = None
......
...@@ -8,5 +8,4 @@ ...@@ -8,5 +8,4 @@
编写新的 Assessor <Assessor/CustomizeAssessor> 编写新的 Assessor <Assessor/CustomizeAssessor>
编写新的 Advisor <Tuner/CustomizeAdvisor> 编写新的 Advisor <Tuner/CustomizeAdvisor>
编写新的训练平台 <TrainingService/HowToImplementTrainingService> 编写新的训练平台 <TrainingService/HowToImplementTrainingService>
安装自定义的 Tuner,Assessor,Advisor <Tutorial/InstallCustomizedAlgos> 安装自定义的 Tuners/Assessors/Advisors <Tutorial/InstallCustomizedAlgos>
如何将自定义的 Tuner 安装为内置 Tuner <Tuner/InstallCustomizedTuner>
...@@ -28,5 +28,5 @@ NNI 中也内置了一些流程的模型压缩算法。 ...@@ -28,5 +28,5 @@ NNI 中也内置了一些流程的模型压缩算法。
剪枝 <Compression/pruning> 剪枝 <Compression/pruning>
量化 <Compression/quantization> 量化 <Compression/quantization>
工具 <Compression/CompressionUtils> 工具 <Compression/CompressionUtils>
框架 <Compression/Framework> 高级用法 <Compression/advanced>
自定义压缩算法 <Compression/CustomizeCompressor> API 参考 <Compression/CompressionReference>
...@@ -18,9 +18,10 @@ ...@@ -18,9 +18,10 @@
:maxdepth: 2 :maxdepth: 2
概述 <NAS/Overview> 概述 <NAS/Overview>
定义搜索空间 <NAS/WriteSearchSpace> 编写搜索空间 <NAS/WriteSearchSpace>
经典 NAS <NAS/ClassicNas> 经典 NAS <NAS/ClassicNas>
One-Shot NAS <NAS/one_shot_nas> One-Shot NAS <NAS/one_shot_nas>
Retiarii NAS(实验性) <NAS/retiarii/retiarii_index>
自定义 NAS 算法 <NAS/Advanced> 自定义 NAS 算法 <NAS/Advanced>
NAS 可视化 <NAS/Visualization> NAS 可视化 <NAS/Visualization>
搜索空间集合 <NAS/SearchSpaceZoo> 搜索空间集合 <NAS/SearchSpaceZoo>
......
NNI 客户端
==========
NNI 客户端是 ``nnictl`` 的python API,提供了对常用命令的实现。 相比于命令行,用户可以通过此 API 来在 python 代码中直接操控实验,收集实验结果并基于实验结果进行更加高级的分析。 示例如下:
.. code-block:: bash
from nni.experiment import Experiment
# 创建一个实验实例
exp = Experiment()
# 开始一个实验,将实例与实验连接
# 你也可以使用 `resume_experiment`, `view_experiment` 或者 `connect_experiment`
# 在一个实例中只能调用其中一个
exp.start_experiment('nni/examples/trials/mnist-pytorch/config.yml', port=9090)
# 更新实验的并发数量
exp.update_concurrency(3)
# 获取与实验相关的信息
print(exp.get_experiment_status())
print(exp.get_job_statistics())
print(exp.list_trial_jobs())
# 停止一个实验,将实例与实验断开
exp.stop_experiment()
参考
----------
.. autoclass:: nni.experiment.Experiment
:members:
.. autoclass:: nni.experiment.TrialJob
:members:
.. autoclass:: nni.experiment.TrialHyperParameters
:members:
.. autoclass:: nni.experiment.TrialMetricData
:members:
.. autoclass:: nni.experiment.TrialResult
:members:
...@@ -6,7 +6,10 @@ ...@@ -6,7 +6,10 @@
nnictl 命令 <Tutorial/Nnictl> nnictl 命令 <Tutorial/Nnictl>
Experiment 配置 <Tutorial/ExperimentConfig> Experiment 配置 <Tutorial/ExperimentConfig>
Experiment 配置第二版 <reference/experiment_config>
搜索空间<Tutorial/SearchSpaceSpec> 搜索空间<Tutorial/SearchSpaceSpec>
NNI Annotation<Tutorial/AnnotationSpec> NNI Annotation<Tutorial/AnnotationSpec>
SDK API 参考 <sdk_reference> SDK API 参考 <sdk_reference>
支持的框架和库 <SupportedFramework_Library> 支持的框架和库 <SupportedFramework_Library>
从 Python 发起实验 <Tutorial/HowToLaunchFromPython>
共享存储 <Tutorial/HowToUseSharedStorage>
===========================
Experiment(实验)配置参考
===========================
注意
=====
1. 此文档的字段使用 ``camelCase`` 法命名。
对于 Python 库 ``nni.experiment``,需要转换成 ``snake_case`` 形式。
2. 在此文档中,字段类型被格式化为 `Python 类型提示 <https://docs.python.org/3.10/library/typing.html>`__。
因此,JSON 对象被称为 `dict`,数组被称为 `list`。
.. _路径:
3. 一些字段采用文件或目录的路径,
除特别说明,均支持绝对路径和相对路径,``~`` 将扩展到 home 目录。
- 在写入 YAML 文件时,相对路径是相对于包含该文件目录的路径。
- 在 Python 代码中赋值时,相对路径是相对于当前工作目录的路径。
- 在将 YAML 文件加载到 Python 类,以及将 Python 类保存到 YAML 文件时,所有相对路径都转换为绝对路径。
4. 将字段设置为 ``None`` 或 ``null`` 时相当于不设置该字段。
示例
========
本机模式
^^^^^^^^^^
.. code-block:: yaml
experimentName: MNIST
searchSpaceFile: search_space.json
trialCommand: python mnist.py
trialCodeDirectory: .
trialGpuNumber: 1
maxExperimentDuration: 24h
maxTrialNumber: 100
tuner:
name: TPE
classArgs:
optimize_mode: maximize
trainingService:
platform: local
useActiveGpu: True
本机模式(内联搜索空间)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. code-block:: yaml
searchSpace:
batch_size:
_type: choice
_value: [16, 32, 64]
learning_rate:
_type: loguniform
_value: [0.0001, 0.1]
trialCommand: python mnist.py
trialGpuNumber: 1
tuner:
name: TPE
classArgs:
optimize_mode: maximize
trainingService:
platform: local
useActiveGpu: True
远程模式
^^^^^^^^^^^
.. code-block:: yaml
experimentName: MNIST
searchSpaceFile: search_space.json
trialCommand: python mnist.py
trialCodeDirectory: .
trialGpuNumber: 1
maxExperimentDuration: 24h
maxTrialNumber: 100
tuner:
name: TPE
classArgs:
optimize_mode: maximize
trainingService:
platform: remote
machineList:
- host: 11.22.33.44
user: alice
password: xxxxx
- host: my.domain.com
user: bob
sshKeyFile: ~/.ssh/id_rsa
参考
=========
Experiment 配置
^^^^^^^^^^^^^^^^
experimentName
--------------
Experiment 的助记名称, 这将显示在 WebUI 和 nnictl 中。
类型:``Optional[str]``
searchSpaceFile
---------------
包含搜索空间 JSON 文件的\ 路径_ 。
类型:``Optional[str]``
搜索空间格式由 Tuner 决定, 内置 Tuner 的通用格式在 `这里 <../Tutorial/SearchSpaceSpec.rst>`__。
与 `searchSpace`_ 互斥。
searchSpace
-----------
搜索空间对象。
类型:``Optional[JSON]``
格式由 Tuner 决定, 内置 Tuner 的通用格式在 `这里 <../Tutorial/SearchSpaceSpec.rst>`__。
注意,``None`` 意味着“没有这样的字段”,所以空的搜索空间应该写成 ``{}``。
与 `searchSpaceFile`_ 互斥。
trialCommand
------------
启动 Trial 的命令。
类型:``str``
该命令将在 Linux 和 macOS 上的 bash 中执行,在 Windows 上的 PowerShell 中执行。
trialCodeDirectory
------------------
到 Trial 源文件的目录的 路径_。
类型:``str``
默认值:``"."``
此目录中的所有文件都将发送到训练机器,除了 ``.nniignore`` 文件。
(详细信息,请参考 `快速入门 <../Tutorial/QuickStart.rst>`__ 的 nniignore 部分。)
trialConcurrency
----------------
指定同时运行的 Trial 数目。
类型:``int``
实际的并发性还取决于硬件资源,可能小于此值。
trialGpuNumber
--------------
每个 Trial 使用的 GPU 数目。
类型:``Optional[int]``
对于各种训练平台,这个字段的含义可能略有不同,
尤其是设置为 ``0`` 或者 ``None`` 时,
详情请参阅训练平台文件。
在本地模式下,将该字段设置为零将阻止 Trial 获取 GPU(通过置空 ``CUDA_VISIBLE_DEVICES`` )。
当设置为 ``None`` 时,Trial 将被创建和调度,就像它们不使用 GPU 一样,
但是它们仍然可以根据需要使用所有 GPU 资源。
maxExperimentDuration
---------------------
如果指定,将限制此 Experiment 的持续时间。
类型:``Optional[str]``
格式:``数字 + s|m|h|d``
示例:``"10m"``, ``"0.5h"``
当时间耗尽时,Experiment 将停止创建 Trial,但仍然服务于 web UI。
maxTrialNumber
--------------
如果指定,将限制创建的 Trial 数目。
类型:``Optional[int]``
当预算耗尽时,Experiment 将停止创建 Trial,但仍然服务于 web UI。
nniManagerIp
------------
当前机器的 IP,用于训练机器访问 NNI 管理器。 本机模式下不可选。
类型:``Optional[str]``
如果未指定,将使用 ``eth0`` 的 IPv4 地址。
必须在 Windows 和使用可预测网络接口名称的系统上设置,本地模式除外。
useAnnotation
-------------
启动 `annotation <../Tutorial/AnnotationSpec.rst>`__。
类型:``bool``
默认值:``false``
使用 annotation 时,`searchSpace`_ 和 `searchSpaceFile`_ 不应手动指定。
debug
-----
启动调试模式
类型:``bool``
默认值:``false``
启用后,日志记录将更加详细,并且一些内部验证将被放宽。
logLevel
--------
设置整个系统的日志级别。
类型:``Optional[str]``
候选项:``"trace"``, ``"debug"``, ``"info"``, ``"warning"``, ``"error"``, ``"fatal"``
默认为 "info" 或 "debug",取决于 `debug`_ 选项。
NNI 的大多数模块都会受到此值的影响,包括 NNI 管理器、Tuner、训练平台等。
Trial 是一个例外,它的日志记录级别由 Trial 代码直接管理。
对于 Python 模块,"trace" 充当日志级别0,"fatal" 表示 ``logging.CRITICAL``。
experimentWorkingDirectory
--------------------------
指定目录 `directory <path>`_ 来存放日志、检查点、元数据和其他运行时的内容。
类型:``Optional[str]``
默认:``~/nni-experiments``
NNI 将创建一个以 Experiment ID 命名的子目录,所以在多个 Experiment 中使用同一个目录不会有冲突。
tunerGpuIndices
---------------
设定对 Tuner、Assessor 和 Advisor 可见的 GPU。
类型:``Optional[list[int] | str]``
这将是 Tuner 进程的 ``CUDA_VISIBLE_DEVICES`` 环境变量,
因为 Tuner、Assessor 和 Advisor 在同一个进程中运行,所以此选项将同时影响它们。
tuner
-----
指定 Tuner。
类型:Optional `AlgorithmConfig`_
assessor
--------
指定 Assessor。
类型:Optional `AlgorithmConfig`_
advisor
-------
指定 Advisor。
类型:Optional `AlgorithmConfig`_
trainingService
---------------
指定 `训练平台 <../TrainingService/Overview.rst>`__。
类型:`TrainingServiceConfig`_
AlgorithmConfig
^^^^^^^^^^^^^^^
``AlgorithmConfig`` 描述 tuner / assessor / advisor 算法。
对于自定义算法,有两种方法来描述它们:
1. `注册算法 <../Tuner/InstallCustomizedTuner.rst>`__ ,像内置算法一样使用。 (首选)
2. 指定代码目录和类名。
name
----
内置或注册算法的名称。
类型:对于内置和注册算法使用 ``str``,其他自定义算法使用 ``None``
className
---------
未注册的自定义算法的限定类名。
类型:对于内置和注册算法使用 ``None``,其他自定义算法使用 ``str``
示例:``"my_tuner.MyTuner"``
codeDirectory
-------------
到自定义算法类的目录的 路径_。
类型:对于内置和注册算法使用 ``None``,其他自定义算法使用 ``str``
classArgs
---------
传递给算法类构造函数的关键字参数。
类型:``Optional[dict[str, Any]]``
有关支持的值,请参阅算法文档。
TrainingServiceConfig
^^^^^^^^^^^^^^^^^^^^^
以下之一:
- `LocalConfig`_
- `RemoteConfig`_
- `OpenpaiConfig <openpai-class>`_
- `AmlConfig`_
对于其他训练平台,目前 NNI 建议使用 `v1 配置模式 <../Tutorial/ExperimentConfig.rst>`_ 。
LocalConfig
^^^^^^^^^^^
详情查看 `这里 <../TrainingService/LocalMode.rst>`__。
platform
--------
字符串常量 ``"local"``。
useActiveGpu
------------
指定 NNI 是否应向被其他任务占用的 GPU 提交 Trial。
类型:``Optional[bool]``
必须在 ``trialgpunmber`` 大于零时设置。
如果您使用带有 GUI 的桌面系统,请将其设置为 ``True``。
maxTrialNumberPerGpu
---------------------
指定可以共享一个 GPU 的 Trial 数目。
类型:``int``
默认值:``1``
gpuIndices
----------
设定对 Trial 进程可见的 GPU。
类型:``Optional[list[int] | str]``
如果 `trialGpuNumber`_ 小于此值的长度,那么每个 Trial 只能看到一个子集。
这用作环境变量 ``CUDA_VISIBLE_DEVICES``。
RemoteConfig
^^^^^^^^^^^^
详情查看 `这里 <../TrainingService/RemoteMachineMode.rst>`__。
platform
--------
字符串常量 ``"remote"``。
machineList
-----------
训练机器列表
类型: `RemoteMachineConfig`_ 列表
reuseMode
---------
启动 `重用模式 <../Tutorial/ExperimentConfig.rst#reuse>`__。
类型:``bool``
RemoteMachineConfig
^^^^^^^^^^^^^^^^^^^
host
----
机器的 IP 或主机名(域名)。
类型:``str``
port
----
SSH 服务端口。
类型:``int``
默认值:``22``
user
----
登录用户名。
类型:``str``
password
--------
登录密码。
类型:``Optional[str]``
如果未指定,则将使用 `sshKeyFile`_。
sshKeyFile
----------
到 sshKeyFile的 路径_ 。
类型:``Optional[str]``
仅在未指定 `password`_ 时使用。
sshPassphrase
-------------
SSH 标识文件的密码。
类型:``Optional[str]``
useActiveGpu
------------
指定 NNI 是否应向被其他任务占用的 GPU 提交 Trial。
类型:``bool``
默认值:``false``
maxTrialNumberPerGpu
--------------------
指定可以共享一个 GPU 的 Trial 数目。
类型:``int``
默认值:``1``
gpuIndices
----------
设定对 Trial 进程可见的 GPU。
类型:``Optional[list[int] | str]``
如果 `trialGpuNumber`_ 小于此值的长度,那么每个 Trial 只能看到一个子集。
这用作环境变量 ``CUDA_VISIBLE_DEVICES``。
trialPrepareCommand
-------------------
启动 Trial 之前运行的命令。
类型:``Optional[str]``
如果不同机器的准备步骤不同,这将非常有用。
.. _openpai-class:
OpenpaiConfig
^^^^^^^^^^^^^
详情查看 `这里 <../TrainingService/PaiMode.rst>`__。
platform
--------
字符串常量 ``"openpai"``。
host
----
OpenPAI 平台的主机名。
类型:``str``
可能包括 ``https://`` 或 ``http://`` 前缀。
默认情况下将使用 HTTPS。
username
--------
OpenPAI 用户名。
类型:``str``
token
-----
OpenPAI 用户令牌。
类型:``str``
这可以在 OpenPAI 用户设置页面中找到。
dockerImage
-----------
运行 Trial 的 Docker 镜像的名称和标签。
类型:``str``
默认:``"msranni/nni:latest"``
nniManagerStorageMountPoint
---------------------------
当前机器中存储服务(通常是NFS)的挂载点路径。
类型:``str``
containerStorageMountPoint
--------------------------
Docker 容器中存储服务(通常是NFS)的挂载点。
类型:``str``
这必须是绝对路径。
reuseMode
---------
启动 `重用模式 <../Tutorial/ExperimentConfig.rst#reuse>`__。
类型:``bool``
默认值:``false``
openpaiConfig
-------------
嵌入的 OpenPAI 配置文件。
类型:``Optional[JSON]``
openpaiConfigFile
-----------------
到 OpenPAI 配置文件的 `路径`_
类型:``Optional[str]``
示例在 `这里 <https://github.com/microsoft/pai/blob/master/docs/manual/cluster-user/examples/hello-world-job.yaml>`__。
AmlConfig
^^^^^^^^^
详情查看 `这里 <../TrainingService/AMLMode.rst>`__。
platform
--------
字符串常量 ``"aml"``。
dockerImage
-----------
运行 Trial 的 Docker 镜像的名称和标签。
类型:``str``
默认:``"msranni/nni:latest"``
subscriptionId
--------------
Azure 订阅 ID。
类型:``str``
resourceGroup
-------------
Azure 资源组名称。
类型:``str``
workspaceName
-------------
Azure 工作区名称。
类型:``str``
computeTarget
-------------
AML 计算集群名称。
类型:``str``
...@@ -8,5 +8,4 @@ Python API 参考 ...@@ -8,5 +8,4 @@ Python API 参考
自动调优 <autotune_ref> 自动调优 <autotune_ref>
NAS <NAS/NasReference> NAS <NAS/NasReference>
模型压缩 <Compression/CompressionReference> 模型压缩 <Compression/CompressionReference>
NNI 客户端 <nnicli_ref> \ No newline at end of file
\ No newline at end of file
...@@ -6,10 +6,9 @@ NNI 支持的训练平台介绍 ...@@ -6,10 +6,9 @@ NNI 支持的训练平台介绍
本机<./TrainingService/LocalMode> 本机<./TrainingService/LocalMode>
远程<./TrainingService/RemoteMachineMode> 远程<./TrainingService/RemoteMachineMode>
OpenPAI<./TrainingService/PaiMode> OpenPAI<./TrainingService/PaiMode>
OpenPAI Yarn 模式<./TrainingService/PaiYarnMode>
Kubeflow<./TrainingService/KubeflowMode> Kubeflow<./TrainingService/KubeflowMode>
AdaptDL<./TrainingService/AdaptDLMode> AdaptDL<./TrainingService/AdaptDLMode>
FrameworkController<./TrainingService/FrameworkControllerMode> FrameworkController<./TrainingService/FrameworkControllerMode>
DLTS<./TrainingService/DLTSMode> DLTS<./TrainingService/DLTSMode>
AML<./TrainingService/AMLMode> AML<./TrainingService/AMLMode>
Heterogeneous<./TrainingService/HeterogeneousMode> 混合模式 <./TrainingService/HybridMode>
# AMCPruner 示例
此示例将说明如何使用 AMCPruner。
## 步骤一:训练模型
运行以下命令来训练 mobilenetv2 模型:
```bash
python3 amc_train.py --model_type mobilenetv2 --n_epoch 50
```
训练完成之后,检查点文件被保存在这里:
```
logs/mobilenetv2_cifar10_train-run1/ckpt.best.pth
```
## 使用 AMCPruner 剪枝
运行以下命令对模型进行剪枝:
```bash
python3 amc_search.py --model_type mobilenetv2 --ckpt logs/mobilenetv2_cifar10_train-run1/ckpt.best.pth
```
完成之后,剪枝后的模型和掩码文件被保存在:
```
logs/mobilenetv2_cifar10_r0.5_search-run2
```
## 微调剪枝后的模型
加上 `--ckpt``--mask` 参数,再次运行 `amc_train.py` 命令去加速和微调剪枝后的模型。
```bash
python3 amc_train.py --model_type mobilenetv2 --ckpt logs/mobilenetv2_cifar10_r0.5_search-run2/best_model.pth --mask logs/mobilenetv2_cifar10_r0.5_search-run2/best_mask.pth --n_epoch 100
```
# PyTorch Graph Converter
## Namespace for PyTorch Graph
We should have a concrete rule for specifying nodes in graph with namespace.
Each node has a name, either specified or generated. The nodes in the same hierarchy cannot have the same name.
* The name of module node natively follows this rule, because we use variable name for instantiated modules like what PyTorch graph does.
* For the nodes created in `forward` function, we use a global sequence number.
### Namespace for mutated (new) nodes
TBD
## Graph Simplification
TBD
## Node Types
We define concrete type string for each node type.
## Module's Input Arguments
We use wrapper to obtain the input arguments of modules. Users need to use our wrapped "nn" and wrapped "Module".
## Control Flow
### for loop
Currently, we only support `ModuleList` (`ModuleDict`) based for loop, which is automatically unfolded by TorchScript. That is to say, we do not support loop in TorchScript for now.
### if/else
For now, we only deal with the case that the condition is constant or attribute. In this case, only one branch is kept during generating the graph.
\ 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