From b8df43ab9c0d3c9a6856f762eb583e726b794184 Mon Sep 17 00:00:00 2001 From: Qiaolin Yu Date: Wed, 25 Jun 2025 14:42:21 -0700 Subject: [PATCH] Fix gathered_buffer issues in tbo (#7531) --- python/sglang/srt/two_batch_overlap.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python/sglang/srt/two_batch_overlap.py b/python/sglang/srt/two_batch_overlap.py index 601d39183..a2f3936a4 100644 --- a/python/sglang/srt/two_batch_overlap.py +++ b/python/sglang/srt/two_batch_overlap.py @@ -346,7 +346,10 @@ class TboForwardBatchPreparer: ) # TODO improve, e.g. unify w/ `init_raw` - if global_server_args_dict["moe_dense_tp_size"] == 1: + if ( + global_server_args_dict["moe_dense_tp_size"] == 1 + and batch.gathered_buffer is not None + ): sum_len = end_token_index - start_token_index gathered_buffer = torch.zeros( (sum_len, batch.gathered_buffer.shape[1]),