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
05b3bf5e
Unverified
Commit
05b3bf5e
authored
Oct 23, 2024
by
Lianmin Zheng
Committed by
GitHub
Oct 23, 2024
Browse files
Crash the server on warnings in CI (#1772)
parent
3f5ac88d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
6 deletions
+22
-6
python/sglang/srt/layers/sampler.py
python/sglang/srt/layers/sampler.py
+7
-0
python/sglang/srt/model_executor/cuda_graph_runner.py
python/sglang/srt/model_executor/cuda_graph_runner.py
+1
-1
test/srt/test_eval_accuracy_large.py
test/srt/test_eval_accuracy_large.py
+7
-2
test/srt/test_moe_eval_accuracy_large.py
test/srt/test_moe_eval_accuracy_large.py
+7
-2
test/srt/test_pytorch_sampling_backend.py
test/srt/test_pytorch_sampling_backend.py
+0
-1
No files found.
python/sglang/srt/layers/sampler.py
View file @
05b3bf5e
import
logging
import
os
from
typing
import
Union
import
torch
...
...
@@ -17,6 +18,11 @@ if is_flashinfer_available():
top_p_renorm_prob
,
)
# Crash on warning if we are running CI tests
crash_on_warning
=
os
.
getenv
(
"SGLANG_IS_IN_CI"
,
"false"
)
==
"true"
logger
=
logging
.
getLogger
(
__name__
)
...
...
@@ -36,6 +42,7 @@ class Sampler(nn.Module):
logits
=
logits
.
contiguous
()
if
self
.
use_nan_detectioin
and
torch
.
any
(
torch
.
isnan
(
logits
)):
exit
(
1
)
if
crash_on_warning
else
None
logger
.
warning
(
"Detected errors during sampling! NaN in the logits."
)
logits
=
torch
.
where
(
torch
.
isnan
(
logits
),
torch
.
full_like
(
logits
,
-
1e5
),
logits
...
...
python/sglang/srt/model_executor/cuda_graph_runner.py
View file @
05b3bf5e
...
...
@@ -116,7 +116,7 @@ class CudaGraphRunner:
if
self
.
model_runner
.
server_args
.
disable_cuda_graph_padding
:
self
.
capture_bs
=
list
(
range
(
1
,
32
))
+
[
64
,
128
]
else
:
self
.
capture_bs
=
[
1
,
2
,
4
]
+
[
i
*
8
for
i
in
range
(
1
,
21
)]
self
.
capture_bs
=
[
1
,
2
,
3
,
4
]
+
[
i
*
8
for
i
in
range
(
1
,
21
)]
self
.
capture_bs
=
[
bs
for
bs
in
self
.
capture_bs
if
bs
<=
model_runner
.
req_to_token_pool
.
size
]
...
...
test/srt/test_eval_accuracy_large.py
View file @
05b3bf5e
"""
Usage:
python -m unittest test_eval_accuracy_large.TestEvalAccuracyLarge.test_mmlu
"""
import
unittest
from
types
import
SimpleNamespace
...
...
@@ -32,12 +37,12 @@ class TestEvalAccuracyLarge(unittest.TestCase):
base_url
=
self
.
base_url
,
model
=
self
.
model
,
eval_name
=
"mmlu"
,
num_examples
=
3
000
,
num_examples
=
5
000
,
num_threads
=
1024
,
)
metrics
=
run_eval
(
args
)
assert
metrics
[
"score"
]
>=
0.7
05
,
f
"
{
metrics
}
"
assert
metrics
[
"score"
]
>=
0.7
1
,
f
"
{
metrics
}
"
def
test_human_eval
(
self
):
args
=
SimpleNamespace
(
...
...
test/srt/test_moe_eval_accuracy_large.py
View file @
05b3bf5e
"""
Usage:
python -m unittest test_moe_eval_accuracy_large.TestMoEEvalAccuracyLarge.test_mmlu
"""
import
unittest
from
types
import
SimpleNamespace
...
...
@@ -11,7 +16,7 @@ from sglang.test.test_utils import (
)
class
TestEvalAccuracyLarge
(
unittest
.
TestCase
):
class
Test
MoE
EvalAccuracyLarge
(
unittest
.
TestCase
):
@
classmethod
def
setUpClass
(
cls
):
cls
.
model
=
DEFAULT_MOE_MODEL_NAME_FOR_TEST
...
...
@@ -37,7 +42,7 @@ class TestEvalAccuracyLarge(unittest.TestCase):
base_url
=
self
.
base_url
,
model
=
self
.
model
,
eval_name
=
"mmlu"
,
num_examples
=
3
000
,
num_examples
=
5
000
,
num_threads
=
1024
,
)
...
...
test/srt/test_pytorch_sampling_backend.py
View file @
05b3bf5e
import
json
import
unittest
from
types
import
SimpleNamespace
...
...
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