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
7b6a5332
Unverified
Commit
7b6a5332
authored
Aug 11, 2024
by
Liangsheng Yin
Committed by
GitHub
Aug 11, 2024
Browse files
Fix triton args init (#1034)
parent
4080e822
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
+6
-5
python/sglang/srt/model_executor/forward_batch_info.py
python/sglang/srt/model_executor/forward_batch_info.py
+6
-5
No files found.
python/sglang/srt/model_executor/forward_batch_info.py
View file @
7b6a5332
...
...
@@ -148,9 +148,6 @@ class InputMetadata:
self
.
extend_start_loc
[
1
:]
=
torch
.
cumsum
(
self
.
extend_seq_lens
[:
-
1
],
dim
=
0
)
self
.
extend_no_prefix
=
all
(
x
==
0
for
x
in
prefix_lens_cpu
)
def
init_total_num_tokens
(
self
,
batch
:
ScheduleBatch
):
self
.
total_num_tokens
=
sum
(
len
(
req
.
fill_ids
)
for
req
in
batch
.
reqs
)
@
classmethod
def
from_schedule_batch
(
cls
,
...
...
@@ -174,7 +171,11 @@ class InputMetadata:
ret
.
compute_extend_infos
(
batch
)
ret
.
init_total_num_tokens
(
batch
)
if
(
forward_mode
!=
ForwardMode
.
DECODE
or
model_runner
.
server_args
.
disable_flashinfer
):
ret
.
total_num_tokens
=
int
(
torch
.
sum
(
ret
.
seq_lens
))
if
forward_mode
!=
ForwardMode
.
DECODE
:
ret
.
init_multimuldal_info
(
batch
)
...
...
@@ -203,7 +204,7 @@ class InputMetadata:
def
init_triton_args
(
self
,
batch
:
ScheduleBatch
,
prefix_lens
):
"""Init auxiliary variables for triton attention backend."""
self
.
triton_max_seq_len
=
max
(
len
(
r
.
fill_ids
)
for
r
in
batch
.
req
s
)
self
.
triton_max_seq_len
=
int
(
torch
.
max
(
self
.
seq_len
s
)
)
self
.
triton_prefix_lens
=
prefix_lens
self
.
triton_start_loc
=
torch
.
zeros_like
(
self
.
seq_lens
,
dtype
=
torch
.
int32
)
self
.
triton_start_loc
[
1
:]
=
torch
.
cumsum
(
self
.
seq_lens
[:
-
1
],
dim
=
0
)
...
...
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