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
9acc6e35
Unverified
Commit
9acc6e35
authored
Apr 22, 2024
by
Liangsheng Yin
Committed by
GitHub
Apr 22, 2024
Browse files
add `.isort.cfg` (#378)
parent
cf9d8efd
Changes
57
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
24 additions
and
42 deletions
+24
-42
test/lang/test_anthropic_backend.py
test/lang/test_anthropic_backend.py
+1
-3
test/lang/test_bind_pin.py
test/lang/test_bind_pin.py
+1
-2
test/lang/test_openai_backend.py
test/lang/test_openai_backend.py
+1
-2
test/lang/test_srt_backend.py
test/lang/test_srt_backend.py
+1
-5
test/lang/test_tracing.py
test/lang/test_tracing.py
+2
-3
test/lang/test_vertexai_backend.py
test/lang/test_vertexai_backend.py
+1
-2
test/srt/model/bench_llama_low_api.py
test/srt/model/bench_llama_low_api.py
+7
-6
test/srt/model/reference_hf.py
test/srt/model/reference_hf.py
+0
-1
test/srt/model/test_llama_extend.py
test/srt/model/test_llama_extend.py
+1
-4
test/srt/model/test_llama_low_api.py
test/srt/model/test_llama_low_api.py
+1
-0
test/srt/model/test_llava_low_api.py
test/srt/model/test_llava_low_api.py
+2
-4
test/srt/test_flashinfer.py
test/srt/test_flashinfer.py
+1
-0
test/srt/test_httpserver_concurrent.py
test/srt/test_httpserver_concurrent.py
+0
-3
test/srt/test_httpserver_llava.py
test/srt/test_httpserver_llava.py
+0
-1
test/srt/test_httpserver_reuse.py
test/srt/test_httpserver_reuse.py
+0
-1
test/srt/test_jump_forward.py
test/srt/test_jump_forward.py
+2
-2
test/srt/test_robust.py
test/srt/test_robust.py
+3
-3
No files found.
test/lang/test_anthropic_backend.py
View file @
9acc6e35
import
json
import
unittest
from
sglang.test.test_programs
import
test_mt_bench
,
test_stream
from
sglang
import
Anthropic
,
set_default_backend
from
sglang.test.test_programs
import
test_mt_bench
,
test_stream
class
TestAnthropicBackend
(
unittest
.
TestCase
):
...
...
test/lang/test_bind_pin.py
View file @
9acc6e35
import
unittest
from
sglang.backend.runtime_endpoint
import
RuntimeEndpoint
import
sglang
as
sgl
from
sglang.backend.runtime_endpoint
import
RuntimeEndpoint
class
TestBind
(
unittest
.
TestCase
):
...
...
test/lang/test_openai_backend.py
View file @
9acc6e35
import
unittest
from
sglang
import
OpenAI
,
set_default_backend
from
sglang.test.test_programs
import
(
test_decode_int
,
test_decode_json
,
...
...
@@ -15,8 +16,6 @@ from sglang.test.test_programs import (
test_tool_use
,
)
from
sglang
import
OpenAI
,
set_default_backend
class
TestOpenAIBackend
(
unittest
.
TestCase
):
backend
=
None
...
...
test/lang/test_srt_backend.py
View file @
9acc6e35
...
...
@@ -2,9 +2,9 @@
python3 -m sglang.launch_server --model-path meta-llama/Llama-2-7b-chat-hf --port 30000
"""
import
json
import
unittest
import
sglang
as
sgl
from
sglang.test.test_programs
import
(
test_decode_int
,
test_decode_json_regex
,
...
...
@@ -12,16 +12,12 @@ from sglang.test.test_programs import (
test_few_shot_qa
,
test_mt_bench
,
test_parallel_decoding
,
test_parallel_encoding
,
test_react
,
test_regex
,
test_select
,
test_stream
,
test_tool_use
,
)
import
sglang
as
sgl
class
TestSRTBackend
(
unittest
.
TestCase
):
backend
=
None
...
...
test/lang/test_tracing.py
View file @
9acc6e35
import
unittest
import
sglang
as
sgl
from
sglang.backend.base_backend
import
BaseBackend
from
sglang.lang.chat_template
import
get_chat_template
import
sglang
as
sgl
class
TestTracing
(
unittest
.
TestCase
):
def
test_few_shot_qa
(
self
):
...
...
@@ -111,7 +110,7 @@ class TestTracing(unittest.TestCase):
forks
=
s
.
fork
(
3
)
for
i
in
range
(
3
):
forks
[
i
]
+=
f
"Now, expand tip
{
i
+
1
}
into a paragraph:
\n
"
forks
[
i
]
+=
sgl
.
gen
(
f
"detailed_tip"
)
forks
[
i
]
+=
sgl
.
gen
(
"detailed_tip"
)
s
+=
"Tip 1:"
+
forks
[
0
][
"detailed_tip"
]
+
"
\n
"
s
+=
"Tip 2:"
+
forks
[
1
][
"detailed_tip"
]
+
"
\n
"
...
...
test/lang/test_vertexai_backend.py
View file @
9acc6e35
import
unittest
from
sglang
import
VertexAI
,
set_default_backend
from
sglang.test.test_programs
import
(
test_expert_answer
,
test_few_shot_qa
,
...
...
@@ -10,8 +11,6 @@ from sglang.test.test_programs import (
test_stream
,
)
from
sglang
import
VertexAI
,
set_default_backend
class
TestVertexAIBackend
(
unittest
.
TestCase
):
backend
=
None
...
...
test/srt/model/bench_llama_low_api.py
View file @
9acc6e35
...
...
@@ -4,6 +4,7 @@ from dataclasses import dataclass
import
torch
import
torch.distributed
as
dist
from
sglang.srt.managers.router.model_runner
import
ModelRunner
from
sglang.srt.model_config
import
ModelConfig
...
...
@@ -66,9 +67,9 @@ class BenchBatch:
p_idx
=
prefix_req_idx
[
i
//
fork_num
].
item
()
n_idx
=
self
.
req_pool_indices
[
i
].
item
()
req_to_token
[
n_idx
,
:
prefix_len
]
=
req_to_token
[
p_idx
,
:
prefix_len
]
req_to_token
[
n_idx
,
prefix_len
:
prefix_len
+
extend_len
]
=
self
.
out_cache_loc
[
i
*
extend_len
:
(
i
+
1
)
*
extend_len
]
req_to_token
[
n_idx
,
prefix_len
:
prefix_len
+
extend_len
]
=
(
self
.
out_cache_loc
[
i
*
extend_len
:
(
i
+
1
)
*
extend_len
]
)
def
update_decode
(
self
,
predict_ids
,
batch_size
):
assert
predict_ids
.
shape
[
0
]
==
batch_size
...
...
@@ -81,9 +82,9 @@ class BenchBatch:
self
.
out_cache_cont_start
,
self
.
out_cache_cont_end
,
)
=
self
.
token_to_kv_pool
.
alloc_contiguous
(
batch_size
)
self
.
req_to_token_pool
.
req_to_token
[
self
.
req_pool_indices
,
self
.
seq_lens
]
=
self
.
out_cache_loc
self
.
req_to_token_pool
.
req_to_token
[
self
.
req_pool_indices
,
self
.
seq_lens
]
=
(
self
.
out_cache_loc
)
self
.
seq_lens
.
add_
(
1
)
...
...
test/srt/model/reference_hf.py
View file @
9acc6e35
import
argparse
import
os
import
torch
from
transformers
import
AutoModelForCausalLM
,
AutoTokenizer
...
...
test/srt/model/test_llama_extend.py
View file @
9acc6e35
import
multiprocessing
import
os
import
time
import
numpy
as
np
import
torch
import
torch.distributed
as
dist
import
transformers
from
sglang.srt.managers.router.infer_batch
import
Batch
,
ForwardMode
,
Req
from
sglang.srt.managers.router.model_runner
import
ModelRunner
from
sglang.srt.model_config
import
ModelConfig
...
...
test/srt/model/test_llama_low_api.py
View file @
9acc6e35
...
...
@@ -4,6 +4,7 @@ import time
import
numpy
as
np
import
torch
import
torch.distributed
as
dist
from
sglang.srt.managers.router.model_runner
import
ModelRunner
from
sglang.srt.model_config
import
ModelConfig
...
...
test/srt/model/test_llava_low_api.py
View file @
9acc6e35
import
multiprocessing
import
time
import
numpy
as
np
import
torch
import
torch.distributed
as
dist
from
sglang.srt.hf_transformers_utils
import
get_processor
from
sglang.srt.managers.router.infer_batch
import
ForwardMode
from
sglang.srt.managers.router.model_runner
import
InputMetadata
,
ModelRunner
from
sglang.srt.managers.router.model_runner
import
ModelRunner
from
sglang.srt.model_config
import
ModelConfig
from
sglang.srt.utils
import
load_image
...
...
test/srt/test_flashinfer.py
View file @
9acc6e35
import
flashinfer
import
pytest
import
torch
from
sglang.srt.layers.extend_attention
import
extend_attention_fwd
from
sglang.srt.layers.token_attention
import
token_attention_fwd
...
...
test/srt/test_httpserver_concurrent.py
View file @
9acc6e35
...
...
@@ -9,11 +9,8 @@ The capital of the United Kindom is London.\nThe capital of the United Kingdom i
import
argparse
import
asyncio
import
json
import
time
import
aiohttp
import
requests
async
def
send_request
(
url
,
data
,
delay
=
0
):
...
...
test/srt/test_httpserver_llava.py
View file @
9acc6e35
...
...
@@ -10,7 +10,6 @@ The image features a man standing on the back of a yellow taxi cab, holding
import
argparse
import
asyncio
import
json
import
time
import
aiohttp
import
requests
...
...
test/srt/test_httpserver_reuse.py
View file @
9acc6e35
...
...
@@ -6,7 +6,6 @@ The capital of France is Paris.\nThe capital of the United States is Washington,
"""
import
argparse
import
time
import
requests
...
...
test/srt/test_jump_forward.py
View file @
9acc6e35
...
...
@@ -2,14 +2,14 @@ import argparse
from
enum
import
Enum
from
pydantic
import
BaseModel
,
constr
import
sglang
as
sgl
from
sglang.srt.constrained
import
build_regex_from_object
from
sglang.test.test_utils
import
(
add_common_sglang_args_and_parse
,
select_sglang_backend
,
)
import
sglang
as
sgl
IP_REGEX
=
r
"((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)"
ip_jump_forward
=
(
...
...
test/srt/test_robust.py
View file @
9acc6e35
...
...
@@ -2,13 +2,13 @@ import argparse
import
random
import
string
from
vllm.transformers_utils.tokenizer
import
get_tokenizer
import
sglang
as
sgl
from
sglang.test.test_utils
import
(
add_common_sglang_args_and_parse
,
select_sglang_backend
,
)
from
vllm.transformers_utils.tokenizer
import
get_tokenizer
import
sglang
as
sgl
TOKENIZER
=
None
RANDOM_PREFILL_LEN
=
None
...
...
Prev
1
2
3
Next
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