Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleClas
提交
f37cb543
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看板
提交
f37cb543
编写于
3月 29, 2023
作者:
G
gaotingquan
提交者:
cuicheng01
3月 29, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rm op black list in amp
the op flatten_contiguous_range and greater_than has supported amp mode since paddle 2.4
上级
a7ba6eab
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
7 addition
and
35 deletion
+7
-35
ppcls/engine/engine.py
ppcls/engine/engine.py
+1
-5
ppcls/engine/evaluation/classification.py
ppcls/engine/evaluation/classification.py
+2
-10
ppcls/engine/evaluation/retrieval.py
ppcls/engine/evaluation/retrieval.py
+1
-5
ppcls/engine/train/train.py
ppcls/engine/train/train.py
+1
-5
ppcls/engine/train/train_fixmatch.py
ppcls/engine/train/train_fixmatch.py
+1
-5
ppcls/engine/train/train_metabin.py
ppcls/engine/train/train_metabin.py
+1
-5
未找到文件。
ppcls/engine/engine.py
浏览文件 @
f37cb543
...
...
@@ -504,11 +504,7 @@ class Engine(object):
batch_tensor
=
paddle
.
to_tensor
(
batch_data
)
if
self
.
amp
and
self
.
amp_eval
:
with
paddle
.
amp
.
auto_cast
(
custom_black_list
=
{
"flatten_contiguous_range"
,
"greater_than"
},
level
=
self
.
amp_level
):
with
paddle
.
amp
.
auto_cast
(
level
=
self
.
amp_level
):
out
=
self
.
model
(
batch_tensor
)
else
:
out
=
self
.
model
(
batch_tensor
)
...
...
ppcls/engine/evaluation/classification.py
浏览文件 @
f37cb543
...
...
@@ -56,11 +56,7 @@ def classification_eval(engine, epoch_id=0):
# image input
if
engine
.
amp
and
engine
.
amp_eval
:
with
paddle
.
amp
.
auto_cast
(
custom_black_list
=
{
"flatten_contiguous_range"
,
"greater_than"
},
level
=
engine
.
amp_level
):
with
paddle
.
amp
.
auto_cast
(
level
=
engine
.
amp_level
):
out
=
engine
.
model
(
batch
[
0
])
else
:
out
=
engine
.
model
(
batch
[
0
])
...
...
@@ -114,11 +110,7 @@ def classification_eval(engine, epoch_id=0):
# calc loss
if
engine
.
eval_loss_func
is
not
None
:
if
engine
.
amp
and
engine
.
amp_eval
:
with
paddle
.
amp
.
auto_cast
(
custom_black_list
=
{
"flatten_contiguous_range"
,
"greater_than"
},
level
=
engine
.
amp_level
):
with
paddle
.
amp
.
auto_cast
(
level
=
engine
.
amp_level
):
loss_dict
=
engine
.
eval_loss_func
(
preds
,
labels
)
else
:
loss_dict
=
engine
.
eval_loss_func
(
preds
,
labels
)
...
...
ppcls/engine/evaluation/retrieval.py
浏览文件 @
f37cb543
...
...
@@ -137,11 +137,7 @@ def compute_feature(engine, name="gallery"):
has_camera
=
True
batch
[
2
]
=
batch
[
2
].
reshape
([
-
1
,
1
]).
astype
(
"int64"
)
if
engine
.
amp
and
engine
.
amp_eval
:
with
paddle
.
amp
.
auto_cast
(
custom_black_list
=
{
"flatten_contiguous_range"
,
"greater_than"
},
level
=
engine
.
amp_level
):
with
paddle
.
amp
.
auto_cast
(
level
=
engine
.
amp_level
):
out
=
engine
.
model
(
batch
[
0
])
else
:
out
=
engine
.
model
(
batch
[
0
])
...
...
ppcls/engine/train/train.py
浏览文件 @
f37cb543
...
...
@@ -50,11 +50,7 @@ def train_epoch(engine, epoch_id, print_batch_step):
# image input
if
engine
.
amp
:
amp_level
=
engine
.
config
[
"AMP"
].
get
(
"level"
,
"O1"
).
upper
()
with
paddle
.
amp
.
auto_cast
(
custom_black_list
=
{
"flatten_contiguous_range"
,
"greater_than"
},
level
=
amp_level
):
with
paddle
.
amp
.
auto_cast
(
level
=
amp_level
):
out
=
forward
(
engine
,
batch
)
loss_dict
=
engine
.
train_loss_func
(
out
,
batch
[
1
])
else
:
...
...
ppcls/engine/train/train_fixmatch.py
浏览文件 @
f37cb543
...
...
@@ -64,11 +64,7 @@ def train_epoch_fixmatch(engine, epoch_id, print_batch_step):
# image input
if
engine
.
amp
:
amp_level
=
engine
.
config
[
'AMP'
].
get
(
"level"
,
"O1"
).
upper
()
with
paddle
.
amp
.
auto_cast
(
custom_black_list
=
{
"flatten_contiguous_range"
,
"greater_than"
},
level
=
amp_level
):
with
paddle
.
amp
.
auto_cast
(
level
=
amp_level
):
loss_dict
,
logits_label
=
get_loss
(
engine
,
inputs
,
batch_size_label
,
temperture
,
threshold
,
targets_x
)
...
...
ppcls/engine/train/train_metabin.py
浏览文件 @
f37cb543
...
...
@@ -191,11 +191,7 @@ def forward(engine, batch, loss_func):
batch_info
=
{
"label"
:
batch
[
1
],
"domain"
:
batch
[
2
]}
if
engine
.
amp
:
amp_level
=
engine
.
config
[
"AMP"
].
get
(
"level"
,
"O1"
).
upper
()
with
paddle
.
amp
.
auto_cast
(
custom_black_list
=
{
"flatten_contiguous_range"
,
"greater_than"
},
level
=
amp_level
):
with
paddle
.
amp
.
auto_cast
(
level
=
amp_level
):
out
=
engine
.
model
(
batch
[
0
],
batch
[
1
])
loss_dict
=
loss_func
(
out
,
batch_info
)
else
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录