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,