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
xuwx1
LightX2V
Commits
fc231d3d
Unverified
Commit
fc231d3d
authored
Nov 03, 2025
by
gushiqiao
Committed by
GitHub
Nov 03, 2025
Browse files
Add FP8 conversion for specific weight keys (#431)
Convert weights to FP8 format using FloatQuantizer.
parent
f0f13701
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
0 deletions
+1
-0
tools/convert/quant_adapter.py
tools/convert/quant_adapter.py
+1
-0
No files found.
tools/convert/quant_adapter.py
View file @
fc231d3d
...
@@ -49,6 +49,7 @@ def main():
...
@@ -49,6 +49,7 @@ def main():
print
(
f
"Converting
{
key
}
to FP8, dtype:
{
state_dict
[
key
].
dtype
}
"
)
print
(
f
"Converting
{
key
}
to FP8, dtype:
{
state_dict
[
key
].
dtype
}
"
)
## fp8
## fp8
weight
=
state_dict
[
key
].
to
(
torch
.
float32
).
cuda
()
w_quantizer
=
FloatQuantizer
(
"e4m3"
,
True
,
"per_channel"
)
w_quantizer
=
FloatQuantizer
(
"e4m3"
,
True
,
"per_channel"
)
weight
,
weight_scale
,
_
=
w_quantizer
.
real_quant_tensor
(
weight
)
weight
,
weight_scale
,
_
=
w_quantizer
.
real_quant_tensor
(
weight
)
weight
=
weight
.
to
(
torch
.
float8_e4m3fn
)
weight
=
weight
.
to
(
torch
.
float8_e4m3fn
)
...
...
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