Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
2
221cb0332
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Summer2022
221cb0332
Commits
2279201d
Commit
2279201d
authored
2 years ago
by
bichaoyang
Browse files
Options
Downloads
Patches
Plain Diff
fix issue of offload
parent
84501432
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
official/nlp/pangu_alpha/scripts/run_distribute_train_moe_host_device.sh
+1
-0
1 addition, 0 deletions
...ngu_alpha/scripts/run_distribute_train_moe_host_device.sh
official/nlp/pangu_alpha/src/pangu_alpha_wrapcell.py
+1
-8
1 addition, 8 deletions
official/nlp/pangu_alpha/src/pangu_alpha_wrapcell.py
with
2 additions
and
8 deletions
official/nlp/pangu_alpha/scripts/run_distribute_train_moe_host_device.sh
+
1
−
0
View file @
2279201d
...
...
@@ -40,6 +40,7 @@ LOCAL_DEVICE_NUM=${10}
EXPERT_NUM
=
${
11
}
ENABLE_ALLTOALL
=
${
12
}
EXPERT_PARALLEL_NUM
=
${
13
}
export
HCCL_EXEC_TIMEOUT
=
1500
for
((
i
=
0
;
i<
${
LOCAL_DEVICE_NUM
}
;
i++
))
;
do
...
...
This diff is collapsed.
Click to expand it.
official/nlp/pangu_alpha/src/pangu_alpha_wrapcell.py
+
1
−
8
View file @
2279201d
...
...
@@ -121,8 +121,6 @@ class PanguAlphaTrainOneStepWithLossScaleCell(TrainOneStepWithLossScaleCell):
else
:
self
.
clip
=
ClipByGlobalNorm
(
self
.
weights
,
config
)
self
.
cast
=
P
.
Cast
()
self
.
sync_all_reduce
=
P
.
AllReduce
()
self
.
sync_tensor
=
Tensor
(
0.0
,
dtype
=
mstype
.
float32
)
def
construct
(
self
,
input_ids
,
input_position
,
attention_mask
,
layer_past
=
None
,
sens
=
None
):
"""
Defines the computation performed.
"""
...
...
@@ -158,12 +156,7 @@ class PanguAlphaTrainOneStepWithLossScaleCell(TrainOneStepWithLossScaleCell):
# if not, update weights
if
not
overflow
:
if
self
.
enable_offload
:
res
=
self
.
optimizer
(
grads
,
clip_value
)
# For moe and enable_offload, compile time of difference devices have great gap and cause
# notify wait, a sync allreduce at the end of last graph is need
sync_tensor
=
F
.
depend
(
self
.
sync_tensor
,
res
)
sync_flag
=
self
.
sync_all_reduce
(
sync_tensor
)
loss
=
F
.
depend
(
loss
,
sync_flag
)
self
.
optimizer
(
grads
,
clip_value
)
else
:
self
.
optimizer
(
grads
)
return
loss
,
cond
,
scaling_sens
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment