[sgl] copy mm_input in piecewise cuda graph when eagle3 is on (#23613)
This commit is contained in:
@@ -798,6 +798,18 @@ class PiecewiseCudaGraphRunner:
|
|||||||
**kwargs,
|
**kwargs,
|
||||||
)
|
)
|
||||||
if isinstance(output, LogitsProcessorOutput):
|
if isinstance(output, LogitsProcessorOutput):
|
||||||
|
# Preserve mm_input_embeds when speculative decoding is
|
||||||
|
# enabled. The speculative draft's prefill path
|
||||||
|
# (eagle_worker_v2._draft_extend_for_prefill) reads
|
||||||
|
# mm_input_embeds off this LogitsProcessorOutput to reuse
|
||||||
|
# the target's encoder embeddings instead of re-embedding
|
||||||
|
# multimodal placeholder token ids.
|
||||||
|
mm_input_embeds = None
|
||||||
|
if (
|
||||||
|
self.model_runner.spec_algorithm.is_speculative()
|
||||||
|
and output.mm_input_embeds is not None
|
||||||
|
):
|
||||||
|
mm_input_embeds = output.mm_input_embeds[: self.raw_num_tokens]
|
||||||
return LogitsProcessorOutput(
|
return LogitsProcessorOutput(
|
||||||
next_token_logits=output.next_token_logits[
|
next_token_logits=output.next_token_logits[
|
||||||
: self.raw_num_tokens
|
: self.raw_num_tokens
|
||||||
@@ -807,6 +819,7 @@ class PiecewiseCudaGraphRunner:
|
|||||||
if output.hidden_states is not None
|
if output.hidden_states is not None
|
||||||
else None
|
else None
|
||||||
),
|
),
|
||||||
|
mm_input_embeds=mm_input_embeds,
|
||||||
)
|
)
|
||||||
elif isinstance(output, EmbeddingPoolerOutput):
|
elif isinstance(output, EmbeddingPoolerOutput):
|
||||||
return output
|
return output
|
||||||
|
|||||||
Reference in New Issue
Block a user