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
ModelZoo
ChatGLM-6B_pytorch
Commits
5534ac8e
Commit
5534ac8e
authored
Aug 14, 2023
by
zhaoying1
Browse files
Add new file
parent
7a88fd0a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
0 deletions
+10
-0
chatglm-6b testing/test_latency.py
chatglm-6b testing/test_latency.py
+10
-0
No files found.
chatglm-6b testing/test_latency.py
0 → 100644
View file @
5534ac8e
from
transformers
import
AutoModel
,
AutoTokenizer
import
os
tokenizer
=
AutoTokenizer
.
from_pretrained
(
"/zhaoy/chatglm-6b-moel"
,
trust_remote_code
=
True
)
model
=
AutoModel
.
from_pretrained
(
"/zhaoy/chatglm-6b-moel"
,
trust_remote_code
=
True
).
half
().
cuda
()
model
=
model
.
eval
()
text
=
"你好"
response
,
history
=
model
.
measure_latency
(
tokenizer
,
text
,
history
=
[])
print
(
response
)
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