Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ColossalAI
Commits
498b5ca9
Unverified
Commit
498b5ca9
authored
Jan 09, 2023
by
HELSON
Committed by
GitHub
Jan 09, 2023
Browse files
[hotfix] fix gpt gemini example (#2404)
* [hotfix] fix gpt gemini example * [example] add new assertions
parent
9880fd2c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
14 deletions
+18
-14
examples/language/gpt/gemini/benchmark_gemini.sh
examples/language/gpt/gemini/benchmark_gemini.sh
+16
-14
examples/language/gpt/gemini/train_gpt_demo.py
examples/language/gpt/gemini/train_gpt_demo.py
+2
-0
No files found.
examples/language/gpt/gemini/benchmark_gemini.sh
View file @
498b5ca9
for
MODEL_TYPE
in
"gpt2_medium"
;
do
for
BATCH_SIZE
in
16
;
do
for
GPUNUM
in
1 2 4 8
;
do
for
TPDEGREE
in
1 2 4 8
;
do
if
[
${
TPDEGREE
}
-gt
${
GPUNUM
}
]
;
then
continue
fi
for
PLACEMENT
in
"cpu"
"auto"
;
do
echo
"****************** Begin ***************************"
echo
"* benchmrking MODEL_TYPE
${
MODEL_TYPE
}
BS
${
BATCH_SIZE
}
BS
${
BS
}
GPUNUM
${
GPUNUM
}
TPDEGREE
${
TPDEGREE
}
PLACEMENT
${
PLACEMENT
}
"
MODEL_TYPE
=
${
MODEL_TYPE
}
BATCH_SIZE
=
${
BATCH_SIZE
}
GPUNUM
=
${
GPUNUM
}
TPDEGREE
=
${
TPDEGREE
}
PLACEMENT
=
${
PLACEMENT
}
\
bash ./gemini/run_gemini.sh
echo
"****************** Finished ***************************"
echo
""
echo
""
for
DISPAN
in
"colossalai"
;
do
for
BATCH_SIZE
in
16
;
do
for
GPUNUM
in
1 2 4 8
;
do
for
TPDEGREE
in
1 2 4 8
;
do
if
[
${
TPDEGREE
}
-gt
${
GPUNUM
}
]
;
then
continue
fi
for
PLACEMENT
in
"cpu"
"auto"
;
do
echo
"****************** Begin ***************************"
echo
"+ benchmrking MODEL
${
MODEL_TYPE
}
DISPAN
${
DISPAN
}
GPU
${
GPUNUM
}
BS
${
BATCH_SIZE
}
TP
${
TPDEGREE
}
POLICY
${
PLACEMENT
}
"
MODEL_TYPE
=
${
MODEL_TYPE
}
DISPAN
=
${
DISPAN
}
BATCH_SIZE
=
${
BATCH_SIZE
}
GPUNUM
=
${
GPUNUM
}
TPDEGREE
=
${
TPDEGREE
}
PLACEMENT
=
${
PLACEMENT
}
\
bash ./run_gemini.sh
echo
"****************** Finished ***************************"
echo
""
echo
""
done
done
done
done
...
...
examples/language/gpt/gemini/train_gpt_demo.py
View file @
498b5ca9
...
...
@@ -270,6 +270,7 @@ def main():
tp_pg
=
ProcessGroup
(
tp_degree
=
args
.
tp_degree
)
# Tensor Parallelism (TP)
# You should notice that v0.1.10 is not compatible with TP degree > 1
tensor_parallelize
(
model
,
tp_pg
)
# build a Gemini model and a highly optimized cpu optimizer
...
...
@@ -278,6 +279,7 @@ def main():
logger
.
info
(
get_mem_info
(
prefix
=
'After init optim, '
),
ranks
=
[
0
])
else
:
assert
args
.
tp_degree
==
1
,
"The degree of TP should be 1 for DDP examples."
model
=
model_builder
(
args
.
model_type
)(
checkpoint
=
True
).
cuda
()
if
args
.
distplan
.
startswith
(
"torch"
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment