Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
59d8b8cb
P
Paddle
项目概览
机器未来
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
59d8b8cb
编写于
10月 25, 2021
作者:
H
Haohongxiang
提交者:
GitHub
10月 25, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[HybridParallel]fix bug of check_inf in fleet_base.py (#36651)
* fix bug of check_inf * fix allreduce
上级
50778ad6
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
5 addition
and
6 deletion
+5
-6
python/paddle/distributed/fleet/base/fleet_base.py
python/paddle/distributed/fleet/base/fleet_base.py
+4
-4
python/paddle/distributed/fleet/utils/hybrid_parallel_util.py
...on/paddle/distributed/fleet/utils/hybrid_parallel_util.py
+1
-2
未找到文件。
python/paddle/distributed/fleet/base/fleet_base.py
浏览文件 @
59d8b8cb
...
...
@@ -1586,16 +1586,16 @@ class Fleet(object):
_C_ops
.
check_finite_and_unscale
(
param_grads_fp32
,
self
.
_scale
,
param_grads_fp32
,
temp_found_inf_fp32
)
self
.
_found_inf
=
1
if
temp_found_inf_fp16
or
temp_found_inf_fp32
else
0
is_found_inf
=
paddle
.
to_tensor
([
self
.
_found_inf
],
dtype
=
"int32"
)
# TODO(shenliang03) Since dp allreduce in the optimizer is
# after the gradscaler, check_finite needs to synchronize global
# information. In the future, we should use check_group to speed.
paddle
.
distributed
.
all_reduce
(
paddle
.
to_tensor
(
[
self
.
_found_inf
],
dtype
=
"int32"
),
op
=
paddle
.
distributed
.
ReduceOp
.
MAX
,
group
=
None
)
is_found_inf
,
op
=
paddle
.
distributed
.
ReduceOp
.
MAX
,
group
=
None
)
self
.
_found_inf
=
is_found_inf
.
numpy
()[
0
]
# Only tensor_parallel and pipeline_parallel need to modify scaler
if
self
.
_hcg
.
get_parallel_mode
()
in
(
ParallelMode
.
TENSOR_PARALLEL
,
...
...
python/paddle/distributed/fleet/utils/hybrid_parallel_util.py
浏览文件 @
59d8b8cb
...
...
@@ -47,6 +47,7 @@ def _apply_collective_grads(parameters, comm_group):
nranks
=
paddle
.
distributed
.
get_world_size
(
)
if
comm_group
is
None
else
comm_group
.
nranks
div_factor
=
paddle
.
to_tensor
(
nranks
,
dtype
=
coalesced_grad
.
dtype
)
paddle
.
distributed
.
all_reduce
(
coalesced_grad
,
group
=
comm_group
)
paddle
.
fluid
.
framework
.
_dygraph_tracer
().
trace_op
(
type
=
"elementwise_div"
,
inputs
=
{
'X'
:
coalesced_grad
,
...
...
@@ -54,8 +55,6 @@ def _apply_collective_grads(parameters, comm_group):
outputs
=
{
'Out'
:
coalesced_grad
},
attrs
=
{
'axis'
:
-
1
})
paddle
.
distributed
.
all_reduce
(
coalesced_grad
,
group
=
comm_group
)
_split_tensors
(
coalesced_grads_and_vars
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录