Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge master from Microsoft #174

Merged
merged 8 commits into from
May 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README_zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ NNI (Neural Network Intelligence) 是自动机器学习(AutoML)的工具包

**通过 pip 命令安装**

* 当前支持 Linux,MacOS 和 Windows(本机模式),在 Ubuntu 16.04 或更高版本,MacOS 10.14.1 以及 Windows 10.1809 上进行了测试。 在 `python >= 3.5` 的环境中,只需要运行 `pip install` 即可完成安装。
* 当前支持 Linux,MacOS 和 Windows(本机,远程,OpenPAI 模式),在 Ubuntu 16.04 或更高版本,MacOS 10.14.1 以及 Windows 10.1809 上进行了测试。 在 `python >= 3.5` 的环境中,只需要运行 `pip install` 即可完成安装。

Linux 和 macOS

Expand All @@ -126,12 +126,12 @@ python -m pip install --upgrade nni
注意:

* 如果需要将 NNI 安装到自己的 home 目录中,可使用 `--user`,这样也不需要任何特殊权限。
* 当前 NNI 在 Windows 上仅支持本机模式。 强烈推荐使用 Anaconda 或 Miniconda 在 Windows 上安装 NNI。
* 目前,Windows 上的 NNI 支持本机,远程和 OpenPAI 模式。 强烈推荐使用 Anaconda 或 Miniconda 在 Windows 上安装 NNI。
* 如果遇到如`Segmentation fault` 这样的任何错误请参考[常见问题](docs/zh_CN/FAQ.md)。

**通过源代码安装**

* 当前支持 Linux(Ubuntu 16.04 或更高版本),MacOS(10.14.1)以及 Windows 10(1809 版)下的本机模式
* 当前支持 Linux(Ubuntu 16.04 或更高版本),MacOS(10.14.1)以及 Windows 10(1809 版)。

Linux 和 macOS

Expand All @@ -155,7 +155,7 @@ Windows

参考[安装 NNI](docs/zh_CN/Installation.md) 了解系统需求。

参考 [NNI Windows 本机模式](docs/zh_CN/WindowsLocalMode.md),了解更多信息
Windows 上参考 [Windows 上使用 NNI](docs/zh_CN/NniOnWindows.md)。

**验证安装**

Expand Down
17 changes: 17 additions & 0 deletions docs/en_US/ExperimentConfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,15 @@ machineList:

__gpuIndices__ is used to specify designated GPU devices for NNI, if it is set, only the specified GPU devices are used for NNI trial jobs. Single or multiple GPU indices can be specified, multiple GPU indices are seperated by comma(,), such as `1` or `0,1,3`.

* __maxTrialNumPerGpu__

__maxTrialNumPerGpu__ is used to specify the max concurrency trial number on a GPU device.

* __useActiveGpu__

__useActiveGpu__ is used to specify whether to use a GPU if there is another process. By default, NNI will use the GPU only if there is no another active process in the GPU, if __useActiveGpu__ is set to true, NNI will use the GPU regardless of another processes. This field is not applicable for NNI on Windows.


* __machineList__

__machineList__ should be set if __trainingServicePlatform__ is set to remote, or it should be empty.
Expand Down Expand Up @@ -433,6 +442,14 @@ machineList:

__gpuIndices__ is used to specify designated GPU devices for NNI on this remote machine, if it is set, only the specified GPU devices are used for NNI trial jobs. Single or multiple GPU indices can be specified, multiple GPU indices are seperated by comma(,), such as `1` or `0,1,3`.

* __maxTrialNumPerGpu__

__maxTrialNumPerGpu__ is used to specify the max concurrency trial number on a GPU device.

* __useActiveGpu__

__useActiveGpu__ is used to specify whether to use a GPU if there is another process. By default, NNI will use the GPU only if there is no another active process in the GPU, if __useActiveGpu__ is set to true, NNI will use the GPU regardless of another processes. This field is not applicable for NNI on Windows.

* __kubeflowConfig__:

