Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleClas
提交
c30df630
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看板
提交
c30df630
编写于
3月 10, 2023
作者:
G
gaotingquan
提交者:
Wei Shengyu
3月 10, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
support Static
上级
392b75b1
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
9 addition
and
11 deletion
+9
-11
ppcls/engine/train/classification.py
ppcls/engine/train/classification.py
+1
-1
ppcls/optimizer/__init__.py
ppcls/optimizer/__init__.py
+1
-1
ppcls/static/program.py
ppcls/static/program.py
+5
-5
ppcls/static/train.py
ppcls/static/train.py
+2
-4
未找到文件。
ppcls/engine/train/classification.py
浏览文件 @
c30df630
...
...
@@ -65,7 +65,7 @@ class ClassTrainer(object):
# build optimizer
self
.
optimizer
,
self
.
lr_sch
=
build_optimizer
(
self
.
config
,
self
.
dataloader
.
max_iter
,
[
self
.
model
,
self
.
loss_func
]
,
self
.
update_freq
)
[
self
.
model
,
self
.
loss_func
])
# build model saver
self
.
model_saver
=
ModelSaver
(
...
...
ppcls/optimizer/__init__.py
浏览文件 @
c30df630
...
...
@@ -44,7 +44,7 @@ def build_lr_scheduler(lr_config, epochs, step_each_epoch):
# model_list is None in static graph
def
build_optimizer
(
config
,
max_iter
,
model_list
,
update_freq
):
def
build_optimizer
(
config
,
max_iter
,
model_list
=
None
):
optim_config
=
copy
.
deepcopy
(
config
[
"Optimizer"
])
epochs
=
config
[
"Global"
][
"epochs"
]
update_freq
=
config
[
"Global"
].
get
(
"update_freq"
,
1
)
...
...
ppcls/static/program.py
浏览文件 @
c30df630
...
...
@@ -109,7 +109,7 @@ def create_fetchs(out,
else
:
target
=
paddle
.
reshape
(
feeds
[
'label'
],
[
-
1
,
1
])
loss_func
=
build_loss
(
config
[
"Loss"
][
mode
]
)
loss_func
=
build_loss
(
config
,
mode
)
loss_dict
=
loss_func
(
out
,
target
)
loss_out
=
loss_dict
[
"loss"
]
...
...
@@ -117,7 +117,7 @@ def create_fetchs(out,
# build metric
if
not
use_mix
:
metric_func
=
build_metrics
(
config
[
"Metric"
][
mode
]
)
metric_func
=
build_metrics
(
config
,
mode
)
metric_dict
=
metric_func
(
out
,
target
)
...
...
@@ -268,9 +268,9 @@ def build(config,
lr_scheduler
=
None
optimizer
=
None
if
is_train
:
optimizer
,
lr_scheduler
=
build_optimizer
(
config
[
"Optimizer"
],
config
[
"Global"
][
"epochs"
],
step_each_epoch
)
optimizer
,
lr_scheduler
=
build_optimizer
(
config
,
step_each_epoch
)
optimizer
=
mixed_precision_optimizer
(
config
,
optimizer
)
if
is_distributed
:
optimizer
=
dist_optimizer
(
config
,
optimizer
)
...
...
ppcls/static/train.py
浏览文件 @
c30df630
...
...
@@ -105,11 +105,9 @@ def main(args):
class_num
=
config
[
"Arch"
].
get
(
"class_num"
,
None
)
config
[
"DataLoader"
].
update
({
"class_num"
:
class_num
})
train_dataloader
=
build_dataloader
(
config
[
"DataLoader"
],
"Train"
,
device
=
device
,
use_dali
=
use_dali
)
train_dataloader
=
build_dataloader
(
config
,
"Train"
)
if
global_config
[
"eval_during_train"
]:
eval_dataloader
=
build_dataloader
(
config
[
"DataLoader"
],
"Eval"
,
device
=
device
,
use_dali
=
use_dali
)
eval_dataloader
=
build_dataloader
(
config
,
"Eval"
)
step_each_epoch
=
len
(
train_dataloader
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录