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
4e3959d3
Unverified
Commit
4e3959d3
authored
Nov 20, 2023
by
Bin Jia
Committed by
GitHub
Nov 20, 2023
Browse files
[hotfix/hybridengine] Fix init model with random parameters in benchmark (#5074)
* fix init model with random parameters * fix example
parent
8921a73c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
7 deletions
+33
-7
colossalai/shardformer/modeling/chatglm2_6b/__init__.py
colossalai/shardformer/modeling/chatglm2_6b/__init__.py
+0
-0
examples/inference/benchmark.py
examples/inference/benchmark.py
+19
-3
examples/inference/run_benchmark.sh
examples/inference/run_benchmark.sh
+14
-4
No files found.
colossalai/shardformer/modeling/chatglm2_6b/__init__.py
0 → 100644
View file @
4e3959d3
examples/inference/benchmark.py
View file @
4e3959d3
...
@@ -95,11 +95,27 @@ def print_details_info(timestamps, model_config, args, whole_end2end):
...
@@ -95,11 +95,27 @@ def print_details_info(timestamps, model_config, args, whole_end2end):
def
benchmark_inference
(
args
):
def
benchmark_inference
(
args
):
if
args
.
model
==
"toy"
:
if
args
.
model
==
"toy"
:
model
=
transformers
.
LlamaForCausalLM
(
transformers
.
LlamaConfig
(
num_hidden_layers
=
8
))
model
=
transformers
.
LlamaForCausalLM
(
transformers
.
LlamaConfig
(
num_hidden_layers
=
4
))
elif
args
.
model
==
"7b"
:
elif
args
.
model
==
"7b"
:
model
=
transformers
.
LlamaForCausalLM
(
transformers
.
AutoConfig
.
from_pretrained
(
"decapoda-research/llama-7b-hf"
))
model
=
transformers
.
LlamaForCausalLM
(
transformers
.
LlamaConfig
(
hidden_size
=
4096
,
intermediate_size
=
11008
,
num_attention_heads
=
32
,
num_hidden_layers
=
32
,
num_key_value_heads
=
32
,
)
)
elif
args
.
model
==
"13b"
:
elif
args
.
model
==
"13b"
:
model
=
transformers
.
LlamaForCausalLM
(
transformers
.
AutoConfig
.
from_pretrained
(
"decapoda-research/llama-13b-hf"
))
model
=
transformers
.
LlamaForCausalLM
(
transformers
.
LlamaConfig
(
hidden_size
=
5120
,
intermediate_size
=
13824
,
num_attention_heads
=
40
,
num_hidden_layers
=
40
,
num_key_value_heads
=
40
,
)
)
else
:
else
:
raise
NotImplementedError
raise
NotImplementedError
...
...
examples/inference/run_benchmark.sh
View file @
4e3959d3
script_dir
=
$(
cd
"
$(
dirname
"
$0
"
)
"
&&
pwd
)
script_dir
=
$(
cd
"
$(
dirname
"
$0
"
)
"
&&
pwd
)
cd
"
${
script_dir
}
"
cd
"
${
script_dir
}
"
# toy model, 2tp*2pp 1024, 128
python ./benchmark.py
\
--model
=
"toy"
\
--dtype
=
"fp16"
\
--batch_size
=
2
\
--seq_len
=
1024
\
--output_len
=
128
\
--mb_size
=
1
\
--pp_size
=
2
\
--tp_size
=
2
# 7b, fp16, 2 gpu, 1024, 128
# 7b, fp16, 2 gpu, 1024, 128
for
BATCH_SIZE
in
2 4 8 16
;
do
for
BATCH_SIZE
in
2 4 8 16
;
do
...
@@ -9,7 +19,7 @@ for BATCH_SIZE in 2 4 8 16; do
...
@@ -9,7 +19,7 @@ for BATCH_SIZE in 2 4 8 16; do
--dtype
=
"fp16"
\
--dtype
=
"fp16"
\
--batch_size
=
${
BATCH_SIZE
}
\
--batch_size
=
${
BATCH_SIZE
}
\
--seq_len
=
1024
\
--seq_len
=
1024
\
--
new
_len
gth
=
128
\
--
output
_len
=
128
\
--mb_size
=
$((${
BATCH_SIZE
}
/
2
))
\
--mb_size
=
$((${
BATCH_SIZE
}
/
2
))
\
--pp_size
=
2
\
--pp_size
=
2
\
--tp_size
=
2
--tp_size
=
2
...
@@ -22,7 +32,7 @@ for BATCH_SIZE in 2 4 8 16 32; do
...
@@ -22,7 +32,7 @@ for BATCH_SIZE in 2 4 8 16 32; do
--dtype
=
"fp16"
\
--dtype
=
"fp16"
\
--batch_size
=
${
BATCH_SIZE
}
\
--batch_size
=
${
BATCH_SIZE
}
\
--seq_len
=
512
\
--seq_len
=
512
\
--
new
_len
gth
=
512
\
--
output
_len
=
512
\
--mb_size
=
$((${
BATCH_SIZE
}
/
2
))
\
--mb_size
=
$((${
BATCH_SIZE
}
/
2
))
\
--pp_size
=
2
\
--pp_size
=
2
\
--tp_size
=
2
--tp_size
=
2
...
@@ -35,7 +45,7 @@ for BATCH_SIZE in 2 4 8; do
...
@@ -35,7 +45,7 @@ for BATCH_SIZE in 2 4 8; do
--dtype
=
"fp16"
\
--dtype
=
"fp16"
\
--batch_size
=
${
BATCH_SIZE
}
\
--batch_size
=
${
BATCH_SIZE
}
\
--seq_len
=
1024
\
--seq_len
=
1024
\
--
new
_len
gth
=
128
\
--
output
_len
=
128
\
--mb_size
=
$((${
BATCH_SIZE
}
/
2
))
\
--mb_size
=
$((${
BATCH_SIZE
}
/
2
))
\
--pp_size
=
2
\
--pp_size
=
2
\
--tp_size
=
2
--tp_size
=
2
...
@@ -48,7 +58,7 @@ for BATCH_SIZE in 2 4 8 16; do
...
@@ -48,7 +58,7 @@ for BATCH_SIZE in 2 4 8 16; do
--dtype
=
"fp16"
\
--dtype
=
"fp16"
\
--batch_size
=
${
BATCH_SIZE
}
\
--batch_size
=
${
BATCH_SIZE
}
\
--seq_len
=
512
\
--seq_len
=
512
\
--
new
_len
gth
=
512
\
--
output
_len
=
512
\
--mb_size
=
$((${
BATCH_SIZE
}
/
2
))
\
--mb_size
=
$((${
BATCH_SIZE
}
/
2
))
\
--pp_size
=
2
\
--pp_size
=
2
\
--tp_size
=
2
--tp_size
=
2
...
...
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