From 22ee9b011165942fcb2d0d8bdd04ec4a6d9f10be Mon Sep 17 00:00:00 2001 From: fzyzcjy <5236035+fzyzcjy@users.noreply.github.com> Date: Sun, 30 Nov 2025 09:07:39 +0800 Subject: [PATCH] Super tiny add more info in dumper (#14145) --- python/sglang/srt/debug_utils/dumper.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/python/sglang/srt/debug_utils/dumper.py b/python/sglang/srt/debug_utils/dumper.py index c53684464..2b5258fa8 100644 --- a/python/sglang/srt/debug_utils/dumper.py +++ b/python/sglang/srt/debug_utils/dumper.py @@ -154,6 +154,19 @@ def get_tensor_info(x): max = x.float().max() if x.numel() > 0 else None mean = x.float().mean() if x.numel() > 0 else None torch.set_printoptions(precision=10) - x_sample = str(x.flatten()[:5]) + x_sample_head = str(x.flatten()[:5]) + x_sample_tail = str(x.flatten()[-5:]) torch.set_printoptions(precision=4) - return f"shape={x.shape} dtype={x.dtype} device={x.device} stride={x.stride()} req_grad={x.requires_grad} min={min} max={max} mean={mean} x_sample={x_sample}" + return ( + f"type={type(x)} " + f"shape={x.shape} " + f"dtype={x.dtype} " + f"device={x.device} " + f"stride={x.stride()} " + f"req_grad={x.requires_grad} " + f"min={min} " + f"max={max} " + f"mean={mean} " + f"x_sample_head={x_sample_head} " + f"x_sample_tail={x_sample_tail}" + )