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
zhaoyu6
sglang
Commits
150d7020
Unverified
Commit
150d7020
authored
Apr 23, 2024
by
Liangsheng Yin
Committed by
GitHub
Apr 23, 2024
Browse files
Revert removing the unused imports (#385)
parent
9acc6e35
Changes
33
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
28 additions
and
7 deletions
+28
-7
python/sglang/srt/models/yivl.py
python/sglang/srt/models/yivl.py
+3
-1
python/sglang/srt/server.py
python/sglang/srt/server.py
+4
-4
python/sglang/srt/utils.py
python/sglang/srt/utils.py
+1
-0
test/lang/run_all.py
test/lang/run_all.py
+1
-0
test/lang/test_anthropic_backend.py
test/lang/test_anthropic_backend.py
+1
-0
test/lang/test_srt_backend.py
test/lang/test_srt_backend.py
+3
-0
test/lang/test_tracing.py
test/lang/test_tracing.py
+1
-1
test/srt/model/reference_hf.py
test/srt/model/reference_hf.py
+1
-0
test/srt/model/test_llama_extend.py
test/srt/model/test_llama_extend.py
+4
-0
test/srt/model/test_llava_low_api.py
test/srt/model/test_llava_low_api.py
+4
-1
test/srt/test_httpserver_concurrent.py
test/srt/test_httpserver_concurrent.py
+3
-0
test/srt/test_httpserver_llava.py
test/srt/test_httpserver_llava.py
+1
-0
test/srt/test_httpserver_reuse.py
test/srt/test_httpserver_reuse.py
+1
-0
No files found.
python/sglang/srt/models/yivl.py
View file @
150d7020
"""Inference-only Yi-VL model."""
from
typing
import
Optional
import
os
from
typing
import
List
,
Optional
import
torch
import
torch.nn
as
nn
...
...
@@ -12,6 +13,7 @@ from vllm.model_executor.weight_utils import (
from
sglang.srt.models.llava
import
(
LlavaLlamaForCausalLM
,
clip_vision_embed_forward
,
monkey_path_clip_vision_embed_forward
,
)
...
...
python/sglang/srt/server.py
View file @
150d7020
...
...
@@ -10,6 +10,9 @@ import threading
import
time
from
typing
import
List
,
Optional
,
Union
# Fix a Python bug
setattr
(
threading
,
"_register_atexit"
,
lambda
*
args
,
**
kwargs
:
None
)
import
aiohttp
import
psutil
import
pydantic
...
...
@@ -55,9 +58,6 @@ from sglang.srt.managers.tokenizer_manager import TokenizerManager
from
sglang.srt.server_args
import
PortArgs
,
ServerArgs
from
sglang.srt.utils
import
enable_show_time_cost
,
handle_port_init
# Fix a Python bug
setattr
(
threading
,
"_register_atexit"
,
lambda
*
args
,
**
kwargs
:
None
)
asyncio
.
set_event_loop_policy
(
uvloop
.
EventLoopPolicy
())
API_KEY_HEADER_NAME
=
"X-API-Key"
...
...
@@ -619,7 +619,7 @@ def launch_server(server_args, pipe_finish_writer):
try
:
requests
.
get
(
url
+
"/get_model_info"
,
timeout
=
5
,
headers
=
headers
)
break
except
requests
.
exceptions
.
RequestException
:
except
requests
.
exceptions
.
RequestException
as
e
:
pass
else
:
if
pipe_finish_writer
is
not
None
:
...
...
python/sglang/srt/utils.py
View file @
150d7020
...
...
@@ -157,6 +157,7 @@ def get_exception_traceback():
def
get_int_token_logit_bias
(
tokenizer
,
vocab_size
):
from
transformers
import
LlamaTokenizer
,
LlamaTokenizerFast
# a bug when model's vocab size > tokenizer.vocab_size
vocab_size
=
tokenizer
.
vocab_size
...
...
test/lang/run_all.py
View file @
150d7020
import
argparse
import
glob
import
multiprocessing
import
os
import
time
import
unittest
...
...
test/lang/test_anthropic_backend.py
View file @
150d7020
import
json
import
unittest
from
sglang
import
Anthropic
,
set_default_backend
...
...
test/lang/test_srt_backend.py
View file @
150d7020
...
...
@@ -2,6 +2,7 @@
python3 -m sglang.launch_server --model-path meta-llama/Llama-2-7b-chat-hf --port 30000
"""
import
json
import
unittest
import
sglang
as
sgl
...
...
@@ -12,6 +13,8 @@ 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/lang/test_tracing.py
View file @
150d7020
...
...
@@ -110,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
(
"detailed_tip"
)
forks
[
i
]
+=
sgl
.
gen
(
f
"detailed_tip"
)
s
+=
"Tip 1:"
+
forks
[
0
][
"detailed_tip"
]
+
"
\n
"
s
+=
"Tip 2:"
+
forks
[
1
][
"detailed_tip"
]
+
"
\n
"
...
...
test/srt/model/reference_hf.py
View file @
150d7020
import
argparse
import
os
import
torch
from
transformers
import
AutoModelForCausalLM
,
AutoTokenizer
...
...
test/srt/model/test_llama_extend.py
View file @
150d7020
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
...
...
test/srt/model/test_llava_low_api.py
View file @
150d7020
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.model_runner
import
ModelRunner
from
sglang.srt.managers.router.infer_batch
import
ForwardMode
from
sglang.srt.managers.router.model_runner
import
InputMetadata
,
ModelRunner
from
sglang.srt.model_config
import
ModelConfig
from
sglang.srt.utils
import
load_image
...
...
test/srt/test_httpserver_concurrent.py
View file @
150d7020
...
...
@@ -9,8 +9,11 @@ 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 @
150d7020
...
...
@@ -10,6 +10,7 @@ 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 @
150d7020
...
...
@@ -6,6 +6,7 @@ The capital of France is Paris.\nThe capital of the United States is Washington,
"""
import
argparse
import
time
import
requests
...
...
Prev
1
2
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