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
change
sglang
Commits
916b3cdd
"vscode:/vscode.git/clone" did not exist on "6d3b35fae953bc2f8dcebc3b917f267b8c86f261"
Unverified
Commit
916b3cdd
authored
Nov 03, 2024
by
Jani Monoses
Committed by
GitHub
Nov 03, 2024
Browse files
Allow passing dtype and max_new_tokens to HF reference script (#1903)
parent
838dcda1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
+12
-2
scripts/playground/reference_hf.py
scripts/playground/reference_hf.py
+12
-2
No files found.
scripts/playground/reference_hf.py
View file @
916b3cdd
...
...
@@ -36,7 +36,7 @@ def normal_text(args):
t
=
get_tokenizer
(
args
.
model_path
,
trust_remote_code
=
True
)
m
=
AutoModelForCausalLM
.
from_pretrained
(
args
.
model_path
,
torch_dtype
=
torch
.
float16
,
torch_dtype
=
args
.
dtype
,
low_cpu_mem_usage
=
True
,
device_map
=
"auto"
,
trust_remote_code
=
True
,
...
...
@@ -47,7 +47,7 @@ def normal_text(args):
"The capital of the United Kindom is"
,
"Today is a sunny day and I like"
,
]
max_new_tokens
=
16
max_new_tokens
=
args
.
max_new_tokens
torch
.
cuda
.
set_device
(
0
)
...
...
@@ -104,6 +104,16 @@ if __name__ == "__main__":
default
=
"TinyLlama/TinyLlama-1.1B-Chat-v0.4"
,
# default="meta-llama/Llama-2-7b-chat-hf",
)
parser
.
add_argument
(
"--max-new-tokens"
,
type
=
int
,
default
=
16
)
parser
.
add_argument
(
"--dtype"
,
type
=
str
,
default
=
"float16"
)
args
=
parser
.
parse_args
()
normal_text
(
args
)
...
...
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