mirror of
https://github.com/kvcache-ai/sglang.git
synced 2026-11-05 01:07:39 +00:00
[PR #77] fix(kt): restore integer Marlin weights without gradients #78
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/sglang#78
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/kvcache-ai/sglang/pull/77
Author: @zupengwang
Created: 8/9/2026
Status: 🔄 Open
Base:
main← Head:fix/kt-restore-integer-weights📝 Commits (1)
f95c539fix(kt): restore integer weights without gradients📊 Changes
2 files changed (+36 additions, -1 deletions)
View changed files
📝
python/sglang/srt/layers/moe/kt_ep_wrapper.py(+2 -1)➕
test/srt/test_kt_ep_wrapper.py(+34 -0)📄 Description
Motivation
SharedFullContext._restore_raw_attrs()reconstructs raw Marlin weight tensors astorch.nn.Parameterobjects. For integer weights such as theint32Marlin layout, the defaultrequires_grad=Trueis invalid and raises:This is the failure reported after hybrid GPU prefill in kvcache-ai/ktransformers#2107.
Modifications
requires_grad=False, matching inference-only model weights and supporting integer dtypes.SharedFullContext._restore_raw_attrs()path.Accuracy Tests
Tested on an RTX 3090 with PyTorch 2.9.1+cu128:
The test verifies the restored parameter's shape,
int32dtype, CUDA device, andrequires_grad=False. This change does not alter weight values or model-forward math.Additional checks:
All passed.
Benchmarking and Profiling
Not applicable. The change only controls gradient metadata while recreating a parameter after prefill; it does not change the inference compute path.
Checklist
Review Process
/tag-run-ci-label,/rerun-failed-ci,/tag-and-rerun-ci🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.