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
5f9b2c62
"vscode:/vscode.git/clone" did not exist on "a7d6fa6dd183d5dac6c83f2e194298e0b2cd49b6"
Unverified
Commit
5f9b2c62
authored
Mar 17, 2025
by
yiakwy-xpu-ml-framework-team
Committed by
GitHub
Mar 17, 2025
Browse files
[ROCm] fix dtype (#4510)
parent
5493c334
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
python/sglang/srt/layers/quantization/w8a8_fp8.py
python/sglang/srt/layers/quantization/w8a8_fp8.py
+6
-1
No files found.
python/sglang/srt/layers/quantization/w8a8_fp8.py
View file @
5f9b2c62
...
@@ -108,10 +108,15 @@ class W8A8Fp8LinearMethod(LinearMethodBase):
...
@@ -108,10 +108,15 @@ class W8A8Fp8LinearMethod(LinearMethodBase):
layer
.
weight
,
layer
.
weight
.
shape
[
-
1
]
layer
.
weight
,
layer
.
weight
.
shape
[
-
1
]
)
)
weight_scale
=
weight_scale
.
t
().
contiguous
()
weight_scale
=
weight_scale
.
t
().
contiguous
()
if
_is_hip
:
weight
,
weight_scale
,
_
=
normalize_e4m3fn_to_e4m3fnuz
(
weight
=
weight
,
weight_scale
=
weight_scale
)
else
:
else
:
# if cutlass not supported, we fall back to use torch._scaled_mm
# if cutlass not supported, we fall back to use torch._scaled_mm
# which requires per tensor quantization on weight
# which requires per tensor quantization on weight
qweight
,
weight_scale
=
input_to_float8
(
layer
.
weight
)
fp8_dtype
=
torch
.
float8_e4m3fnuz
if
_is_hip
else
torch
.
float8_e4m3fn
qweight
,
weight_scale
=
input_to_float8
(
layer
.
weight
,
dtype
=
fp8_dtype
)
# Update the layer with the new values.
# Update the layer with the new values.
layer
.
weight
=
Parameter
(
qweight
.
t
(),
requires_grad
=
False
)
layer
.
weight
=
Parameter
(
qweight
.
t
(),
requires_grad
=
False
)
...
...
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