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
c6a0cacc
"torchvision/vscode:/vscode.git/clone" did not exist on "22bc44ed76ec314e8c27df1575757d82f2eda0a3"
Unverified
Commit
c6a0cacc
authored
Jun 01, 2025
by
Ravi Theja
Committed by
GitHub
Jun 01, 2025
Browse files
Update CI tests for Llama4 models (#6421)
parent
0a9bfc20
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
74 additions
and
0 deletions
+74
-0
test/srt/models/test_llama4_models.py
test/srt/models/test_llama4_models.py
+74
-0
No files found.
test/srt/models/test_llama4_models.py
0 → 100644
View file @
c6a0cacc
import
random
import
unittest
from
types
import
SimpleNamespace
from
sglang.srt.utils
import
kill_process_tree
from
sglang.test.few_shot_gsm8k
import
run_eval
from
sglang.test.test_utils
import
(
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH
,
DEFAULT_URL_FOR_TEST
,
CustomTestCase
,
popen_launch_server
,
)
MODELS
=
[
SimpleNamespace
(
model
=
"meta-llama/Llama-4-Scout-17B-16E-Instruct"
,
accuracy
=
0.9
,
tp_size
=
4
,
),
]
class
TestLlama4
(
CustomTestCase
):
@
classmethod
def
setUpClass
(
cls
):
cls
.
base_url
=
DEFAULT_URL_FOR_TEST
def
test_gsm8k
(
self
):
for
model
in
MODELS
:
try
:
process
=
popen_launch_server
(
model
.
model
,
self
.
base_url
,
timeout
=
3
*
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH
,
other_args
=
[
"--chat-template"
,
"llama-4"
,
"--tp-size"
,
str
(
model
.
tp_size
),
"--mem-fraction-static"
,
"0.8"
,
"--context-length"
,
"8192"
,
],
)
args
=
SimpleNamespace
(
num_shots
=
5
,
data_path
=
None
,
num_questions
=
200
,
max_new_tokens
=
512
,
parallel
=
128
,
host
=
"http://127.0.0.1"
,
port
=
int
(
self
.
base_url
.
split
(
":"
)[
-
1
]),
)
metrics
=
run_eval
(
args
)
print
(
f
"
{
metrics
=
}
"
)
self
.
assertGreaterEqual
(
metrics
[
"accuracy"
],
model
.
accuracy
)
except
Exception
as
e
:
print
(
f
"Error testing
{
model
.
model
}
:
{
e
}
"
)
self
.
fail
(
f
"Test failed for
{
model
.
model
}
:
{
e
}
"
)
finally
:
# Ensure process cleanup happens regardless of success/failure
if
process
is
not
None
and
process
.
poll
()
is
None
:
print
(
f
"Cleaning up process
{
process
.
pid
}
"
)
try
:
kill_process_tree
(
process
.
pid
)
except
Exception
as
e
:
print
(
f
"Error killing process:
{
e
}
"
)
if
__name__
==
"__main__"
:
unittest
.
main
()
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