Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PLSC
提交
c87574b5
P
PLSC
项目概览
PaddlePaddle
/
PLSC
通知
10
Star
3
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
5
列表
看板
标记
里程碑
合并请求
4
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PLSC
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
5
Issue
5
列表
看板
标记
里程碑
合并请求
4
合并请求
4
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
c87574b5
编写于
2月 26, 2020
作者:
L
lilong12
提交者:
GitHub
2月 26, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
parameterize lr_decay_factor, step_boundaries and log_period (#34)
上级
c24ce4a4
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
22 addition
and
2 deletion
+22
-2
plsc/entry.py
plsc/entry.py
+22
-2
未找到文件。
plsc/entry.py
浏览文件 @
c87574b5
...
...
@@ -137,12 +137,17 @@ class Entry(object):
if
self
.
dataset_dir
:
self
.
dataset_dir
=
os
.
path
.
abspath
(
self
.
dataset_dir
)
self
.
lr_decay_factor
=
0.1
self
.
log_period
=
200
logger
.
info
(
'='
*
30
)
logger
.
info
(
"Default configuration:"
)
for
key
in
self
.
config
:
logger
.
info
(
'
\t
'
+
str
(
key
)
+
": "
+
str
(
self
.
config
[
key
]))
logger
.
info
(
'trainer_id: {}, num_trainers: {}'
.
format
(
trainer_id
,
num_trainers
))
logger
.
info
(
'default lr_decay_factor: {}'
.
format
(
self
.
lr_decay_factor
))
logger
.
info
(
'default log period: {}'
.
format
(
self
.
log_period
))
logger
.
info
(
'='
*
30
)
def
set_val_targets
(
self
,
targets
):
...
...
@@ -157,6 +162,20 @@ class Entry(object):
self
.
global_train_batch_size
=
batch_size
*
self
.
num_trainers
logger
.
info
(
"Set train batch size to {}."
.
format
(
batch_size
))
def
set_log_period
(
self
,
period
):
self
.
log_period
=
period
logger
.
info
(
"Set log period to {}."
.
format
(
period
))
def
set_lr_decay_factor
(
self
,
factor
):
self
.
lr_decay_factor
=
factor
logger
.
info
(
"Set lr decay factor to {}."
.
format
(
factor
))
def
set_step_boundaries
(
self
,
boundaries
):
if
not
isinstance
(
boundaries
,
list
):
raise
ValueError
(
"The parameter must be of type list."
)
self
.
lr_steps
=
boundaries
logger
.
info
(
"Set step boundaries to {}."
.
format
(
boundaries
))
def
set_mixed_precision
(
self
,
use_fp16
,
init_loss_scaling
=
1.0
,
...
...
@@ -332,7 +351,8 @@ class Entry(object):
warmup_steps
=
steps_per_pass
*
self
.
warmup_epochs
batch_denom
=
1024
base_lr
=
start_lr
*
global_batch_size
/
batch_denom
lr
=
[
base_lr
*
(
0.1
**
i
)
for
i
in
range
(
len
(
bd
)
+
1
)]
lr_decay_factor
=
self
.
lr_decay_factor
lr
=
[
base_lr
*
(
lr_decay_factor
**
i
)
for
i
in
range
(
len
(
bd
)
+
1
)]
logger
.
info
(
"LR boundaries: {}"
.
format
(
bd
))
logger
.
info
(
"lr_step: {}"
.
format
(
lr
))
if
self
.
warmup_epochs
:
...
...
@@ -938,7 +958,7 @@ class Entry(object):
local_time
=
0.0
nsamples
=
0
inspect_steps
=
200
inspect_steps
=
self
.
log_period
global_batch_size
=
self
.
global_train_batch_size
for
pass_id
in
range
(
self
.
train_epochs
):
self
.
train_pass_id
=
pass_id
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录