From bb23a8fe7726b28b47cced41b4d59cea4738c5de Mon Sep 17 00:00:00 2001 From: Baizhou Zhang Date: Sat, 3 Jan 2026 10:54:12 +0800 Subject: [PATCH] [Tiny]Remove progress bar for fp8 ue8m0 quant when unneeded (#16177) --- python/sglang/srt/models/deepseek_v2.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/python/sglang/srt/models/deepseek_v2.py b/python/sglang/srt/models/deepseek_v2.py index 2918461d3..ed8cc7ada 100644 --- a/python/sglang/srt/models/deepseek_v2.py +++ b/python/sglang/srt/models/deepseek_v2.py @@ -3997,16 +3997,17 @@ class DeepseekV2ForCausalLM(nn.Module): f"model.layers.{nextn_layer_id}.mlp.{expert_sub_name}.{stem}" ) - for partial_name in tqdm.tqdm( - partial_names, - desc="quant weights to fp8 ue8m0", - ): - original_weight = weights_dict[f"{partial_name}.weight"] - out_w, out_s = quant_weight_ue8m0( - original_weight, weight_block_size=weight_block_size - ) - weights_dict[f"{partial_name}.weight"] = out_w - weights_dict[f"{partial_name}.weight_scale_inv"] = out_s + if len(partial_names) > 0: + for partial_name in tqdm.tqdm( + partial_names, + desc="quant weights to fp8 ue8m0", + ): + original_weight = weights_dict[f"{partial_name}.weight"] + out_w, out_s = quant_weight_ue8m0( + original_weight, weight_block_size=weight_block_size + ) + weights_dict[f"{partial_name}.weight"] = out_w + weights_dict[f"{partial_name}.weight_scale_inv"] = out_s if is_nextn and enable_nextn_moe_bf16_cast_to_fp8(self.quant_config): self._mark_nextn_moe_weights_as_ue8m0()