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
9de1320b
Unverified
Commit
9de1320b
authored
Sep 30, 2025
by
Mick
Committed by
GitHub
Sep 29, 2025
Browse files
fix: fp8 mllama4 without vision modules being quantized (#10611)
parent
dda34c2f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
3 deletions
+14
-3
python/sglang/srt/models/mllama4.py
python/sglang/srt/models/mllama4.py
+14
-3
No files found.
python/sglang/srt/models/mllama4.py
View file @
9de1320b
...
...
@@ -291,7 +291,7 @@ class Llama4UnfoldConvolution(nn.Module):
def
forward
(
self
,
hidden_states
:
torch
.
Tensor
)
->
torch
.
Tensor
:
hidden_states
=
self
.
unfold
(
hidden_states
)
hidden_states
=
hidden_states
.
permute
(
0
,
2
,
1
)
hidden_states
=
hidden_states
.
permute
(
0
,
2
,
1
)
.
contiguous
()
hidden_states
,
_
=
self
.
linear
(
hidden_states
)
return
hidden_states
...
...
@@ -446,9 +446,20 @@ class Llama4ForConditionalGeneration(nn.Module):
)
if
self
.
has_vision
:
# TODO: make this more general
ignore_quant_layers
=
getattr
(
config
,
"quantization_config"
,
{}).
get
(
"ignore"
,
{}
)
if
(
"model.layers.vision_model*"
in
ignore_quant_layers
and
"model.layers.multi_modal_projector*"
in
ignore_quant_layers
):
vision_quant_config
=
None
else
:
vision_quant_config
=
quant_config
self
.
vision_model
=
Llama4VisionModel
(
config
.
vision_config
,
quant_config
=
quant_config
,
quant_config
=
vision_
quant_config
,
prefix
=
add_prefix
(
"vision_model"
,
prefix
),
)
...
...
@@ -560,7 +571,7 @@ class Llama4ForConditionalGeneration(nn.Module):
forward_batch
=
forward_batch
,
language_model
=
self
.
language_model
,
data_embedding_funcs
=
{
Modality
.
IMAGE
:
self
.
get_image_feature
,
Modality
.
IMAGE
:
image_embedding_func
,
},
positions
=
positions
,
)
...
...
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