Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
nni
Commits
12410686
"test/vscode:/vscode.git/clone" did not exist on "3bce6926ac57e957f44eb942f1b01a5067490a17"
Unverified
Commit
12410686
authored
Jun 21, 2019
by
chicm-ms
Committed by
GitHub
Jun 21, 2019
Browse files
Merge pull request #20 from microsoft/master
pull code
parents
611a45fc
61fec446
Changes
242
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
180 additions
and
128 deletions
+180
-128
docs/zh_CN/QuickStart.md
docs/zh_CN/QuickStart.md
+1
-1
docs/zh_CN/Release.md
docs/zh_CN/Release.md
+102
-67
docs/zh_CN/SearchSpaceSpec.md
docs/zh_CN/SearchSpaceSpec.md
+17
-7
docs/zh_CN/advanced.rst
docs/zh_CN/advanced.rst
+2
-1
docs/zh_CN/builtin_assessor.rst
docs/zh_CN/builtin_assessor.rst
+1
-1
examples/experiment_config.yml
examples/experiment_config.yml
+18
-18
examples/trials/NAS/README_zh_CN.md
examples/trials/NAS/README_zh_CN.md
+8
-0
examples/trials/README.md
examples/trials/README.md
+4
-4
examples/trials/auto-gbdt/main.py
examples/trials/auto-gbdt/main.py
+3
-3
examples/trials/cifar10_pytorch/README.md
examples/trials/cifar10_pytorch/README.md
+1
-1
examples/trials/cifar10_pytorch/main.py
examples/trials/cifar10_pytorch/main.py
+1
-1
examples/trials/ga_squad/README.md
examples/trials/ga_squad/README.md
+1
-1
examples/trials/ga_squad/README_zh_CN.md
examples/trials/ga_squad/README_zh_CN.md
+1
-1
examples/trials/ga_squad/trial.py
examples/trials/ga_squad/trial.py
+1
-3
examples/trials/kaggle-tgs-salt/README.md
examples/trials/kaggle-tgs-salt/README.md
+3
-3
examples/trials/kaggle-tgs-salt/augmentation.py
examples/trials/kaggle-tgs-salt/augmentation.py
+1
-1
examples/trials/kaggle-tgs-salt/focal_loss.py
examples/trials/kaggle-tgs-salt/focal_loss.py
+1
-1
examples/trials/kaggle-tgs-salt/loader.py
examples/trials/kaggle-tgs-salt/loader.py
+6
-6
examples/trials/kaggle-tgs-salt/lovasz_losses.py
examples/trials/kaggle-tgs-salt/lovasz_losses.py
+2
-2
examples/trials/kaggle-tgs-salt/models.py
examples/trials/kaggle-tgs-salt/models.py
+6
-6
No files found.
docs/zh_CN/QuickStart.md
View file @
12410686
...
@@ -164,7 +164,7 @@ trial:
...
@@ -164,7 +164,7 @@ trial:
**注意**
:如果使用 Windows,则需要在 config.yml 文件中,将
`python3`
改为
`python`
,或者使用 config_windows.yml 来开始 Experiment。
**注意**
:如果使用 Windows,则需要在 config.yml 文件中,将
`python3`
改为
`python`
,或者使用 config_windows.yml 来开始 Experiment。
```
bash
```
bash
nnictl create
--config
nni
/
examples
/
trials
/
mnist
/
config_windows.yml
nnictl create
--config
nni
\
e
xamples
\
t
rials
\
m
nist
\
c
onfig_windows.yml
```
```
注意:
**nnictl**
是一个命令行工具,用来控制 NNI Experiment,如启动、停止、继续 Experiment,启动、停止 NNIBoard 等等。 查看
[
这里
](
Nnictl.md
)
,了解
`nnictl`
更多用法。
注意:
**nnictl**
是一个命令行工具,用来控制 NNI Experiment,如启动、停止、继续 Experiment,启动、停止 NNIBoard 等等。 查看
[
这里
](
Nnictl.md
)
,了解
`nnictl`
更多用法。
...
...
docs/zh_CN/Release.md
View file @
12410686
# 更改日志
# 更改日志
# 发布 0.8 - 6/4/2019
## 主要功能
*
在 Windows 上支持 NNI 的 OpenPAI 和远程模式
*
NNI 可在 Windows 上使用 OpenPAI 模式
*
NNI 可在 Windows 上使用 OpenPAI 模式
*
GPU 的高级功能
*
在本机或远程模式上,可在同一个 GPU 上运行多个 Trial。
*
在已经运行非 NNI 任务的 GPU 上也能运行 Trial
*
支持 Kubeflow v1beta2 操作符
*
支持 Kubeflow TFJob/PyTorchJob v1beta2
*
[
通过 NAS 编程接口
](
./GeneralNasInterfaces.md
)
*
实现了 NAS 的编程接口,可通过 NNI Annotation 很容易的表达神经网络架构搜索空间
*
提供新命令
`nnictl trial codegen`
来调试 NAS 代码生成部分
*
提供 NAS 编程接口教程,NAS 在 MNIST 上的示例,用于 NAS 的可定制的随机 Tuner
*
支持在恢复 Experiment 时,同时恢复 Tuner 和 Advisor 的状态
*
在恢复 Experiment 时,Tuner 和 Advisor 会导入已完成的 Trial 的数据。
*
Web 界面
*
改进拷贝 Trial 参数的设计
*
在 hyper-parameter 图中支持 'randint' 类型
*
使用 ComponentUpdate 来避免不必要的刷新
## Bug 修复和其它更新
*
修复
`nnictl update`
不一致的命令行风格
*
SMAC Tuner 支持导入数据
*
支持 Experiment 状态从 ERROR 回到 RUNNING
*
修复表格的 Bug
*
优化嵌套搜索空间
*
优化 'randint' 类型,并支持下限
*
[
比较不同超参搜索调优算法
](
./CommunitySharings/HpoComparision.md
)
*
[
NAS 算法的对比
](
./CommunitySharings/NasComparision.md
)
*
[
Recommenders 上的实践
](
./CommunitySharings/NniPracticeSharing/RecommendersSvd.md
)
## 发布 0.7 - 4/29/2018
## 发布 0.7 - 4/29/2018
### 主要功能
### 主要功能
*
[
支持在 Windows 上使用 NNI
](
./WindowsLocalMode.md
)
*
[
支持在 Windows 上使用 NNI
](
./WindowsLocalMode.md
)
*
NNI 可在 Windows 上使用本机模式
*
NNI 可在 Windows 上使用本机模式
*
[
支持新的 Advisor: BOHB
](
./BohbAdvisor.md
)
*
[
支持新的 Advisor: BOHB
](
./BohbAdvisor.md
)
*
支持新的 BOHB Advisor,这是一个健壮而有效的超参调优算法,囊括了贝叶斯优化和 Hyperband 的优点
*
支持新的 BOHB Advisor,这是一个健壮而有效的超参调优算法,囊括了贝叶斯优化和 Hyperband 的优点
*
[
支持通过 nnictl 来导入导出 Experiment 数据
](
./Nnictl.md#experiment
)
*
[
支持通过 nnictl 来导入导出 Experiment 数据
](
./Nnictl.md#experiment
)
*
在 Experiment 执行完后,可生成分析结果报告
*
在 Experiment 执行完后,可生成分析结果报告
*
支持将先前的调优数据导入到 Tuner 和 Advisor 中
*
支持将先前的调优数据导入到 Tuner 和 Advisor 中
*
[
可为 NNI Trial 任务指定 GPU
](
./ExperimentConfig.md#localConfig
)
*
[
可为 NNI Trial 任务指定 GPU
](
./ExperimentConfig.md#localConfig
)
*
通过 gpuIndices 配置来为 Trial 任务指定GPU。如果 Experiment 配置文件中有 gpuIndices,则只有指定的 GPU 会被用于 NNI 的 Trial 任务。
*
通过 gpuIndices 配置来为 Trial 任务指定GPU。如果 Experiment 配置文件中有 gpuIndices,则只有指定的 GPU 会被用于 NNI 的 Trial 任务。
*
改进 Web 界面
*
改进 Web 界面
*
在 Web 界面上使用十进制格式的指标
*
在 Web 界面上使用十进制格式的指标
*
添加多阶段训练相关的提示
*
添加多阶段训练相关的提示
*
可将超参复制为 Python dict 格式
*
可将超参复制为 Python dict 格式
*
可将提前终止的 Trial 数据传入 Tuner。
*
可将提前终止的 Trial 数据传入 Tuner。
*
为 nnictl 提供更友好的错误消息
*
为 nnictl 提供更友好的错误消息
*
为 YAML 文件格式错误提供更有意义的错误信息
*
为 YAML 文件格式错误提供更有意义的错误信息
### Bug 修复
### Bug 修复
...
@@ -31,12 +66,12 @@
...
@@ -31,12 +66,12 @@
### 主要功能
### 主要功能
*
[
版本检查
](
https://github.com/Microsoft/nni/blob/master/docs/
zh_CN
/PaiMode.md#version-check
)
*
[
版本检查
](
https://github.com/Microsoft/nni/blob/master/docs/
en_US
/PaiMode.md#version-check
)
*
检查 nniManager 和 trialKeeper 的版本是否一致
*
检查 nniManager 和 trialKeeper 的版本是否一致
*
[
提前终止的任务也可返回最终指标
](
https://github.com/Microsoft/nni/issues/776
)
*
[
提前终止的任务也可返回最终指标
](
https://github.com/Microsoft/nni/issues/776
)
*
如果 includeIntermediateResults 为 true,最后一个 Assessor 的中间结果会被发送给 Tuner 作为最终结果。 includeIntermediateResults
的默认值为 false。
*
如果 includeIntermediateResults 为 true,最后一个 Assessor 的中间结果会被发送给 Tuner 作为最终结果。 includeIntermediateResults
的默认值为 false。
*
[
分离 Tuner/Assessor
](
https://github.com/Microsoft/nni/issues/841
)
*
[
分离 Tuner/Assessor
](
https://github.com/Microsoft/nni/issues/841
)
*
增加两个管道来分离 Tuner 和 Assessor 的消息
*
增加两个管道来分离 Tuner 和 Assessor 的消息
*
使日志集合功能可配置
*
使日志集合功能可配置
*
为所有 Trial 增加中间结果的视图
*
为所有 Trial 增加中间结果的视图
...
@@ -101,15 +136,15 @@
...
@@ -101,15 +136,15 @@
#### 改进训练平台
#### 改进训练平台
*
[
FrameworkController 训练平台
](
./FrameworkControllerMode.md
)
: 支持使用在 Kubernetes 上使用 FrameworkController。
*
[
FrameworkController 训练平台
](
./FrameworkControllerMode.md
)
: 支持使用在 Kubernetes 上使用 FrameworkController。
*
FrameworkController 是 Kubernetes 上非常通用的控制器(Controller),能用来运行基于各种机器学习框架的分布式作业,如 TensorFlow,Pytorch, MXNet 等。
*
FrameworkController 是 Kubernetes 上非常通用的控制器(Controller),能用来运行基于各种机器学习框架的分布式作业,如 TensorFlow,Pytorch, MXNet 等。
*
NNI 为作业定义了统一而简单的规范。
*
NNI 为作业定义了统一而简单的规范。
*
如何使用 FrameworkController 的 MNIST 样例。
*
如何使用 FrameworkController 的 MNIST 样例。
#### 改进用户体验
#### 改进用户体验
*
为 OpenPAI, Kubeflow 和 FrameworkController 模式提供更好的日志支持。
*
为 OpenPAI, Kubeflow 和 FrameworkController 模式提供更好的日志支持。
*
改进后的日志架构能将尝试的 stdout/stderr 通过 HTTP POST 方式发送给 NNI 管理器。 NNI 管理器将 Trial 的 stdout/stderr 消息存储在本地日志文件中。
*
改进后的日志架构能将尝试的 stdout/stderr 通过 HTTP POST 方式发送给 NNI 管理器。 NNI 管理器将 Trial 的 stdout/stderr 消息存储在本地日志文件中。
*
在 WEB 界面上显示 Trial 日志的链接。
*
在 WEB 界面上显示 Trial 日志的链接。
*
支持将最终结果显示为键值对。
*
支持将最终结果显示为键值对。
## 发布 0.4.1 - 12/14/2018
## 发布 0.4.1 - 12/14/2018
...
@@ -150,19 +185,19 @@
...
@@ -150,19 +185,19 @@
### 主要功能
### 主要功能
*
[
Kubeflow 训练服务
](
./KubeflowMode.md
)
*
[
Kubeflow 训练服务
](
./KubeflowMode.md
)
*
支持 tf-operator
*
支持 tf-operator
*
使用 Kubeflow 的
[
分布式 Trial 样例
](
https://github.com/Microsoft/nni/tree/master/examples/trials/mnist-distributed/dist_mnist.py
)
*
使用 Kubeflow 的
[
分布式 Trial 样例
](
https://github.com/Microsoft/nni/tree/master/examples/trials/mnist-distributed/dist_mnist.py
)
*
[
网格搜索 Tuner
](
GridsearchTuner.md
)
*
[
网格搜索 Tuner
](
GridsearchTuner.md
)
*
[
Hyperband Tuner
](
HyperbandAdvisor.md
)
*
[
Hyperband Tuner
](
HyperbandAdvisor.md
)
*
支持在 MAC 上运行 NNI Experiment
*
支持在 MAC 上运行 NNI Experiment
*
Web 界面
*
Web 界面
*
支持 hyperband Tuner
*
支持 hyperband Tuner
*
移除 tensorboard 按钮
*
移除 tensorboard 按钮
*
显示 Experiment 的错误消息
*
显示 Experiment 的错误消息
*
显示搜索空间和 Trial 配置的行号
*
显示搜索空间和 Trial 配置的行号
*
支持通过指定的 Trial id 来搜索
*
支持通过指定的 Trial id 来搜索
*
显示 Trial 的 hdfsLogPath
*
显示 Trial 的 hdfsLogPath
*
下载 Experiment 参数
*
下载 Experiment 参数
### 其它
### 其它
...
@@ -170,22 +205,22 @@
...
@@ -170,22 +205,22 @@
*
更新 Docker 文件,增加 pytorch 库
*
更新 Docker 文件,增加 pytorch 库
*
重构 'nnictl stop' 过程,发送 SIGTERM 给 NNI 管理器进程,而不是调用停止 Restful API.
*
重构 'nnictl stop' 过程,发送 SIGTERM 给 NNI 管理器进程,而不是调用停止 Restful API.
*
修复 OpenPAI 训练服务的 Bug
*
修复 OpenPAI 训练服务的 Bug
*
在 NNI 管理器中为 OpenPAI 集群配置文件支持 IP 配置(nniManagerIp),来修复用户计算机没有 eth0 设备的问题。
*
在 NNI 管理器中为 OpenPAI 集群配置文件支持 IP 配置(nniManagerIp),来修复用户计算机没有 eth0 设备的问题。
*
codeDir 中的文件数量上限改为1000,避免用户无意中填写了 root 目录。
*
codeDir 中的文件数量上限改为1000,避免用户无意中填写了 root 目录。
*
移除 OpenPAI 作业的 stdout 日志中无用的 ‘metrics is empty’。 在新指标被记录时,仅输出有用的消息,来减少用户检查 OpenPAI Trial 输出时的困惑。
*
移除 OpenPAI 作业的 stdout 日志中无用的 ‘metrics is empty’。 在新指标被记录时,仅输出有用的消息,来减少用户检查 OpenPAI Trial 输出时的困惑。
*
在 Trial keeper 的开始增加时间戳。
*
在 Trial keeper 的开始增加时间戳。
## 发布 0.3.0 - 11/2/2018
## 发布 0.3.0 - 11/2/2018
### NNICTL 的新功能和更新
### NNICTL 的新功能和更新
*
支持同时运行多个 Experiment。
*
支持同时运行多个 Experiment。
在 v0.3 以前,NNI 仅支持一次运行一个 Experiment。 此版本开始,用户可以同时运行多个 Experiment。 每个 Experiment 都需要一个唯一的端口,第一个 Experiment 会像以前版本一样使用默认端口。 需要为其它 Experiment 指定唯一端口:
在 v0.3 以前,NNI 仅支持一次运行一个 Experiment。 此版本开始,用户可以同时运行多个 Experiment。 每个 Experiment 都需要一个唯一的端口,第一个 Experiment 会像以前版本一样使用默认端口。 需要为其它 Experiment 指定唯一端口:
```
bash
```
bash
nnictl create
--port
8081
--config
<config file path>
nnictl create
--port
8081
--config
<config file path>
```
```
*
支持更新最大 Trial 的数量。 使用
`nnictl update --help`
了解详情。 或参考
[
NNICTL
](
Nnictl.md
)
查看完整帮助。
*
支持更新最大 Trial 的数量。 使用
`nnictl update --help`
了解详情。 或参考
[
NNICTL
](
Nnictl.md
)
查看完整帮助。
...
@@ -194,18 +229,18 @@
...
@@ -194,18 +229,18 @@
*
<span
style=
"color:red"
><strong>
不兼容的改动
</strong></span>
:nn.get_parameters() 改为 nni.get_next_parameter。 所有以前版本的样例将无法在 v0.3 上运行,需要重新克隆 NNI 代码库获取新样例。 如果在自己的代码中使用了 NNI,也需要相应的更新。
*
<span
style=
"color:red"
><strong>
不兼容的改动
</strong></span>
:nn.get_parameters() 改为 nni.get_next_parameter。 所有以前版本的样例将无法在 v0.3 上运行,需要重新克隆 NNI 代码库获取新样例。 如果在自己的代码中使用了 NNI,也需要相应的更新。
*
新 API
**nni.get_sequence_id()**
。 每个 Trial 任务都会被分配一个唯一的序列数字,可通过 nni.get_sequence_id() API 来获取。
*
新 API
**nni.get_sequence_id()**
。 每个 Trial 任务都会被分配一个唯一的序列数字,可通过 nni.get_sequence_id() API 来获取。
```
bash
```
bash
git clone
-b
v0.3 https://github.com/Microsoft/nni.git
git clone
-b
v0.3 https://github.com/Microsoft/nni.git
```
```
*
**nni.report_final_result(result)**
API 对结果参数支持更多的数据类型。
*
**nni.report_final_result(result)**
API 对结果参数支持更多的数据类型。
可用类型:
可用类型:
*
int
*
int
*
float
*
float
*
包含有 'default' 键值的 dict,'default' 的值必须为 int 或 float。 dict 可以包含任何其它键值对。
*
包含有 'default' 键值的 dict,'default' 的值必须为 int 或 float。 dict 可以包含任何其它键值对。
### 支持新的 Tuner
### 支持新的 Tuner
...
@@ -214,10 +249,10 @@
...
@@ -214,10 +249,10 @@
### 新样例
### 新样例
*
公开的 NNI Docker 映像:
*
公开的 NNI Docker 映像:
```
bash
```
bash
docker pull msranni/nni:latest
docker pull msranni/nni:latest
```
```
*
新的 Trial 样例:
[
NNI Sklearn 样例
](
https://github.com/Microsoft/nni/tree/master/examples/trials/sklearn
)
*
新的 Trial 样例:
[
NNI Sklearn 样例
](
https://github.com/Microsoft/nni/tree/master/examples/trials/sklearn
)
...
@@ -234,14 +269,14 @@
...
@@ -234,14 +269,14 @@
### 主要功能
### 主要功能
*
支持
[
OpenPAI
](
https://github.com/Microsoft/pai
)
(
又称
pai) 训练服务 (参考
[
这里
](
./PaiMode.md
)
来了解如何在 OpenPAI 下提交 NNI 任务)
*
支持
[
OpenPAI
](
https://github.com/Microsoft/pai
)
(
又称
pai) 训练服务 (参考
[
这里
](
./PaiMode.md
)
来了解如何在 OpenPAI 下提交 NNI 任务)
*
支持 pai 模式的训练服务。 NNI Trial 可发送至 OpenPAI 集群上运行
*
支持 pai 模式的训练服务。 NNI Trial 可发送至 OpenPAI 集群上运行
*
NNI Trial 输出 (包括日志和模型文件) 会被复制到 OpenPAI 的 HDFS 中。
*
NNI Trial 输出 (包括日志和模型文件) 会被复制到 OpenPAI 的 HDFS 中。
*
支持
[
SMAC
](
https://www.cs.ubc.ca/~hutter/papers/10-TR-SMAC.pdf
)
Tuner (参考
[
这里
](
SmacTuner.md
)
,了解如何使用 SMAC Tuner)
*
支持
[
SMAC
](
https://www.cs.ubc.ca/~hutter/papers/10-TR-SMAC.pdf
)
Tuner (参考
[
这里
](
SmacTuner.md
)
,了解如何使用 SMAC Tuner)
*
[
SMAC
](
https://www.cs.ubc.ca/~hutter/papers/10-TR-SMAC.pdf
)
基于 Sequential Model-Based Optimization (SMBO). 它会利用使用过的结果好的模型(高斯随机过程模型),并将随机森林引入到 SMBO 中,来处理分类参数。 NNI 的 SMAC 通过包装
[
SMAC3
](
https://github.com/automl/SMAC3
)
来支持。
*
[
SMAC
](
https://www.cs.ubc.ca/~hutter/papers/10-TR-SMAC.pdf
)
基于 Sequential Model-Based Optimization (SMBO). 它会利用使用过的结果好的模型(高斯随机过程模型),并将随机森林引入到 SMBO 中,来处理分类参数。 NNI 的 SMAC 通过包装
[
SMAC3
](
https://github.com/automl/SMAC3
)
来支持。
*
支持将 NNI 安装在
[
conda
](
https://conda.io/docs/index.html
)
和 Python 虚拟环境中。
*
支持将 NNI 安装在
[
conda
](
https://conda.io/docs/index.html
)
和 Python 虚拟环境中。
*
其它
*
其它
*
更新 ga squad 样例与相关文档
*
更新 ga squad 样例与相关文档
*
用户体验改善及 Bug 修复
*
用户体验改善及 Bug 修复
### 已知问题
### 已知问题
...
@@ -254,20 +289,20 @@
...
@@ -254,20 +289,20 @@
### 主要功能
### 主要功能
*
安装和部署
*
安装和部署
*
支持 pip 和源代码安装
*
支持 pip 和源代码安装
*
支持本机(包括多 GPU 卡)训练和远程多机训练模式
*
支持本机(包括多 GPU 卡)训练和远程多机训练模式
*
Tuner ,Assessor 和 Trial
*
Tuner ,Assessor 和 Trial
*
支持的自动机器学习算法包括: hyperopt_tpe, hyperopt_annealing, hyperopt_random, 和 evolution_tuner。
*
支持的自动机器学习算法包括: hyperopt_tpe, hyperopt_annealing, hyperopt_random, 和 evolution_tuner。
*
支持 Assessor(提前终止)算法包括:medianstop。
*
支持 Assessor(提前终止)算法包括:medianstop。
*
提供 Python API 来自定义 Tuner 和 Assessor
*
提供 Python API 来自定义 Tuner 和 Assessor
*
提供 Python API 来包装 Trial 代码,以便能在 NNI 中运行
*
提供 Python API 来包装 Trial 代码,以便能在 NNI 中运行
*
Experiment
*
Experiment
*
提供命令行工具 'nnictl' 来管理 Experiment
*
提供命令行工具 'nnictl' 来管理 Experiment
*
提供网页界面来查看并管理 Experiment
*
提供网页界面来查看并管理 Experiment
*
持续集成
*
持续集成
*
使用 Ubuntu 的
[
travis-ci
](
https://github.com/travis-ci
)
来支持持续集成
*
使用 Ubuntu 的
[
travis-ci
](
https://github.com/travis-ci
)
来支持持续集成
*
其它
*
其它
*
支持简单的 GPU 任务调度
*
支持简单的 GPU 任务调度
### 已知问题
### 已知问题
...
...
docs/zh_CN/SearchSpaceSpec.md
View file @
12410686
...
@@ -29,16 +29,16 @@
...
@@ -29,16 +29,16 @@
*
表示变量的值是选项之一。 这里的 'options' 是一个数组。 选项的每个元素都是字符串。 也可以是嵌套的子搜索空间。此子搜索空间仅在相应的元素选中后才起作用。 该子搜索空间中的变量可看作是条件变量。
*
表示变量的值是选项之一。 这里的 'options' 是一个数组。 选项的每个元素都是字符串。 也可以是嵌套的子搜索空间。此子搜索空间仅在相应的元素选中后才起作用。 该子搜索空间中的变量可看作是条件变量。
*
这是个简单的
[
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 支持嵌套搜索空间:
*
[
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(随机搜索)
*
Random Search(随机搜索)
*
TPE
*
TPE
*
Anneal(退火算法)
*
Anneal(退火算法)
*
Evolution
*
Evolution
*
{"_type":"randint","_value":[upper]}
*
{"_type":"randint","_value":[
lower,
upper]}
*
此变量为范围 [0, upper) 之间的随机整数。 这种分布的语义,在较远整数与附近整数之间的损失函数无太大关系, 这是用来描述随机种子的较好分布。 如果损失函数与较近的整数更相关,则应该使用某个"quantized"的连续分布,如quniform, qloguniform, qnormal 或 qlognormal。 注意,如果需要改动数字下限,可以使用
`quniform`
。
*
当前实现的是 "quniform" 的 "randint" 分布,随机变量的分布函数是 round(uniform(lower, upper))。 所选择值的类型是 float。 如果要使用整数,需要显式转换
。
*
{"_type":"uniform","_value":[low, high]}
*
{"_type":"uniform","_value":[low, high]}
...
@@ -92,9 +92,19 @@
...
@@ -92,9 +92,19 @@
| Hyperband Advisor |
✓
|
✓
|
✓
|
✓
|
✓
|
✓
|
✓
|
✓
|
✓
|
✓
|
| Hyperband Advisor |
✓
|
✓
|
✓
|
✓
|
✓
|
✓
|
✓
|
✓
|
✓
|
✓
|
| Metis Tuner |
✓
|
✓
|
✓
|
✓
| | | | | | |
| Metis Tuner |
✓
|
✓
|
✓
|
✓
| | | | | | |
注意,在 Grid Search Tuner 中,为了使用方便
`quniform`
和
`qloguniform`
的定义也有所改变,其中的 q 表示采样值的数量。 详情如下
:
已知的局限
:
*
类型 'quniform' 接收三个值 [low, high, q], 其中 [low, high] 指定了范围,而 'q' 指定了会被均匀采样的值的数量。 注意 q 至少为 2。 它的第一个采样值为 'low',每个采样值都会比前一个大 (high-low)/q 。
*
注意,在 Grid Search Tuner 中,为了使用方便
`quniform`
和
`qloguniform`
的定义也有所改变,其中的 q 表示采样值的数量。 详情如下:
*
类型 'qloguniform' 的行为与 'quniform' 类似,不同处在于首先将范围改为 [log(low), log(high)] 采样后,再将数值还原。
*
类型 'quniform' 接收三个值 [low, high, q], 其中 [low, high] 指定了范围,而 'q' 指定了会被均匀采样的值的数量。 注意 q 至少为 2。 它的第一个采样值为 'low',每个采样值都会比前一个大 (high-low)/q 。
*
类型 'qloguniform' 的行为与 'quniform' 类似,不同处在于首先将范围改为 [log(low), log(high)] 采样后,再将数值还原。
*
注意 Metis Tuner 当前仅支持在
`choice`
中使用数值。
注意 Metis Tuner 当前仅支持在
`choice`
中使用数值。
*
请注意,对于嵌套搜索空间:
\ No newline at end of file
*
只有 随机搜索/TPE/Anneal/Evolution Tuner 支持嵌套搜索空间
*
不支持嵌套搜索空间 "超参" 并行图,对其的改进通过 #1110(https://github.com/microsoft/nni/issues/1110) 来跟踪 。欢迎任何建议和贡献。
\ No newline at end of file
docs/zh_CN/advanced.rst
View file @
12410686
...
@@ -3,4 +3,5 @@
...
@@ -3,4 +3,5 @@
.. toctree::
.. toctree::
多阶段<MultiPhase>
多阶段<MultiPhase>
高级网络架构搜索<AdvancedNas>
高级网络架构搜索<AdvancedNas>
\ No newline at end of file
NAS 编程接口<GeneralNasInterfaces>
\ No newline at end of file
docs/zh_CN/builtin_assessor.rst
View file @
12410686
...
@@ -4,6 +4,6 @@
...
@@ -4,6 +4,6 @@
.. toctree::
.. toctree::
:maxdepth: 1
:maxdepth: 1
介绍<BuiltinAssessor
s
>
介绍<BuiltinAssessor>
Medianstop<MedianstopAssessor>
Medianstop<MedianstopAssessor>
Curvefitting<CurvefittingAssessor>
Curvefitting<CurvefittingAssessor>
\ No newline at end of file
examples/experiment_config.yml
View file @
12410686
authorName
:
authorName
:
experimentName
:
experimentName
:
trialConcurrency
:
trialConcurrency
:
maxExecDuration
:
maxExecDuration
:
maxTrialNum
:
maxTrialNum
:
#choice: local, remote
#choice: local, remote
trainingServicePlatform
:
trainingServicePlatform
:
searchSpacePath
:
searchSpacePath
:
#choice: true, false
#choice: true, false
useAnnotation
:
useAnnotation
:
tuner
:
tuner
:
#choice: TPE, Random, Anneal, Evolution
#choice: TPE, Random, Anneal, Evolution
builtinTunerName
:
builtinTunerName
:
classArgs
:
classArgs
:
#choice: maximize, minimize
#choice: maximize, minimize
optimize_mode
:
optimize_mode
:
assessor
:
assessor
:
#choice: Medianstop
#choice: Medianstop
builtinAssessorName
:
builtinAssessorName
:
classArgs
:
classArgs
:
#choice: maximize, minimize
#choice: maximize, minimize
optimize_mode
:
optimize_mode
:
trial
:
trial
:
command
:
command
:
codeDir
:
codeDir
:
gpuNum
:
gpuNum
:
#machineList can be empty if the platform is local
#machineList can be empty if the platform is local
machineList
:
machineList
:
-
ip
:
-
ip
:
port
:
port
:
username
:
username
:
passwd
:
passwd
:
\ No newline at end of file
examples/trials/NAS/README_zh_CN.md
0 → 100644
View file @
12410686
**在 NNI 中运行神经网络架构搜索**
===
参考
[
NNI-NAS-Example
](
https://github.com/Crysple/NNI-NAS-Example
)
,来使用贡献者提供的 NAS 接口。
谢谢可爱的贡献者!
欢迎越来越多的人加入我们!
\ No newline at end of file
examples/trials/README.md
View file @
12410686
# How to write a Trial running on NNI?
# How to write a Trial running on NNI?
*Trial receive the hyper-parameter/architecture configure from Tuner, and send intermediate result to Assessor and final result to Tuner.*
*Trial receive the hyper-parameter/architecture configure from Tuner, and send intermediate result to Assessor and final result to Tuner.*
So when user want to write a Trial running on NNI, she/he should:
So when user want to write a Trial running on NNI, she/he should:
...
@@ -140,9 +140,9 @@ def train(args, params):
...
@@ -140,9 +140,9 @@ def train(args, params):
_
,
acc
=
model
.
evaluate
(
x_test
,
y_test
,
verbose
=
0
)
_
,
acc
=
model
.
evaluate
(
x_test
,
y_test
,
verbose
=
0
)
...
...
```
```
**4) Send final result**
**4) Send final result**
Use
`nni.report_final_result`
to send final result to Tuner. Please noted
**15**
line in the following code.
Use
`nni.report_final_result`
to send final result to Tuner. Please noted
**15**
line in the following code.
...
@@ -162,7 +162,7 @@ def train(args, params):
...
@@ -162,7 +162,7 @@ def train(args, params):
_
,
acc
=
model
.
evaluate
(
x_test
,
y_test
,
verbose
=
0
)
_
,
acc
=
model
.
evaluate
(
x_test
,
y_test
,
verbose
=
0
)
nni
.
report_final_result
(
acc
)
nni
.
report_final_result
(
acc
)
...
...
```
```
Here is the complete example:
Here is the complete example:
...
...
examples/trials/auto-gbdt/main.py
View file @
12410686
...
@@ -3,9 +3,9 @@
...
@@ -3,9 +3,9 @@
#
#
# MIT License
# MIT License
#
#
# Permission is hereby granted, free of charge,
# Permission is hereby granted, free of charge,
# to any person obtaining a copy of this software and associated
# to any person obtaining a copy of this software and associated
# documentation files (the "Software"),
# documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
# the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
# to permit persons to whom the Software is furnished to do so, subject to the following conditions:
# to permit persons to whom the Software is furnished to do so, subject to the following conditions:
...
@@ -88,7 +88,7 @@ def run(lgb_train, lgb_eval, params, X_test, y_test):
...
@@ -88,7 +88,7 @@ def run(lgb_train, lgb_eval, params, X_test, y_test):
# predict
# predict
y_pred
=
gbm
.
predict
(
X_test
,
num_iteration
=
gbm
.
best_iteration
)
y_pred
=
gbm
.
predict
(
X_test
,
num_iteration
=
gbm
.
best_iteration
)
# eval
# eval
rmse
=
mean_squared_error
(
y_test
,
y_pred
)
**
0.5
rmse
=
mean_squared_error
(
y_test
,
y_pred
)
**
0.5
print
(
'The rmse of prediction is:'
,
rmse
)
print
(
'The rmse of prediction is:'
,
rmse
)
...
...
examples/trials/cifar10_pytorch/README.md
View file @
12410686
...
@@ -2,5 +2,5 @@ This example requires pytorch.
...
@@ -2,5 +2,5 @@ This example requires pytorch.
pytorch install package should be chosen based on python version and cuda version.
pytorch install package should be chosen based on python version and cuda version.
Here is an example of the environment python==3.5 and cuda == 8.0, then using the following commands to install pytorch:
Here is an example of the environment python==3.5 and cuda == 8.0, then using the following commands to install pytorch:
python3 -m pip install http://download.pytorch.org/whl/cu80/torch-0.4.1-cp35-cp35m-linux_x86_64.whl
python3 -m pip install http://download.pytorch.org/whl/cu80/torch-0.4.1-cp35-cp35m-linux_x86_64.whl
python3 -m pip install torchvision
python3 -m pip install torchvision
\ No newline at end of file
examples/trials/cifar10_pytorch/main.py
View file @
12410686
...
@@ -95,7 +95,7 @@ def prepare(args):
...
@@ -95,7 +95,7 @@ def prepare(args):
if
args
[
'optimizer'
]
==
'Adam'
:
if
args
[
'optimizer'
]
==
'Adam'
:
optimizer
=
optim
.
Adam
(
net
.
parameters
(),
lr
=
args
[
'lr'
])
optimizer
=
optim
.
Adam
(
net
.
parameters
(),
lr
=
args
[
'lr'
])
if
args
[
'optimizer'
]
==
'Adamax'
:
if
args
[
'optimizer'
]
==
'Adamax'
:
optimizer
=
optim
.
Adam
(
net
.
parameters
(),
lr
=
args
[
'lr'
])
optimizer
=
optim
.
Adam
(
net
.
parameters
(),
lr
=
args
[
'lr'
])
# Training
# Training
...
...
examples/trials/ga_squad/README.md
View file @
12410686
...
@@ -239,7 +239,7 @@ class CustomerTuner(Tuner):
...
@@ -239,7 +239,7 @@ class CustomerTuner(Tuner):
indiv.mutation()
indiv.mutation()
graph = indiv.config
graph = indiv.config
temp = json.loads(graph_dumps(graph))
temp = json.loads(graph_dumps(graph))
# ......
# ......
```
```
...
...
examples/trials/ga_squad/README_zh_CN.md
View file @
12410686
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
6.
ADD-SKIP (在随机层之间一致).
6.
ADD-SKIP (在随机层之间一致).
7.
REMOVE-SKIP (移除随机跳过).
7.
REMOVE-SKIP (移除随机跳过).