* __operator__
Expand Down
2 changes: 1 addition & 1 deletion docs/en_US/MnistExamples.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ This example is to show how to use hyperband to tune the model. There is one mor

This example is to show that NNI also support nested search space. The search space file is an example of how to define nested search space.

`code directory: examples/trials/mnist-cascading-search-space/`
`code directory: examples/trials/mnist-nested-search-space/`

<a name="mnist-kubeflow-tf"></a>
**distributed MNIST (tensorflow) using kubeflow**
Expand Down
35 changes: 35 additions & 0 deletions docs/en_US/Nnictl.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ nnictl support commands:
* [nnictl tensorboard](#tensorboard)
* [nnictl package](#package)
* [nnictl --version](#version)
* [nnictl hdfs](#hdfs)

### Manage an experiment

Expand Down Expand Up @@ -650,3 +651,37 @@ Debug mode will disable version check function in Trialkeeper.
```bash
nnictl --version
```

<a name="hdfs"></a>

![](https://placehold.it/15/1589F0/000000?text=+) `Manage hdfs`

* __nnictl hdfs set__
* Description

set the host and userName of hdfs

* Usage

```bash
nnictl hdfs set [OPTIONS]
```

* Options

|Name, shorthand|Required|Default|Description|
|------|------|------ |------|
|--host| True| |The host ip of hdfs, the format is xx.xx.xx.xx, for example, 10.10.10.10|
|--user_name| True| |The userName of hdfs|

* __nnictl hdfs clean__

* Description

Clean up the code files that nni automatically copied to hdfs. This command deletes all such files under the user_name.

* Usage

```bash
nnictl hdfs clean
```
20 changes: 15 additions & 5 deletions docs/en_US/SearchSpaceSpec.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ All types of sampling strategies and their parameter are listed here:

* Which means the variable's value is one of the options. Here 'options' should be a list. Each element of options is a number of string. It could also be a nested sub-search-space, this sub-search-space takes effect only when the corresponding element is chosen. The variables in this sub-search-space could be seen as conditional variables.

* An simple [example](../../examples/trials/mnist-cascading-search-space/search_space.json) of [nested] search space definition. If an element in the options list is a dict, it is a sub-search-space, and for our built-in tuners you have to add a key '_name' in this dict, which helps you to identify which element is chosen. Accordingly, here is a [sample](../../examples/trials/mnist-cascading-search-space/sample.json) which users can get from nni with nested search space definition. Tuners which support nested search space is as follows:
* An simple [example](https://github.com/microsoft/nni/tree/master/examples/trials/mnist-nested-search-space/search_space.json) of [nested] search space definition. If an element in the options list is a dict, it is a sub-search-space, and for our built-in tuners you have to add a key '_name' in this dict, which helps you to identify which element is chosen. Accordingly, here is a [sample](https://github.com/microsoft/nni/tree/master/examples/trials/mnist-nested-search-space/sample.json) which users can get from nni with nested search space definition. Tuners which support nested search space is as follows:

- Random Search
- TPE
Expand Down Expand Up @@ -86,9 +86,19 @@ All types of sampling strategies and their parameter are listed here:
| Hyperband Advisor | &#10003; | &#10003; | &#10003; | &#10003; | &#10003; | &#10003; | &#10003; | &#10003; | &#10003; | &#10003; |
| Metis Tuner | &#10003; | &#10003; | &#10003; | &#10003; | | | | | | |

Note that In Grid Search Tuner, for users' convenience, the definition of `quniform` and `qloguniform` change, where q here specifies the number of values that will be sampled. Details about them are listed as follows

* Type 'quniform' will receive three values [low, high, q], where [low, high] specifies a range and 'q' specifies the number of values that will be sampled evenly. Note that q should be at least 2. It will be sampled in a way that the first sampled value is 'low', and each of the following values is (high-low)/q larger that the value in front of it.
* Type 'qloguniform' behaves like 'quniform' except that it will first change the range to [log(low), log(high)] and sample and then change the sampled value back.
Known Limitations:

Note that Metis Tuner only support numerical `choice` now
* Note that In Grid Search Tuner, for users' convenience, the definition of `quniform` and `qloguniform` change, where q here specifies the number of values that will be sampled. Details about them are listed as follows

* Type 'quniform' will receive three values [low, high, q], where [low, high] specifies a range and 'q' specifies the number of values that will be sampled evenly. Note that q should be at least 2. It will be sampled in a way that the first sampled value is 'low', and each of the following values is (high-low)/q larger that the value in front of it.

* Type 'qloguniform' behaves like 'quniform' except that it will first change the range to [log(low), log(high)] and sample and then change the sampled value back.

* Note that Metis Tuner only supports numerical `choice` now

* Note that for nested search space:

* Only Random Search/TPE/Anneal/Evolution tuner supports nested search space

* We do not support nested search space "Hyper Parameter" parallel graph now, the enhancement is being considered in #1110(https://github.com/microsoft/nni/issues/1110), any suggestions or discussions or contributions are warmly welcomed
4 changes: 2 additions & 2 deletions docs/zh_CN/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ nnictl 在执行时,使用 tmp 目录作为临时目录来复制 codeDir 下
* 如果使用服务器 IP 后还是无法看到 Web 界面,可检查此服务器上是否有防火墙或需要代理。 或使用此运行 NNI Experiment 的服务器上的浏览器来查看 Web 界面。
* 另一个可能的原因是 Experiment 启动失败了,NNI 无法读取 Experiment 的信息。 可在如下目录中查看 NNIManager 的日志: ~/nni/experiment/[your_experiment_id] /log/nnimanager.log

### Windows 本机模式
### NNI 在 Windows 上的问题

参考 [NNI Windows 本机模式](WindowsLocalMode.md)
参考 [Windows 上使用 NNI](NniOnWindows.md)

### 帮助改进

Expand Down
2 changes: 1 addition & 1 deletion docs/zh_CN/Installation.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 安装 NNI

当前支持在 Linux,Mac 和 Windows(本机模式)下安装。
当前支持在 Linux,Mac 和 Windows(本机,远程和 OpenPAI 模式)下安装。

## **在 Linux 和 Mac 下安装**

Expand Down
2 changes: 1 addition & 1 deletion docs/zh_CN/MnistExamples.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@

此样例演示了 NNI 如何支持嵌套的搜索空间。 搜索空间文件示了如何定义嵌套的搜索空间。

`代码目录: examples/trials/mnist-cascading-search-space/`
`代码目录: examples/trials/mnist-nested-search-space/`

<a name="mnist-kubeflow-tf"></a>
**用 Kubeflow 运行分布式的 MNIST (tensorflow)**
Expand Down
10 changes: 5 additions & 5 deletions docs/zh_CN/WindowsLocalMode.md → docs/zh_CN/NniOnWindows.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Windows 本地模式(测试中
# Windows 上的 NNI(实验阶段的功能

当前 Windows 下仅支持本机模式。 推荐 Windows 10 的 1809 版,其经过了测试。
当前 Windows 上支持本机、远程和 OpenPAI 模式。 推荐 Windows 10 的 1809 版,其经过了测试。

## **在 Windows 上安装**

Expand All @@ -25,15 +25,15 @@ Set-ExecutionPolicy -ExecutionPolicy Unrestricted
先决条件: `python >=3.5`, `git`, `PowerShell`

```bash
git clone -b v0.7 https://github.com/Microsoft/nni.git
git clone -b v0.8 https://github.com/Microsoft/nni.git
cd nni
powershell ./install.ps1
powershell -file install.ps1
```

运行完以上脚本后,从命令行使用 **config_windows.yml** 来启动 Experiment,完成安装验证。

```bash
nnictl create --config nni/examples/trials/mnist/config_windows.yml
nnictl create --config nni\examples\trials\mnist\config_windows.yml
```

同样,其它示例的 YAML 配置中也需将 Trial 命令的 `python3` 替换为 `python`。
Expand Down
6 changes: 3 additions & 3 deletions docs/zh_CN/QuickStart.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## 安装

当前支持 Linux,MacOS 和 Windows(本机模式),在 Ubuntu 16.04 或更高版本,MacOS 10.14.1 以及 Windows 10.1809 上进行了测试。 在 `python >= 3.5` 的环境中,只需要运行 `pip install` 即可完成安装。
当前支持 Linux,MacOS 和 Windows,在 Ubuntu 16.04 或更高版本,MacOS 10.14.1 以及 Windows 10.1809 上进行了测试。 在 `python >= 3.5` 的环境中,只需要运行 `pip install` 即可完成安装。

#### Linux 和 MacOS

Expand All @@ -12,7 +12,7 @@

#### Windows

如果选择 Windows 本机模式并使用 PowerShell 运行脚本,需要首次以管理员身份在 PowerShell 环境中运行以下命令
如果在 Windows 上使用 NNI,首次使用 PowerShell 时,需要以管理员身份运行下列命令

```bash
Set-ExecutionPolicy -ExecutionPolicy Unrestricted
Expand Down Expand Up @@ -161,7 +161,7 @@ trial:

从命令行使用 **config_windows.yml** 文件启动 MNIST Experiment 。

**注意**:如果使用了 Windows 本机模式,则需要在 config.yml 文件中,将 `python3` 改为 `python`,或者使用 config_windows.yml 来开始 Experiment。
**注意**:如果使用 Windows,则需要在 config.yml 文件中,将 `python3` 改为 `python`,或者使用 config_windows.yml 来开始 Experiment。

```bash
nnictl create --config nni/examples/trials/mnist/config_windows.yml
Expand Down
14 changes: 14 additions & 0 deletions docs/zh_CN/RemoteMachineMode.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ machineList:
passwd: bob123
```

可以使用不同系统来在远程计算机上运行 Experiment。

#### Linux 和 macOS

填好 `machineList` 部分,然后运行:

```bash
Expand All @@ -64,6 +68,16 @@ nnictl create --config ~/nni/examples/trials/mnist-annotation/config_remote.yml

来启动 Experiment。

#### Windows

填好 `machineList` 部分,然后运行:

```bash
nnictl create --config %userprofile%\nni\examples\trials\mnist-annotation\config_remote.yml
```

来启动 Experiment。

## 版本校验

从 0.6 开始,NNI 支持版本校验,详情参考[这里](PaiMode.md)。
2 changes: 1 addition & 1 deletion docs/zh_CN/SearchSpaceSpec.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

* 表示变量的值是选项之一。 这里的 'options' 是一个数组。 选项的每个元素都是字符串。 也可以是嵌套的子搜索空间。此子搜索空间仅在相应的元素选中后才起作用。 该子搜索空间中的变量可看作是条件变量。

* 这是个简单的 [nested] 搜索空间定义的[示例](../../examples/trials/mnist-cascading-search-space/search_space.json)。 如果选项列表中的元素是 dict,则它是一个子搜索空间,对于内置的 Tuner,必须在此 dict 中添加键 “_name”,这有助于标识选中的元素。 相应的,这是从 NNI 中获得的嵌套搜索空间定义的[示例](../../examples/trials/mnist-cascading-search-space/sample.json)。 以下 Tuner 支持嵌套搜索空间:
* 这是个简单的 [nested] 搜索空间定义的[示例](https://github.com/microsoft/nni/tree/master/examples/trials/mnist-nested-search-space/search_space.json)。 如果选项列表中的元素是 dict,则它是一个子搜索空间,对于内置的 Tuner,必须在此 dict 中添加键 “_name”,这有助于标识选中的元素。 相应的,这是从 NNI 中获得的嵌套搜索空间定义的[示例](https://github.com/microsoft/nni/tree/master/examples/trials/mnist-nested-search-space/sample.json)。 以下 Tuner 支持嵌套搜索空间:

* Random Search(随机搜索)
* TPE
Expand Down
10 changes: 10 additions & 0 deletions docs/zh_CN/WebUI.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

* 查看 Experiment 的配置和搜索空间内容。
* 支持下载 Experiment 结果。
* 支持导出 nni-manager 和 dispatcher 的日志文件。
* 如果有任何问题,可以点击 “Feedback” 告诉我们。

![](../img/webui-img/over1.png)

Expand Down Expand Up @@ -52,6 +54,14 @@

![](../img/webui-img/detail-local.png)

* "Add column" 按钮可选择在表格中显示的列。 如果 Experiment 的最终结果是 dict,则可以在表格中查看其它键。

![](../img/webui-img/addColumn.png)

* 可使用 "Copy as python" 按钮来拷贝 Trial 的参数。

![](../img/webui-img/copyParameter.png)

* 如果在 OpenPAI 或 Kubeflow 平台上运行,还可以看到 hdfsLog。

![](../img/webui-img/detail-pai.png)
Expand Down
8 changes: 0 additions & 8 deletions docs/zh_CN/automl_practice_sharing.rst

This file was deleted.

4 changes: 3 additions & 1 deletion examples/trials/cifar10_pytorch/config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
authorName: default
experimentName: example_pytorch_cifar10
trialConcurrency: 1
trialConcurrency: 4
maxExecDuration: 100h
maxTrialNum: 10
#choice: local, remote, pai
Expand All @@ -19,3 +19,5 @@ trial:
command: python3 main.py
codeDir: .
gpuNum: 1
localConfig:
maxTrialNumPerGpu: 2
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
authorName: default
experimentName: mnist-cascading-search-space
experimentName: mnist-nested-search-space
trialConcurrency: 2
maxExecDuration: 1h
maxTrialNum: 100
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import nni

logger = logging.getLogger('mnist_cascading_search_space')
logger = logging.getLogger('mnist_nested_search_space')
FLAGS = None

class MnistNetwork(object):
Expand Down
16 changes: 15 additions & 1 deletion src/nni_manager/common/datastore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,18 @@ interface TrialJobInfo {
stderrPath?: string;
}

interface HyperParameterFormat {
parameter_source: string;
parameters: Object;
parameter_id: number;
}

interface ExportedDataFormat {
parameter: Object;
value: Object;
id: string;
}

abstract class DataStore {
public abstract init(): Promise<void>;
public abstract close(): Promise<void>;
Expand All @@ -82,6 +94,8 @@ abstract class DataStore {
public abstract getTrialJob(trialJobId: string): Promise<TrialJobInfo>;
public abstract storeMetricData(trialJobId: string, data: string): Promise<void>;
public abstract getMetricData(trialJobId?: string, metricType?: MetricType): Promise<MetricDataRecord[]>;
public abstract exportTrialHpConfigs(): Promise<string>;
public abstract getImportedData(): Promise<string[]>;
}

abstract class Database {
Expand All @@ -99,5 +113,5 @@ abstract class Database {

export {
DataStore, Database, TrialJobEvent, MetricType, MetricData, TrialJobInfo,
ExperimentProfileRecord, TrialJobEventRecord, MetricDataRecord
ExperimentProfileRecord, TrialJobEventRecord, MetricDataRecord, HyperParameterFormat, ExportedDataFormat
};
1 change: 1 addition & 0 deletions src/nni_manager/common/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ abstract class Manager {
public abstract getExperimentProfile(): Promise<ExperimentProfile>;
public abstract updateExperimentProfile(experimentProfile: ExperimentProfile, updateType: ProfileUpdateType): Promise<void>;
public abstract importData(data: string): Promise<void>;
public abstract exportData(): Promise<string>;

public abstract addCustomizedTrialJob(hyperParams: string): Promise<void>;
public abstract cancelTrialJobByUser(trialJobId: string): Promise<void>;
Expand Down
Loading