vllm.engine.output_processor.multi_step
MultiStepOutputProcessor
¶
Bases: SequenceGroupOutputProcessor
SequenceGroupOutputProcessor which handles logic related to detokenization and stopping conditions. It specializes to "multi-step decoding", where vLLM's worker may generate multiple tokens per invocation. This is currently mutually exclusive with advanced sampling techniques like beam search, which motivates the separation of this logic from the single step output processor.
This class is responsible for things such as correctly appending all new token ids to their sequence, detokenizing new token ids, truncating new output tokens after an eos token, and correctly handling the case where the number of new output tokens per sequence differs in a single batch.
Source code in vllm/engine/output_processor/multi_step.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 |
|
__init__
¶
__init__(
detokenizer: Detokenizer,
scheduler: List[Scheduler],
seq_counter: Counter,
get_tokenizer_for_seq: Callable[
[Sequence], AnyTokenizer
],
stop_checker: StopChecker,
)
Source code in vllm/engine/output_processor/multi_step.py
_log_prompt_logprob_unsupported_warning_once
cached
staticmethod
¶
Source code in vllm/engine/output_processor/multi_step.py
_process_decode_and_stop
¶
_process_decode_and_stop(
seq: Sequence, sampling_params: SamplingParams
) -> None
Source code in vllm/engine/output_processor/multi_step.py
_process_seq_outputs
¶
_process_seq_outputs(
seq: Sequence,
valid_samples: List[SequenceOutput],
sampling_params: SamplingParams,
) -> None
Source code in vllm/engine/output_processor/multi_step.py
process_outputs
¶
process_outputs(
sequence_group: SequenceGroup,
outputs: List[SequenceGroupOutput],
is_async: bool = False,
) -> None
Append new tokens in the outputs to sequences in the sequence group.
This only supports sequence groups of size 1. It supports greater than one new token per sequence.
This applies logic like stop condition checking and detokenization. It also handles cases where there are tokens emitted after the EOS token.
is_async - Indicates whether this postprocessor runs in parallel with the GPU forward pass and is processing tokens from the previous step. If this is true, then no tokens need to be appended since it is already done externally (before the next schedule() call)
Source code in vllm/engine/output_processor/multi_step.py
process_prompt_logprob
¶
process_prompt_logprob(
seq_group: SequenceGroup,
outputs: List[SequenceGroupOutput],
) -> None
Process prompt logprobs associated with each step of a multi-step- scheduled computation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
seq_group
|
SequenceGroup
|
the outputs are associated with this
|
required |
outputs
|
List[SequenceGroupOutput]
|
the
|
required |