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
gaoqiong
flash-attention
Commits
56ccaff1
"doc/vscode:/vscode.git/clone" did not exist on "bccf9edf617c8c165d4b452d75485971af08891a"
Commit
56ccaff1
authored
Jul 26, 2023
by
Tri Dao
Browse files
[GPT] Add LLaMa-13B to test
parent
8e9820a5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
tests/models/test_llama.py
tests/models/test_llama.py
+4
-3
No files found.
tests/models/test_llama.py
View file @
56ccaff1
...
...
@@ -183,7 +183,7 @@ def test_llama_parallel(model_name, world_size):
assert
(
logits
-
logits_ref
).
abs
().
max
().
item
()
<
2
*
(
logits_hf
-
logits_ref
).
abs
().
max
().
item
()
@
pytest
.
mark
.
parametrize
(
'model_name'
,
[
"7B"
])
@
pytest
.
mark
.
parametrize
(
'model_name'
,
[
"7B"
,
"13B"
])
def
test_llama_generation
(
model_name
):
checkpoint_path
=
Path
(
os
.
environ
.
get
(
'CHECKPOINT_DIR'
,
current_dir
.
parent
.
parent
/
'checkpoints'
))
/
'llama'
...
...
@@ -219,11 +219,12 @@ def test_llama_generation(model_name):
print
(
f
'Prompt processing + decoding time:
{
(
time
.
time
()
-
start
)
*
1000
:.
0
f
}
ms'
)
del
model_hf
# Need auto here since the 13B fp32 model doesn't fit in memory on a A100 40GB
model_ref
=
LlamaForCausalLM
.
from_pretrained
(
Path
(
checkpoint_path
)
/
f
'
{
model_name
}
-hf'
,
device_map
=
{
""
:
device
}
)
device_map
=
'auto'
)
model_ref
.
eval
()
with
torch
.
no_grad
():
logits_ref
=
model_ref
(
out_hf
.
sequences
).
logits
[:,
(
seqlen
-
1
):
-
1
]
logits_ref
=
model_ref
(
out_hf
.
sequences
).
logits
[:,
(
seqlen
-
1
):
-
1
]
.
to
(
device
=
device
)
del
model_ref
ckpt_state_dicts
=
state_dicts_from_checkpoint
(
checkpoint_path
,
model_name
)
...
...
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