Unverified Commit 50326948 authored by SparkSnail's avatar SparkSnail Committed by GitHub
Browse files

Merge pull request #165 from Microsoft/master

merge master
parents 5187b2c6 642967b8
# 用于 NNI 的 python 包索引 (pypi) # 用于 NNI 的 python 包索引 (pypi)
## 1. 说明
这是用于 NNI 项目的 PyPI 生成和上传的工具。 这是用于 NNI 项目的 PyPI 生成和上传的工具。
## 2.准备环境 ## **Linux**
* **准备环境**
在生成和上传 NNI 包之前,确保使用了下列环境。 在生成和上传 NNI 包之前,确保使用了下列环境。
Ubuntu 16.04 LTS Ubuntu 16.04 LTS
make make
...@@ -17,26 +17,65 @@ ...@@ -17,26 +17,65 @@
Yarn Yarn
## 2.如何生成 * **如何生成**
```bash
make
```
* **如何上传**
**上传测试包**
```bash
TWINE_REPOSITORY_URL=https://test.pypi.org/legacy/ make upload
```
上传过程中,可能需要输入 https://test.pypi.org 的用户和密码。
**上传发布包**
```bash
make upload
```
上传过程中,可能需要输入 https://pypi.org 的用户和密码。
## **Windows**
* **准备环境**
在生成和上传 NNI 包之前,确保使用了下列环境。
Windows 10
powershell
Python >= 3.5
Pip
Node.js
Yarn
tar
* **如何生成**
```bash ```bash
make powershell ./install.ps1
``` ```
## 3.如何上传 * **如何上传**
### 上传测试包 **upload for testing**
```bash ```bash
TWINE_REPOSITORY_URL=https://test.pypi.org/legacy/ make upload powershell ./upload.ps1
``` ```
上传过程中,可能需要输入 https://test.pypi.org 的用户和密码。 上传过程中,可能需要输入 https://test.pypi.org 的用户和密码。
### 上传发布包 **上传发布包**
```bash ```bash
make upload powershell ./upload.ps1 -test $False
``` ```
上传过程中,可能需要输入 https://pypi.org 的用户和密码。 上传过程中,可能需要输入 https://pypi.org 的用户和密码。
\ No newline at end of file \ No newline at end of file
...@@ -167,7 +167,7 @@ Debug mode will disable version check function in Trialkeeper. ...@@ -167,7 +167,7 @@ Debug mode will disable version check function in Trialkeeper.
`update experiment's new search space with file dir 'examples/trials/mnist/search_space.json'` `update experiment's new search space with file dir 'examples/trials/mnist/search_space.json'`
```bash ```bash
nnictl update searchspace [experiment_id] --file examples/trials/mnist/search_space.json nnictl update searchspace [experiment_id] --filename examples/trials/mnist/search_space.json
``` ```
* __nnictl update concurrency__ * __nnictl update concurrency__
...@@ -388,7 +388,7 @@ Debug mode will disable version check function in Trialkeeper. ...@@ -388,7 +388,7 @@ Debug mode will disable version check function in Trialkeeper.
|Name, shorthand|Required|Default|Description| |Name, shorthand|Required|Default|Description|
|------|------|------ |------| |------|------|------ |------|
|id| False| |ID of the experiment | |id| False| |ID of the experiment |
|--file| True| |File path of the output file | |--filename, -f| True| |File path of the output file |
|--type| True| |Type of output file, only support "csv" and "json"| |--type| True| |Type of output file, only support "csv" and "json"|
* Examples * Examples
...@@ -396,7 +396,7 @@ Debug mode will disable version check function in Trialkeeper. ...@@ -396,7 +396,7 @@ Debug mode will disable version check function in Trialkeeper.
> export all trial data in an experiment as json format > export all trial data in an experiment as json format
```bash ```bash
nnictl experiment export [experiment_id] --file [file_path] --type json nnictl experiment export [experiment_id] --filename [file_path] --type json
``` ```
* __nnictl experiment import__ * __nnictl experiment import__
...@@ -415,7 +415,7 @@ Debug mode will disable version check function in Trialkeeper. ...@@ -415,7 +415,7 @@ Debug mode will disable version check function in Trialkeeper.
|Name, shorthand|Required|Default|Description| |Name, shorthand|Required|Default|Description|
|------|------|------|------| |------|------|------|------|
|id| False| |The id of the experiment you want to import data into| |id| False| |The id of the experiment you want to import data into|
|--file, -f| True| |a file with data you want to import in json format| |--filename, -f| True| |a file with data you want to import in json format|
* Details * Details
......
# 安装 NNI # 安装 NNI
当前支持 Linux 和 Mac 当前支持 Linux,Mac 和 Windows 下安装
## **安装** ## **在 Linux 和 Mac 下安装**
* **通过 pip 命令安装 NNI** * **通过 pip 命令安装 NNI**
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* **通过源代码安装 NNI** * **通过源代码安装 NNI**
先决条件:`python >=3.5, git, wget` 先决条件:`python >=3.5`, `git`, `wget`
```bash ```bash
git clone -b v0.6 https://github.com/Microsoft/nni.git git clone -b v0.6 https://github.com/Microsoft/nni.git
...@@ -26,6 +26,33 @@ ...@@ -26,6 +26,33 @@
也可将 NNI 安装到 docker 映像中。 参考[这里](../deployment/docker/README.md)来生成 NNI 的 Docker 映像。 也可通过此命令从 Docker Hub 中直接拉取 NNI 的映像 `docker pull msranni/nni:latest` 也可将 NNI 安装到 docker 映像中。 参考[这里](../deployment/docker/README.md)来生成 NNI 的 Docker 映像。 也可通过此命令从 Docker Hub 中直接拉取 NNI 的映像 `docker pull msranni/nni:latest`
## **在 Windows 上安装**
* **通过 pip 命令安装 NNI**
先决条件:`python >= 3.5`
```bash
python -m pip install --upgrade nni
```
* **通过源代码安装 NNI**
先决条件:`python >=3.5`, `git`, `powershell`
在第一次使用 PowerShell 时,需要作为管理员运行此命令:
```bash
Set-ExecutionPolicy -ExecutionPolicy Unrestricted
```
然后可以使用管理员或当前用户安装 NNI:
```bash
git clone https://github.com/Microsoft/nni.git
cd nni
powershell ./install.ps1
```
## **系统需求** ## **系统需求**
以下是 NNI 在 Linux 下的最低配置。 由于程序变更,NNI 的最低配置会有所更改。 以下是 NNI 在 Linux 下的最低配置。 由于程序变更,NNI 的最低配置会有所更改。
...@@ -52,6 +79,18 @@ ...@@ -52,6 +79,18 @@
| **网络** | 宽带连接 | | | **网络** | 宽带连接 | |
| **分辨率** | 1024 x 768 以上 | | | **分辨率** | 1024 x 768 以上 | |
以下是 NNI 在 Windows 下的最低配置。 由于程序变更,NNI 的最低配置会有所更改。
| | 最低配置 | 推荐配置 |
| -------- | ------------------------------------- | ----------------------------------------- |
| **操作系统** | Windows 10 | Windows 10 |
| **CPU** | Intel® Core™ i3 或 AMD Phenom™ X3 8650 | Intel® Core™ i5 或 AMD Phenom™ II X3 或更高配置 |
| **GPU** | NVIDIA® GeForce® GTX 460 | NVIDIA® GeForce® GTX 660 或更高配置 |
| **内存** | 4 GB | 6 GB |
| **存储** | 30 GB 可用的磁盘空间 | |
| **网络** | 宽带连接 | |
| **分辨率** | 1024 x 768 以上 | |
## 更多 ## 更多
* [概述](Overview.md) * [概述](Overview.md)
......
...@@ -589,19 +589,26 @@ class BOHB(MsgDispatcherBase): ...@@ -589,19 +589,26 @@ class BOHB(MsgDispatcherBase):
""" """
_completed_num = 0 _completed_num = 0
for trial_info in data: for trial_info in data:
logger.info("Importing data, current processing progress %s / %s" %(_completed_num), len(data)) logger.info("Importing data, current processing progress %s / %s" %(_completed_num, len(data)))
_completed_num += 1 _completed_num += 1
assert "parameter" in trial_info assert "parameter" in trial_info
_params = trial_info["parameter"] _params = trial_info["parameter"]
assert "value" in trial_info assert "value" in trial_info
_value = trial_info['value'] _value = trial_info['value']
if _KEY not in _params: budget_exist_flag = False
_params[_KEY] = self.max_budget barely_params = dict()
for keys in _params:
if keys == _KEY:
_budget = _params[keys]
budget_exist_flag = True
else:
barely_params[keys] = _params[keys]
if not budget_exist_flag:
_budget = self.max_budget
logger.info("Set \"TRIAL_BUDGET\" value to %s (max budget)" %self.max_budget) logger.info("Set \"TRIAL_BUDGET\" value to %s (max budget)" %self.max_budget)
if self.optimize_mode is OptimizeMode.Maximize: if self.optimize_mode is OptimizeMode.Maximize:
reward = -_value reward = -_value
else: else:
reward = _value reward = _value
_budget = _params[_KEY] self.cg.new_result(loss=reward, budget=_budget, parameters=barely_params, update_model=True)
self.cg.new_result(loss=reward, budget=_budget, parameters=_params, update_model=True)
logger.info("Successfully import tuning data to BOHB advisor.") logger.info("Successfully import tuning data to BOHB advisor.")
...@@ -160,7 +160,7 @@ class GridSearchTuner(Tuner): ...@@ -160,7 +160,7 @@ class GridSearchTuner(Tuner):
""" """
_completed_num = 0 _completed_num = 0
for trial_info in data: for trial_info in data:
logger.info("Importing data, current processing progress %s / %s" %(_completed_num), len(data)) logger.info("Importing data, current processing progress %s / %s" %(_completed_num, len(data)))
_completed_num += 1 _completed_num += 1
assert "parameter" in trial_info assert "parameter" in trial_info
_params = trial_info["parameter"] _params = trial_info["parameter"]
......
...@@ -365,7 +365,7 @@ class HyperoptTuner(Tuner): ...@@ -365,7 +365,7 @@ class HyperoptTuner(Tuner):
""" """
_completed_num = 0 _completed_num = 0
for trial_info in data: for trial_info in data:
logger.info("Importing data, current processing progress %s / %s" %(_completed_num), len(data)) logger.info("Importing data, current processing progress %s / %s" %(_completed_num, len(data)))
_completed_num += 1 _completed_num += 1
if self.algorithm_name == 'random_search': if self.algorithm_name == 'random_search':
return return
......
...@@ -411,7 +411,7 @@ class MetisTuner(Tuner): ...@@ -411,7 +411,7 @@ class MetisTuner(Tuner):
""" """
_completed_num = 0 _completed_num = 0
for trial_info in data: for trial_info in data:
logger.info("Importing data, current processing progress %s / %s" %(_completed_num), len(data)) logger.info("Importing data, current processing progress %s / %s" %(_completed_num, len(data)))
_completed_num += 1 _completed_num += 1
assert "parameter" in trial_info assert "parameter" in trial_info
_params = trial_info["parameter"] _params = trial_info["parameter"]
......
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