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
e2b2f0a2
Unverified
Commit
e2b2f0a2
authored
Mar 22, 2024
by
Lianmin Zheng
Committed by
GitHub
Mar 22, 2024
Browse files
Support oai in benchmark/mmlu (#323)
parent
b57abe16
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
5 deletions
+15
-5
benchmark/mmlu/README.md
benchmark/mmlu/README.md
+4
-0
benchmark/mmlu/bench_sglang.py
benchmark/mmlu/bench_sglang.py
+10
-4
python/sglang/test/test_utils.py
python/sglang/test/test_utils.py
+1
-1
No files found.
benchmark/mmlu/README.md
View file @
e2b2f0a2
...
@@ -15,6 +15,10 @@ python -m sglang.launch_server --model-path meta-llama/Llama-2-7b-chat-hf --port
...
@@ -15,6 +15,10 @@ python -m sglang.launch_server --model-path meta-llama/Llama-2-7b-chat-hf --port
python3 bench_sglang.py --nsub 10
python3 bench_sglang.py --nsub 10
```
```
```
# OpenAI models
python3 bench_sglang.py --backend gpt-3.5-turbo --parallel 8
```
### Benchmark vllm
### Benchmark vllm
```
```
...
...
benchmark/mmlu/bench_sglang.py
View file @
e2b2f0a2
...
@@ -64,10 +64,16 @@ def evaluate(args, subject, dev_df, test_df):
...
@@ -64,10 +64,16 @@ def evaluate(args, subject, dev_df, test_df):
#####################################
#####################################
import
sglang
as
sgl
import
sglang
as
sgl
@
sgl
.
function
if
args
.
backend
.
startswith
(
"gpt-"
):
def
few_shot_mmlu
(
s
,
examples
,
question
):
@
sgl
.
function
s
+=
examples
+
question
+
sgl
.
gen
(
"answer"
)
def
few_shot_mmlu
(
s
,
examples
,
question
):
s
+=
sgl
.
user
(
examples
+
question
)
s
+=
sgl
.
assistant
(
sgl
.
gen
(
"answer"
))
else
:
@
sgl
.
function
def
few_shot_mmlu
(
s
,
examples
,
question
):
s
+=
examples
+
question
+
sgl
.
gen
(
"answer"
)
#####################################
#####################################
########## SGL Program End ##########
########## SGL Program End ##########
...
...
python/sglang/test/test_utils.py
View file @
e2b2f0a2
...
@@ -155,7 +155,7 @@ def select_sglang_backend(args):
...
@@ -155,7 +155,7 @@ def select_sglang_backend(args):
global_config
.
enable_parallel_decoding
=
False
global_config
.
enable_parallel_decoding
=
False
global_config
.
enable_parallel_encoding
=
False
global_config
.
enable_parallel_encoding
=
False
backend
=
RuntimeEndpoint
(
f
"
{
args
.
host
}
:
{
args
.
port
}
"
)
backend
=
RuntimeEndpoint
(
f
"
{
args
.
host
}
:
{
args
.
port
}
"
)
elif
args
.
backend
.
startswith
(
"gpt"
):
elif
args
.
backend
.
startswith
(
"gpt
-
"
):
backend
=
OpenAI
(
args
.
backend
)
backend
=
OpenAI
(
args
.
backend
)
else
:
else
:
raise
ValueError
(
f
"Invalid backend:
{
args
.
backend
}
"
)
raise
ValueError
(
f
"Invalid backend:
{
args
.
backend
}
"
)
...
...
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