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
6b7c2471
Unverified
Commit
6b7c2471
authored
Aug 13, 2025
by
Nicolas Castet
Committed by
GitHub
Aug 13, 2025
Browse files
Fix broken trtllm_mha attn backend with gpt-oss (#9161)
parent
a027a9b4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
python/sglang/srt/models/gpt_oss.py
python/sglang/srt/models/gpt_oss.py
+5
-1
No files found.
python/sglang/srt/models/gpt_oss.py
View file @
6b7c2471
...
@@ -293,8 +293,12 @@ class GptOssAttention(nn.Module):
...
@@ -293,8 +293,12 @@ class GptOssAttention(nn.Module):
prefix
=
add_prefix
(
"qkv_proj"
,
prefix
),
prefix
=
add_prefix
(
"qkv_proj"
,
prefix
),
)
)
# Choose dtype of sinks based on attention backend: trtllm_mha requires float32,
# others can use bfloat16
attn_backend
=
global_server_args_dict
.
get
(
"attention_backend"
)
sinks_dtype
=
torch
.
float32
if
attn_backend
==
"trtllm_mha"
else
torch
.
bfloat16
self
.
sinks
=
nn
.
Parameter
(
self
.
sinks
=
nn
.
Parameter
(
torch
.
empty
(
self
.
num_heads
,
dtype
=
torch
.
bfloat16
),
requires_grad
=
False
torch
.
empty
(
self
.
num_heads
,
dtype
=
sinks_dtype
),
requires_grad
=
False
)
)
self
.
o_proj
=
RowParallelLinear
(
self
.
o_proj
=
RowParallelLinear
(
...
...
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