From d6aacd2801179054e2ea0d88aa30e6a738a0d5e5 Mon Sep 17 00:00:00 2001 From: Lianmin Zheng Date: Wed, 24 Jun 2026 10:33:52 -0700 Subject: [PATCH] Handle input-embed-only batches in eager runner (#29121) Co-authored-by: Cheng Wan <54331508+ch-wan@users.noreply.github.com> --- python/sglang/srt/model_executor/runner/eager_runner.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/python/sglang/srt/model_executor/runner/eager_runner.py b/python/sglang/srt/model_executor/runner/eager_runner.py index 8a61636ec..489e5d7d5 100644 --- a/python/sglang/srt/model_executor/runner/eager_runner.py +++ b/python/sglang/srt/model_executor/runner/eager_runner.py @@ -169,7 +169,12 @@ class EagerRunner(BaseRunner): if envs.SGLANG_EAGER_INPUT_NO_COPY.get(): return replace(forward_batch) raw_bs = forward_batch.batch_size - raw_num_tokens = forward_batch.input_ids.shape[0] + if forward_batch.input_ids is not None: + raw_num_tokens = forward_batch.input_ids.shape[0] + elif forward_batch.input_embeds is not None: + raw_num_tokens = forward_batch.input_embeds.shape[0] + else: + raw_num_tokens = 0 registry = self._eager_registry registry.fill_from( forward_batch,