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
ad82bac6
Unverified
Commit
ad82bac6
authored
Jan 30, 2024
by
Lianmin Zheng
Committed by
GitHub
Jan 30, 2024
Browse files
Fix model loading & format code (#125)
parent
71b54eea
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
6 deletions
+16
-6
python/sglang/srt/managers/router/infer_batch.py
python/sglang/srt/managers/router/infer_batch.py
+3
-1
python/sglang/srt/managers/router/model_rpc.py
python/sglang/srt/managers/router/model_rpc.py
+8
-4
python/sglang/srt/models/mixtral.py
python/sglang/srt/models/mixtral.py
+5
-1
No files found.
python/sglang/srt/managers/router/infer_batch.py
View file @
ad82bac6
...
...
@@ -63,7 +63,9 @@ class Req:
# FIXME: This logic does not really solve the problem of determining whether
# there should be a leading space.
first_token
=
self
.
tokenizer
.
convert_ids_to_tokens
(
self
.
output_ids
[
0
])
first_token
=
first_token
.
decode
()
if
isinstance
(
first_token
,
bytes
)
else
first_token
first_token
=
(
first_token
.
decode
()
if
isinstance
(
first_token
,
bytes
)
else
first_token
)
if
first_token
.
startswith
(
"▁"
):
old_output_str
=
" "
+
old_output_str
new_input_string
=
(
...
...
python/sglang/srt/managers/router/model_rpc.py
View file @
ad82bac6
...
...
@@ -344,9 +344,13 @@ class ModelRpcServer(rpyc.Service):
return
None
if
self
.
tp_rank
==
0
:
running_req
=
0
if
self
.
running_batch
is
None
else
len
(
self
.
running_batch
.
reqs
)
running_req
=
(
0
if
self
.
running_batch
is
None
else
len
(
self
.
running_batch
.
reqs
)
)
hit_tokens
=
sum
(
len
(
x
.
prefix_indices
)
for
x
in
can_run_list
)
self
.
tree_cache_metrics
[
"total"
]
+=
(
hit_tokens
+
new_batch_input_tokens
)
/
10
**
9
self
.
tree_cache_metrics
[
"total"
]
+=
(
hit_tokens
+
new_batch_input_tokens
)
/
10
**
9
self
.
tree_cache_metrics
[
"hit"
]
+=
hit_tokens
/
10
**
9
tree_cache_hit_rate
=
(
self
.
tree_cache_metrics
[
"hit"
]
/
self
.
tree_cache_metrics
[
"total"
]
...
...
@@ -584,7 +588,7 @@ def start_model_process(port):
t
=
ThreadedServer
(
ModelRpcServer
(),
port
=
port
,
protocol_config
=
{
"allow_pickle"
:
True
,
"sync_request_timeout"
:
6
00
},
protocol_config
=
{
"allow_pickle"
:
True
,
"sync_request_timeout"
:
18
00
},
)
t
.
start
()
...
...
@@ -598,7 +602,7 @@ def start_model_process(port):
con
=
rpyc
.
connect
(
"localhost"
,
port
,
config
=
{
"allow_pickle"
:
True
,
"sync_request_timeout"
:
6
00
},
config
=
{
"allow_pickle"
:
True
,
"sync_request_timeout"
:
18
00
},
)
break
except
ConnectionRefusedError
:
...
...
python/sglang/srt/models/mixtral.py
View file @
ad82bac6
...
...
@@ -351,7 +351,11 @@ class MixtralForCausalLM(nn.Module):
params_dict
=
dict
(
self
.
named_parameters
())
for
name
,
loaded_weight
in
hf_model_weights_iterator
(
model_name_or_path
,
cache_dir
,
load_format
,
revision
model_name_or_path
,
cache_dir
,
load_format
,
revision
,
fall_back_to_pt
=
False
,
):
if
"rotary_emb.inv_freq"
in
name
:
continue
...
...
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