THUDM / THUDM/slime

[Question] INT4 scripts failed during `process_weights_after_loading ()`

Open
#1,653 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
Python
Stars
8.5k
Forks
1.3k
Avg merge
5h 36m
Merged PRs (30d)
22

Description

Your Question

I try to reproduce the script run-qwen3-30B-A3B-int4.sh.

I make the following steps:

  1. quantize model to INT4 with
python tools/convert_hf_to_int4.py \
--input-dir ${MY_MODEL_DIR}/Qwen/Qwen3-30B-A3B \
--output-dir ${MY_MODEL_DIR}/Qwen/Qwen3-30B-A3B-INT4 \
--data-dir ${MY_DATA_DIR}/Salesforce/wikitext/wikitext-2-raw-v1`
  1. convert model to torch_dist with
source "./scripts/models/qwen3-4B.sh"
python tools/convert_hf_to_torch_dist.py \
${MODEL_ARGS[@]} \
--hf-checkpoint ${MY_MODEL_DIR}/Qwen/Qwen3-30B-A3B \
--save ${MY_MODEL_DIR}/Qwen/Qwen3-30B-A3B_torch_dist
  1. run the script run-qwen3-30B-A3B-int4.sh with CKPT_ARGS changed
CKPT_ARGS=(
   --hf-checkpoint ${MY_MODEL_DIR}/Qwen/Qwen3-30B-A3B-INT4/
   --ref-load ${MY_MODEL_DIR}/Qwen/Qwen3-30B-A3B_torch_dist/
)

Here is the log:
Update weights: 95%|█████████▍| 109/115 [00:35<00:01, 4.72it/s]
Update weights: 96%|█████████▌| 110/115 [00:35<00:01, 4.57it/s]
Update weights: 97%|█████████▋| 111/115 [00:35<00:00, 4.66it/s]
Update weights: 97%|█████████▋| 112/115 [00:36<00:00, 3.68it/s]
Update weights: 98%|█████████▊| 113/115 [00:36<00:00, 4.53it/s]
(SGLangEngine pid=179232) [2026-03-02 15:17:25] Scheduler hit an exception: Traceback (most recent call last):
(SGLangEngine pid=179232) File "/root/sglang/python/sglang/srt/managers/scheduler.py", line 2955, in run_scheduler_process
(SGLangEngine pid=179232) scheduler.event_loop_overlap()
(SGLangEngine pid=179232) File "/usr/local/lib/python3.11/dist-packages/torch/utils/_contextlib.py", line 120, in decorate_context
(SGLangEngine pid=179232) return func(*args, **kwargs)
(SGLangEngine pid=179232) ^^^^^^^^^^^^^^^^^^^^^
(SGLangEngine pid=179232) File "/root/sglang/python/sglang/srt/managers/scheduler.py", line 1121, in event_loop_overlap
(SGLangEngine pid=179232) self.process_input_requests(recv_reqs)
(SGLangEngine pid=179232) File "/root/sglang/python/sglang/srt/managers/scheduler.py", line 1329, in process_input_requests
(SGLangEngine pid=179232) output = self._request_dispatcher(recv_req)
(SGLangEngine pid=179232) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(SGLangEngine pid=179232) File "/root/sglang/python/sglang/utils.py", line 507, in call
(SGLangEngine pid=179232) return fn(obj)
(SGLangEngine pid=179232) ^^^^^^^
(SGLangEngine pid=179232) File "/root/sglang/python/sglang/srt/managers/scheduler_update_weights_mixin.py", line 125, in post_process_weights
(SGLangEngine pid=179232) success, message = self.tp_worker.post_process_weights(recv_req)
(SGLangEngine pid=179232) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(SGLangEngine pid=179232) File "/root/sglang/python/sglang/srt/managers/tp_worker.py", line 181, in post_process_weights
(SGLangEngine pid=179232) success, message = self.model_runner.post_process_weights(recv_req)
(SGLangEngine pid=179232) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(SGLangEngine pid=179232) File "/root/sglang/python/sglang/srt/model_executor/model_runner.py", line 2480, in post_process_weights
(SGLangEngine pid=179232) quant_method.process_weights_after_loading(module)
(SGLangEngine pid=179232) File "/root/sglang/python/sglang/srt/layers/quantization/compressed_tensors/compressed_tensors.py", line 691, in process_weights_after_loading
(SGLangEngine pid=179232) layer.scheme.process_weights_after_loading(layer)
(SGLangEngine pid=179232) File "/root/sglang/python/sglang/srt/layers/quantization/compressed_tensors/schemes/compressed_tensors_wNa16.py", line 300, in process_weights_after_loading
(SGLangEngine pid=179232) _transform_param(layer, self.w_q_name, transform_w_q)
(SGLangEngine pid=179232) File "/root/sglang/python/sglang/srt/layers/quantization/compressed_tensors/schemes/compressed_tensors_wNa16.py", line 239, in _transform_param
(SGLangEngine pid=179232) new_param = fn(old_param)
(SGLangEngine pid=179232) ^^^^^^^^^^^^^
(SGLangEngine pid=179232) File "/root/sglang/python/sglang/srt/layers/quantization/compressed_tensors/schemes/compressed_tensors_wNa16.py", line 247, in transform_w_q
(SGLangEngine pid=179232) assert isinstance(x, BasevLLMParameter), f"w_q must be BasevLLMParameter, but got {type(x)}"
(SGLangEngine pid=179232) AssertionError: w_q must be BasevLLMParameter, but got <class 'torch.nn.parameter.Parameter'>
(SGLangEngine pid=179232)
(SGLangEngine pid=179232) [2026-03-02 15:17:25] SIGQUIT received. signum=None, frame=None. It usually means one child failed.
Update weights: 100%|██████████| 115/115 [00:36<00:00, 3.17it/s]

What I've Tried

N/A

Environment (if relevant)

export SGLANG_COMMIT="24c91001cf99ba642be791e099d358f4dfe955f5"
export MEGATRON_COMMIT="3714d81d418c9f1bca4594fc35f9e8289f652862"

The patch version I used is v0.5.7

Additional Context

No response

Pre-submission Checklist

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce run-qwen3-30B-A3B-int4.sh with the stated CKPT_ARGS, then trace the failure from python/sglang/srt/model_executor/model_runner.py into compressed_tensors.py and compressed_tensors_wNa16.py. Confirm the cause of the parameter-type assertion and make the failure reproducible with an actionable fix or usage guidance.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
ai, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.