Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
9a73283b
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2298
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9a73283b
编写于
6月 22, 2021
作者:
L
lyuwenyu
提交者:
jzhang533
6月 28, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update docs
上级
01474d3b
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
6 addition
and
13 deletion
+6
-13
python/paddle/hapi/model.py
python/paddle/hapi/model.py
+6
-13
未找到文件。
python/paddle/hapi/model.py
浏览文件 @
9a73283b
...
...
@@ -25,23 +25,18 @@ import warnings
import
time
import
socket
import
contextlib
from
collections
import
Iterable
import
paddle
from
paddle
import
fluid
from
paddle.fluid
import
core
from
paddle.fluid.framework
import
in_dygraph_mode
from
paddle.fluid.framework
import
Variable
from
paddle.fluid.framework
import
ParamBase
from
paddle.fluid.framework
import
_current_expected_place
from
paddle.fluid.framework
import
_get_paddle_place
from
paddle.fluid.framework
import
_current_expected_place
as
_get_device
from
paddle.fluid.executor
import
global_scope
from
paddle.fluid.io
import
is_belong_to_optimizer
from
paddle.fluid.dygraph.base
import
to_variable
from
paddle.fluid.dygraph.parallel
import
ParallelEnv
from
paddle.fluid.dygraph.dygraph_to_static.program_translator
import
ProgramTranslator
from
paddle.fluid.dygraph.dygraph_to_static.program_translator
import
FunctionSpec
from
paddle.fluid.dygraph.io
import
INFER_MODEL_SUFFIX
from
paddle.fluid.dygraph.io
import
INFER_PARAMS_SUFFIX
from
paddle.fluid.layers.utils
import
flatten
...
...
@@ -50,9 +45,6 @@ from paddle.fluid.layers import collective
from
paddle.io
import
DataLoader
from
paddle.io
import
Dataset
from
paddle.io
import
DistributedBatchSampler
from
paddle.fluid.executor
import
scope_guard
from
paddle.fluid.executor
import
Executor
from
paddle.fluid.dygraph.layers
import
Layer
from
paddle.metric
import
Metric
from
paddle.static
import
InputSpec
as
Input
import
paddle.distributed
as
dist
...
...
@@ -1022,7 +1014,8 @@ class Model(object):
def
train_batch
(
self
,
inputs
,
labels
=
None
,
update
=
True
):
"""
Run one training step on a batch of data.
Run one training step on one batch of data. And using `update` indicates
whether optimizer update gradients computing by this batch.
Args:
inputs (numpy.ndarray|Tensor|list): Batch of input data. It could
...
...
@@ -1542,7 +1535,7 @@ class Model(object):
shuffle
=
True
,
num_workers
=
0
,
callbacks
=
None
,
accumulate
=
1
,
):
accumulate
_grad_batches
=
1
,
):
"""
Trains the model for a fixed number of epochs. If `eval_data` is set,
evaluation will be done at the end of each epoch.
...
...
@@ -1585,8 +1578,8 @@ class Model(object):
callbacks (Callback|None): A list of `Callback` instances to apply
during training. If None, `ProgBarLogger` and `ModelCheckpoint`
are automatically inserted. Default: None.
accumulate
(int): The number of steps to accumulate gradident during
training process before optimizer updates. It can mimic large batch
accumulate
_grad_batches (int): The number of batches to accumulate gradident
during
training process before optimizer updates. It can mimic large batch
size. Default: 1.
Returns:
...
...
@@ -1709,7 +1702,7 @@ class Model(object):
do_eval
=
eval_loader
is
not
None
self
.
_test_dataloader
=
eval_loader
self
.
_accumulate
=
accumulate
self
.
_accumulate
=
accumulate
_grad_batches
steps
=
self
.
_len_data_loader
(
train_loader
)
cbks
=
config_callbacks
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录