Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleClas
提交
a944603d
P
PaddleClas
项目概览
PaddlePaddle
/
PaddleClas
1 年多 前同步成功
通知
115
Star
4999
Fork
1114
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
19
列表
看板
标记
里程碑
合并请求
6
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleClas
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
19
Issue
19
列表
看板
标记
里程碑
合并请求
6
合并请求
6
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
a944603d
编写于
3月 30, 2022
作者:
D
dongshuilong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix log twice bug
上级
84ae83da
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
7 addition
and
7 deletion
+7
-7
ppcls/engine/engine.py
ppcls/engine/engine.py
+4
-5
ppcls/static/train.py
ppcls/static/train.py
+1
-1
ppcls/utils/logger.py
ppcls/utils/logger.py
+2
-1
未找到文件。
ppcls/engine/engine.py
浏览文件 @
a944603d
...
...
@@ -71,7 +71,7 @@ class Engine(object):
self
.
output_dir
=
self
.
config
[
'Global'
][
'output_dir'
]
log_file
=
os
.
path
.
join
(
self
.
output_dir
,
self
.
config
[
"Arch"
][
"name"
],
f
"
{
mode
}
.log"
)
init_logger
(
name
=
'root'
,
log_file
=
log_file
)
init_logger
(
log_file
=
log_file
)
print_config
(
config
)
# init train_func and eval_func
...
...
@@ -92,7 +92,8 @@ class Engine(object):
self
.
vdl_writer
=
LogWriter
(
logdir
=
vdl_writer_path
)
# set device
assert
self
.
config
[
"Global"
][
"device"
]
in
[
"cpu"
,
"gpu"
,
"xpu"
,
"npu"
,
"mlu"
]
assert
self
.
config
[
"Global"
][
"device"
]
in
[
"cpu"
,
"gpu"
,
"xpu"
,
"npu"
,
"mlu"
]
self
.
device
=
paddle
.
set_device
(
self
.
config
[
"Global"
][
"device"
])
logger
.
info
(
'train with paddle {} and device {}'
.
format
(
paddle
.
__version__
,
self
.
device
))
...
...
@@ -107,9 +108,7 @@ class Engine(object):
self
.
scale_loss
=
1.0
self
.
use_dynamic_loss_scaling
=
False
if
self
.
amp
:
AMP_RELATED_FLAGS_SETTING
=
{
'FLAGS_max_inplace_grad_add'
:
8
,
}
AMP_RELATED_FLAGS_SETTING
=
{
'FLAGS_max_inplace_grad_add'
:
8
,
}
if
paddle
.
is_compiled_with_cuda
():
AMP_RELATED_FLAGS_SETTING
.
update
({
'FLAGS_cudnn_batchnorm_spatial_persistent'
:
1
...
...
ppcls/static/train.py
浏览文件 @
a944603d
...
...
@@ -71,7 +71,7 @@ def main(args):
log_file
=
os
.
path
.
join
(
global_config
[
'output_dir'
],
config
[
"Arch"
][
"name"
],
f
"
{
mode
}
.log"
)
init_logger
(
name
=
'root'
,
log_file
=
log_file
)
init_logger
(
log_file
=
log_file
)
print_config
(
config
)
if
global_config
.
get
(
"is_distributed"
,
True
):
...
...
ppcls/utils/logger.py
浏览文件 @
a944603d
...
...
@@ -22,7 +22,7 @@ import paddle.distributed as dist
_logger
=
None
def
init_logger
(
name
=
'
root
'
,
log_file
=
None
,
log_level
=
logging
.
INFO
):
def
init_logger
(
name
=
'
ppcls
'
,
log_file
=
None
,
log_level
=
logging
.
INFO
):
"""Initialize and get a logger by name.
If the logger has not been initialized, this method will initialize the
logger by adding one or two handlers, otherwise the initialized logger will
...
...
@@ -59,6 +59,7 @@ def init_logger(name='root', log_file=None, log_level=logging.INFO):
_logger
.
setLevel
(
log_level
)
else
:
_logger
.
setLevel
(
logging
.
ERROR
)
_logger
.
propagate
=
False
def
log_at_trainer0
(
log
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录