Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
6da9db50
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看板
未验证
提交
6da9db50
编写于
7月 22, 2023
作者:
zhenhailiu
提交者:
GitHub
7月 22, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix group_shard3_get_all_parameter (#55572)
上级
db921ae9
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
26 addition
and
19 deletion
+26
-19
python/paddle/distributed/fleet/meta_parallel/sharding/group_sharded_stage3.py
...uted/fleet/meta_parallel/sharding/group_sharded_stage3.py
+26
-19
未找到文件。
python/paddle/distributed/fleet/meta_parallel/sharding/group_sharded_stage3.py
浏览文件 @
6da9db50
...
...
@@ -651,6 +651,11 @@ class GroupShardedStage3(nn.Layer):
for
param
in
trainable_params
:
t_flow
.
full_param
[
param
.
name
][
0
].
_share_buffer_to
(
param
)
# a _allgather_buffer call should be matched with a _release_param call later,
# but the _allgather_buffer call here has no match.
# TODO(liuzhenhai): set a flag here and release full param before forward pass of the first layer,
# when _allgather_buffer is called for get_all_parameters and convert2cpu is false
self
.
_optim
.
_parameter_list
=
self
.
_ori_parameter_list
self
.
_optim
.
_param_groups
=
self
.
_ori_param_groups
...
...
@@ -924,14 +929,11 @@ class TaskFlow:
def
__init__
(
self
,
full_param
=
{},
full_grad
=
{},
use_calc
=
{},
callback
=
None
,
):
self
.
full_param
=
full_param
self
.
full_grad
=
full_grad
self
.
use_calc
=
use_calc
self
.
full_param
=
{}
self
.
full_grad
=
{}
self
.
use_calc
=
{}
self
.
callback
=
callback
...
...
@@ -1004,6 +1006,9 @@ def _allgather_buffer(
offload
=
False
,
convert2cpu
=
False
,
):
if
convert2cpu
:
assert
sync_wait
for
param
in
trainable_params
:
if
param
.
status
==
"all"
:
param
.
use_count
+=
1
...
...
@@ -1020,20 +1025,22 @@ def _allgather_buffer(
if
sync_wait
:
with
paddle
.
amp
.
auto_cast
(
enable
=
False
):
task
.
wait
()
if
convert2cpu
:
# status is not changed
cpu_full_param
=
_device2cpu
(
full_param
.
_slice
(
0
,
param
.
_numel
())
)
full_param
.
_clear_data
()
del
full_param
full_param
=
cpu_full_param
task
=
None
else
:
full_param
.
_slice
(
0
,
param
.
_numel
()).
_share_buffer_to
(
param
)
param
.
fw_storage
.
_clear
()
param
.
fw_storage
=
None
param
.
status
=
"all"
param
.
use_count
+=
1
task_flow
.
full_param
[
param
.
name
]
=
(
full_param
,
task
)
# parameter converts to cpu
if
convert2cpu
:
p_name
=
param
.
name
param
=
_device2cpu
(
param
)
del
task_flow
.
full_param
[
p_name
]
task_flow
.
full_param
[
p_name
]
=
(
param
,
None
)
return
task_flow
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录