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
35956f82
Commit
35956f82
authored
3 years ago
by
huangxinjing
Browse files
Options
Downloads
Patches
Plain Diff
Add gelu or fast_gelu according to the device
parent
5175ab29
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
official/nlp/pangu_alpha/train.py
+2
-4
2 additions, 4 deletions
official/nlp/pangu_alpha/train.py
with
2 additions
and
4 deletions
official/nlp/pangu_alpha/train.py
+
2
−
4
View file @
35956f82
...
...
@@ -101,8 +101,7 @@ def run_train(args_opt):
model_parallel_num
=
args_opt
.
op_level_model_parallel_num
data_parallel_num
=
int
(
device_num
/
model_parallel_num
)
batch_size
=
args_opt
.
per_batch_size
*
data_parallel_num
parallel_config
=
TransformerOpParallelConfig
(
data_parallel
=
data_parallel_num
,
model_parallel
=
model_parallel_num
,
parallel_config
=
TransformerOpParallelConfig
(
data_parallel
=
data_parallel_num
,
model_parallel
=
model_parallel_num
,
pipeline_stage
=
args_opt
.
stage_num
,
micro_batch_num
=
args_opt
.
micro_size
,
optimizer_shard
=
bool
(
args_opt
.
optimizer_shard
),
...
...
@@ -116,15 +115,14 @@ def run_train(args_opt):
load_ckpt_path
=
args_opt
.
load_ckpt_path
,
param_init_type
=
mstype
.
float32
if
args_opt
.
param_init_type
==
'
fp32
'
else
mstype
.
float16
,
enable_offload
=
bool
(
args_opt
.
opt_offload
),
hidden_act
=
'
fast_gelu
'
if
args_opt
.
device_taget
!=
"
GPU
"
else
'
gelu
'
,
parallel_config
=
parallel_config
)
print
(
"
===config is:
"
,
config
,
flush
=
True
)
# Define network
pangu_alpha
=
PanguAlphaModel
(
config
=
config
)
loss
=
CrossEntropyLoss
(
config
.
parallel_config
.
dp_mp_config
)
pangu_alpha_with_loss_net
=
PanGUAlphaWithLoss
(
config
,
pangu_alpha
,
loss
)
pangu_alpha_with_loss
=
_VirtualDatasetCell
(
pangu_alpha_with_loss_net
)
print
(
"
=====args_opt is:
"
,
args_opt
,
flush
=
True
)
# Warm-up and cosine decay learning rate
lr
=
LearningRate
(
learning_rate
=
args_opt
.
start_lr
,
...
...
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