## 新版本
## 新版本
...
...
examples/trials/ga_squad/trial.py
View file @
12410686
...
@@ -79,9 +79,7 @@ def get_id(word_dict, word):
...
@@ -79,9 +79,7 @@ def get_id(word_dict, word):
'''
'''
Return word id.
Return word id.
'''
'''
if
word
in
word_dict
.
keys
():
return
word_dict
.
get
(
word
,
word_dict
[
'<unk>'
])
return
word_dict
[
word
]
return
word_dict
[
'<unk>'
]
def
load_embedding
(
path
):
def
load_embedding
(
path
):
...
...
examples/trials/kaggle-tgs-salt/README.md
View file @
12410686
## 33rd place solution code for Kaggle [TGS Salt Identification Chanllenge](https://www.kaggle.com/c/tgs-salt-identification-challenge)
## 33rd place solution code for Kaggle [TGS Salt Identification Chanllenge](https://www.kaggle.com/c/tgs-salt-identification-challenge)
This example shows how to enable AutoML for competition code by running it on NNI without any code change.
This example shows how to enable AutoML for competition code by running it on NNI without any code change.
To run this code on NNI, firstly you need to run it standalone, then configure the config.yml and:
To run this code on NNI, firstly you need to run it standalone, then configure the config.yml and:
```
```
nnictl create --config config.yml
nnictl create --config config.yml
...
@@ -18,7 +18,7 @@ Stage 1:
...
@@ -18,7 +18,7 @@ Stage 1:
Train fold 0-3 for 100 epochs, for each fold, train 3 models:
Train fold 0-3 for 100 epochs, for each fold, train 3 models:
```
```
python3 train.py --ifolds 0 --epochs 100 --model_name UNetResNetV4
python3 train.py --ifolds 0 --epochs 100 --model_name UNetResNetV4
python3 train.py --ifolds 0 --epochs 100 --model_name UNetResNetV5 --layers 50
python3 train.py --ifolds 0 --epochs 100 --model_name UNetResNetV5 --layers 50
python3 train.py --ifolds 0 --epochs 100 --model_name UNetResNetV6
python3 train.py --ifolds 0 --epochs 100 --model_name UNetResNetV6
```
```
...
@@ -28,7 +28,7 @@ Stage 2:
...
@@ -28,7 +28,7 @@ Stage 2:
Fine tune stage 1 models for 300 epochs with cosine annealing lr scheduler:
Fine tune stage 1 models for 300 epochs with cosine annealing lr scheduler:
```
```
python3 train.py --ifolds 0 --epochs 300 --lrs cosine --lr 0.001 --min_lr 0.0001 --model_name UNetResNetV4
python3 train.py --ifolds 0 --epochs 300 --lrs cosine --lr 0.001 --min_lr 0.0001 --model_name UNetResNetV4
```
```
Stage 3:
Stage 3:
...
...
examples/trials/kaggle-tgs-salt/augmentation.py
View file @
12410686
...
@@ -165,7 +165,7 @@ def test_transform():
...
@@ -165,7 +165,7 @@ def test_transform():
RandomHFlipWithMask
(),
RandomHFlipWithMask
(),
RandomVFlipWithMask
(),
RandomVFlipWithMask
(),
RandomRotateWithMask
([
0
,
90
,
180
,
270
]),
RandomRotateWithMask
([
0
,
90
,
180
,
270
]),
#RandomRotateWithMask(15),
#RandomRotateWithMask(15),
RandomResizedCropWithMask
(
768
,
scale
=
(
0.81
,
1
))
RandomResizedCropWithMask
(
768
,
scale
=
(
0.81
,
1
))
])
])
...
...
examples/trials/kaggle-tgs-salt/focal_loss.py
View file @
12410686
...
@@ -33,7 +33,7 @@ class FocalLoss2d(nn.Module):
...
@@ -33,7 +33,7 @@ class FocalLoss2d(nn.Module):
def
forward
(
self
,
logit
,
target
,
class_weight
=
None
,
type
=
'sigmoid'
):
def
forward
(
self
,
logit
,
target
,
class_weight
=
None
,
type
=
'sigmoid'
):
target
=
target
.
view
(
-
1
,
1
).
long
()
target
=
target
.
view
(
-
1
,
1
).
long
()
if
type
==
'sigmoid'
:
if
type
==
'sigmoid'
:
if
class_weight
is
None
:
if
class_weight
is
None
:
class_weight
=
[
1
]
*
2
#[0.5, 0.5]
class_weight
=
[
1
]
*
2
#[0.5, 0.5]
...
...
examples/trials/kaggle-tgs-salt/loader.py
View file @
12410686
...
@@ -40,11 +40,11 @@ class ImageDataset(data.Dataset):
...
@@ -40,11 +40,11 @@ class ImageDataset(data.Dataset):
self
.
train_mode
=
train_mode
self
.
train_mode
=
train_mode
self
.
meta
=
meta
self
.
meta
=
meta
self
.
img_ids
=
meta
[
ID_COLUMN
].
values
self
.
img_ids
=
meta
[
ID_COLUMN
].
values
self
.
salt_exists
=
meta
[
'salt_exists'
].
values
self
.
salt_exists
=
meta
[
'salt_exists'
].
values
self
.
is_train
=
meta
[
'is_train'
].
values
self
.
is_train
=
meta
[
'is_train'
].
values
if
self
.
train_mode
:
if
self
.
train_mode
:
self
.
mask_filenames
=
meta
[
Y_COLUMN
].
values
self
.
mask_filenames
=
meta
[
Y_COLUMN
].
values
...
@@ -207,7 +207,7 @@ def get_train_loaders(ifold, batch_size=8, dev_mode=False, pad_mode='edge', meta
...
@@ -207,7 +207,7 @@ def get_train_loaders(ifold, batch_size=8, dev_mode=False, pad_mode='edge', meta
val_set
=
ImageDataset
(
True
,
val_meta
,
val_set
=
ImageDataset
(
True
,
val_meta
,
augment_with_target
=
img_mask_aug_val
,
augment_with_target
=
img_mask_aug_val
,
image_augment
=
None
,
image_augment
=
None
,
image_transform
=
get_image_transform
(
pad_mode
),
image_transform
=
get_image_transform
(
pad_mode
),
mask_transform
=
get_mask_transform
(
pad_mode
))
mask_transform
=
get_mask_transform
(
pad_mode
))
val_loader
=
data
.
DataLoader
(
val_set
,
batch_size
=
batch_size
,
shuffle
=
False
,
num_workers
=
4
,
collate_fn
=
val_set
.
collate_fn
)
val_loader
=
data
.
DataLoader
(
val_set
,
batch_size
=
batch_size
,
shuffle
=
False
,
num_workers
=
4
,
collate_fn
=
val_set
.
collate_fn
)
...
@@ -221,7 +221,7 @@ def get_test_loader(batch_size=16, index=0, dev_mode=False, pad_mode='edge'):
...
@@ -221,7 +221,7 @@ def get_test_loader(batch_size=16, index=0, dev_mode=False, pad_mode='edge'):
if
dev_mode
:
if
dev_mode
:
test_meta
=
test_meta
.
iloc
[:
10
]
test_meta
=
test_meta
.
iloc
[:
10
]
test_set
=
ImageDataset
(
False
,
test_meta
,
test_set
=
ImageDataset
(
False
,
test_meta
,
image_augment
=
None
if
pad_mode
==
'resize'
else
transforms
.
Pad
((
13
,
13
,
14
,
14
),
padding_mode
=
pad_mode
),
image_augment
=
None
if
pad_mode
==
'resize'
else
transforms
.
Pad
((
13
,
13
,
14
,
14
),
padding_mode
=
pad_mode
),
image_transform
=
get_tta_transforms
(
index
,
pad_mode
))
image_transform
=
get_tta_transforms
(
index
,
pad_mode
))
test_loader
=
data
.
DataLoader
(
test_set
,
batch_size
=
batch_size
,
shuffle
=
False
,
num_workers
=
4
,
collate_fn
=
test_set
.
collate_fn
,
drop_last
=
False
)
test_loader
=
data
.
DataLoader
(
test_set
,
batch_size
=
batch_size
,
shuffle
=
False
,
num_workers
=
4
,
collate_fn
=
test_set
.
collate_fn
,
drop_last
=
False
)
test_loader
.
num
=
len
(
test_set
)
test_loader
.
num
=
len
(
test_set
)
...
@@ -236,13 +236,13 @@ def get_depth_tensor(pad_mode):
...
@@ -236,13 +236,13 @@ def get_depth_tensor(pad_mode):
if
depth_channel_tensor
is
not
None
:
if
depth_channel_tensor
is
not
None
:
return
depth_channel_tensor
return
depth_channel_tensor
depth_tensor
=
None
depth_tensor
=
None
if
pad_mode
==
'resize'
:
if
pad_mode
==
'resize'
:
depth_tensor
=
np
.
zeros
((
H
,
W
))
depth_tensor
=
np
.
zeros
((
H
,
W
))
for
row
,
const
in
enumerate
(
np
.
linspace
(
0
,
1
,
H
)):
for
row
,
const
in
enumerate
(
np
.
linspace
(
0
,
1
,
H
)):
depth_tensor
[
row
,
:]
=
const
depth_tensor
[
row
,
:]
=
const
else
:
else
:
depth_tensor
=
np
.
zeros
((
ORIG_H
,
ORIG_W
))
depth_tensor
=
np
.
zeros
((
ORIG_H
,
ORIG_W
))
for
row
,
const
in
enumerate
(
np
.
linspace
(
0
,
1
,
ORIG_H
)):
for
row
,
const
in
enumerate
(
np
.
linspace
(
0
,
1
,
ORIG_H
)):
...
...
examples/trials/kaggle-tgs-salt/lovasz_losses.py
View file @
12410686
...
@@ -76,7 +76,7 @@ def iou(preds, labels, C, EMPTY=1., ignore=None, per_image=False):
...
@@ -76,7 +76,7 @@ def iou(preds, labels, C, EMPTY=1., ignore=None, per_image=False):
preds
,
labels
=
(
preds
,),
(
labels
,)
preds
,
labels
=
(
preds
,),
(
labels
,)
ious
=
[]
ious
=
[]
for
pred
,
label
in
zip
(
preds
,
labels
):
for
pred
,
label
in
zip
(
preds
,
labels
):
iou
=
[]
iou
=
[]
for
i
in
range
(
C
):
for
i
in
range
(
C
):
if
i
!=
ignore
:
# The ignored label is sometimes among predicted classes (ENet - CityScapes)
if
i
!=
ignore
:
# The ignored label is sometimes among predicted classes (ENet - CityScapes)
intersection
=
((
label
==
i
)
&
(
pred
==
i
)).
sum
()
intersection
=
((
label
==
i
)
&
(
pred
==
i
)).
sum
()
...
@@ -127,7 +127,7 @@ def lovasz_hinge_flat(logits, labels):
...
@@ -127,7 +127,7 @@ def lovasz_hinge_flat(logits, labels):
grad
=
lovasz_grad
(
gt_sorted
)
grad
=
lovasz_grad
(
gt_sorted
)
loss
=
torch
.
dot
(
F
.
elu
(
errors_sorted
)
+
1
,
Variable
(
grad
))
loss
=
torch
.
dot
(
F
.
elu
(
errors_sorted
)
+
1
,
Variable
(
grad
))
#loss = torch.dot(F.relu(errors_sorted), Variable(grad))
#loss = torch.dot(F.relu(errors_sorted), Variable(grad))
return
loss
return
loss
...
...
examples/trials/kaggle-tgs-salt/models.py
View file @
12410686
...
@@ -201,12 +201,12 @@ class UNetResNetV4(nn.Module):
...
@@ -201,12 +201,12 @@ class UNetResNetV4(nn.Module):
F
.
upsample
(
d3
,
scale_factor
=
4
,
mode
=
'bilinear'
,
align_corners
=
False
),
F
.
upsample
(
d3
,
scale_factor
=
4
,
mode
=
'bilinear'
,
align_corners
=
False
),
F
.
upsample
(
d4
,
scale_factor
=
8
,
mode
=
'bilinear'
,
align_corners
=
False
),
F
.
upsample
(
d4
,
scale_factor
=
8
,
mode
=
'bilinear'
,
align_corners
=
False
),
F
.
upsample
(
d5
,
scale_factor
=
16
,
mode
=
'bilinear'
,
align_corners
=
False
),
F
.
upsample
(
d5
,
scale_factor
=
16
,
mode
=
'bilinear'
,
align_corners
=
False
),
],
1
)
],
1
)
f
=
F
.
dropout2d
(
f
,
p
=
self
.
dropout_2d
)
f
=
F
.
dropout2d
(
f
,
p
=
self
.
dropout_2d
)
return
self
.
logit
(
f
),
None
return
self
.
logit
(
f
),
None
def
freeze_bn
(
self
):
def
freeze_bn
(
self
):
'''Freeze BatchNorm layers.'''
'''Freeze BatchNorm layers.'''
for
layer
in
self
.
modules
():
for
layer
in
self
.
modules
():
...
@@ -221,7 +221,7 @@ class UNetResNetV4(nn.Module):
...
@@ -221,7 +221,7 @@ class UNetResNetV4(nn.Module):
for
x
in
group1
:
for
x
in
group1
:
for
p
in
x
.
parameters
():
for
p
in
x
.
parameters
():
params1
.
append
(
p
)
params1
.
append
(
p
)
param_group1
=
{
'params'
:
params1
,
'lr'
:
base_lr
/
5
}
param_group1
=
{
'params'
:
params1
,
'lr'
:
base_lr
/
5
}
params2
=
[]
params2
=
[]
...
@@ -321,7 +321,7 @@ class UNetResNetV5(nn.Module):
...
@@ -321,7 +321,7 @@ class UNetResNetV5(nn.Module):
F
.
interpolate
(
d3
,
scale_factor
=
4
,
mode
=
'bilinear'
,
align_corners
=
False
),
F
.
interpolate
(
d3
,
scale_factor
=
4
,
mode
=
'bilinear'
,
align_corners
=
False
),
F
.
interpolate
(
d4
,
scale_factor
=
8
,
mode
=
'bilinear'
,
align_corners
=
False
),
F
.
interpolate
(
d4
,
scale_factor
=
8
,
mode
=
'bilinear'
,
align_corners
=
False
),
F
.
interpolate
(
d5
,
scale_factor
=
16
,
mode
=
'bilinear'
,
align_corners
=
False
),
F
.
interpolate
(
d5
,
scale_factor
=
16
,
mode
=
'bilinear'
,
align_corners
=
False
),
],
1
)
],
1
)
f
=
F
.
dropout2d
(
f
,
p
=
self
.
dropout_2d
)
f
=
F
.
dropout2d
(
f
,
p
=
self
.
dropout_2d
)
...
@@ -331,7 +331,7 @@ class UNetResNetV6(nn.Module):
...
@@ -331,7 +331,7 @@ class UNetResNetV6(nn.Module):
'''
'''
1. Remove first pool from UNetResNetV5, such that resolution is doubled
1. Remove first pool from UNetResNetV5, such that resolution is doubled
2. Remove scSE from center block
2. Remove scSE from center block
3. Increase default dropout
3. Increase default dropout
'''
'''
def
__init__
(
self
,
encoder_depth
,
num_filters
=
32
,
dropout_2d
=
0.5
):
def
__init__
(
self
,
encoder_depth
,
num_filters
=
32
,
dropout_2d
=
0.5
):
super
(
UNetResNetV6
,
self
).
__init__
()
super
(
UNetResNetV6
,
self
).
__init__
()
...
@@ -400,7 +400,7 @@ class UNetResNetV6(nn.Module):
...
@@ -400,7 +400,7 @@ class UNetResNetV6(nn.Module):
F
.
interpolate
(
d4
,
scale_factor
=
4
,
mode
=
'bilinear'
,
align_corners
=
False
),
F
.
interpolate
(
d4
,
scale_factor
=
4
,
mode
=
'bilinear'
,
align_corners
=
False
),
F
.
interpolate
(
d5
,
scale_factor
=
8
,
mode
=
'bilinear'
,
align_corners
=
False
),
F
.
interpolate
(
d5
,
scale_factor
=
8
,
mode
=
'bilinear'
,
align_corners
=
False
),
F
.
interpolate
(
center
,
scale_factor
=
16
,
mode
=
'bilinear'
,
align_corners
=
False
),
F
.
interpolate
(
center
,
scale_factor
=
16
,
mode
=
'bilinear'
,
align_corners
=
False
),
],
1
)
],
1
)
f
=
F
.
dropout2d
(
f
,
p
=
self
.
dropout_2d
,
training
=
self
.
training
)
f
=
F
.
dropout2d
(
f
,
p
=
self
.
dropout_2d
,
training
=
self
.
training
)
...
...
Prev
1
2
3
4
5
6
7
8
…
13
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment