Skip to content

[WIP][RL] fix fp8 update weight #7421

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions python/sglang/srt/layers/quantization/fp8.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,10 +332,10 @@ def process_weights_after_loading(self, layer: Module) -> None:
layer.input_scale = None
else:
weight, weight_scale = layer.weight.data, layer.weight_scale_inv.data
layer.weight = torch.nn.Parameter(weight, requires_grad=False)
layer.weight_scale_inv = torch.nn.Parameter(
weight_scale, requires_grad=False
)
# layer.weight = torch.nn.Parameter(weight, requires_grad=False)
# layer.weight_scale_inv = torch.nn.Parameter(
# weight_scale, requires_grad=False
# )
Comment on lines +335 to +338

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Consider removing these commented-out lines to reduce code clutter and improve readability. If the code is intentionally commented out for debugging or future use, add a comment explaining the reason.

return

layer.weight = torch.nn.Parameter(layer.weight.data, requires_grad=False)
Expand Down