From 8efdd165da9261a1501768adf4a7c33031182186 Mon Sep 17 00:00:00 2001 From: biondizzle Date: Sat, 16 May 2026 04:26:43 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20use=20tqdm=20for=20progress=20bars=20?= =?UTF-8?q?=E2=80=94=20single=20line,=20live=20updating?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replaces manual bar printing with tqdm. Overwrites the same line instead of spewing one line per update. --- vllm/patches/deepseek_v4.py | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/vllm/patches/deepseek_v4.py b/vllm/patches/deepseek_v4.py index d7dd3aff..50785954 100644 --- a/vllm/patches/deepseek_v4.py +++ b/vllm/patches/deepseek_v4.py @@ -428,12 +428,8 @@ class DeepseekV4MegaMoEExperts(nn.Module): l1_fp4, l1_sf, l1_gs = [], [], [] l2_fp4, l2_sf, l2_gs = [], [], [] - n_exp = self.num_local_experts - for e in range(n_exp): - if e % max(1, n_exp // 10) == 0 or e == n_exp - 1: - pct = (e + 1) * 100 // n_exp - bar = "█" * (pct // 5) + "░" * (20 - pct // 5) - print(f" NVFP4 experts [{bar}] {pct:3d}% ({e+1}/{n_exp})", flush=True) + from tqdm import tqdm + for e in tqdm(range(self.num_local_experts), desc=" NVFP4 experts", unit="exp"): # ── L1: gate + up (fused) ── gate_w = self.w13_weight.data[e, :self.intermediate_size] # (intermediate, hidden//2) uint8 up_w = self.w13_weight.data[e, self.intermediate_size:] # (intermediate, hidden//2) uint8 @@ -1626,12 +1622,8 @@ class DeepseekV4Model(nn.Module): # Build shard index once for compressor reconstruction (avoids N×M full-shard loads) _shard_index = self._build_shard_index("/model") if os.path.isdir("/model") else None - n_layers = len(self.layers) - for layer_idx, layer in enumerate(self.layers): - if layer_idx % max(1, n_layers // 10) == 0 or layer_idx == n_layers - 1: - pct = (layer_idx + 1) * 100 // n_layers - bar = "█" * (pct // 5) + "░" * (20 - pct // 5) - print(f" NVFP4 convert [{bar}] {pct:3d}% (layer {layer_idx+1}/{n_layers})", flush=True) + from tqdm import tqdm + for layer_idx, layer in tqdm(enumerate(self.layers), total=len(self.layers), desc=" NVFP4 convert", unit="layer"): attn = layer.attn # FP8 conversion: only wo_a