diff --git a/python/sglang/srt/model_loader/loader.py b/python/sglang/srt/model_loader/loader.py index 52bb6aa68..01756de35 100644 --- a/python/sglang/srt/model_loader/loader.py +++ b/python/sglang/srt/model_loader/loader.py @@ -1382,6 +1382,12 @@ class DummyModelLoader(BaseModelLoader): quant_config, ) + # NOTE(woosuk): For accurate performance evaluation, we assign + # random values to the weights. + initialize_dummy_weights(model) + + _post_load_weights(model) + for _, module in model.named_modules(): quant_method = getattr(module, "quant_method", None) if quant_method is not None: @@ -1393,12 +1399,6 @@ class DummyModelLoader(BaseModelLoader): continue quant_method.process_weights_after_loading(module) - # NOTE(woosuk): For accurate performance evaluation, we assign - # random values to the weights. - initialize_dummy_weights(model) - - _post_load_weights(model) - return model.eval()