vllm.v1.engine.input_processor
¶
Classes:
InputProcessor
¶
Methods:
-
apply_watermarking–Store the resolved
watermarkingon request-local params. -
assign_request_id–Replace the externally supplied request ID with an internal request ID
-
inject_into_mm_cache–Inject pre-processed mm_kwargs into the processor cache.
-
process_inputs_async–Run
process_inputsoff the event loop. -
resolve_watermarking–Return whether watermarking will be applied to this request.
_build_logits_processors_params_validator()
¶
Load the custom logits processor classes and return the per-request params validator.
_get_mm_identifier(mm_hash, lora_request)
¶
When enable_tower_connector_lora is True, multi-modal embeddings vary depending on the LoRA request. Therefore, the mm_hash must be generated based on the adapter name and path to prevent incorrect cache hits when the same name is loaded from a different path. Paths must identify immutable adapter versions for persistent cache reuse.
_normalize_trace_replay_params(sampling_params, prompt_len)
¶
Apply trace replay's generation semantics to request-local params.
_validate_params(params, supported_tasks)
¶
Raise ValueError if SamplingParams or PoolingParams is not valid.
Returns the resolved watermarking value for SamplingParams (None
for PoolingParams). The caller applies it to its private copy of the
params so that a caller-owned params object is never mutated.
apply_watermarking(params, watermarking)
¶
Store the resolved watermarking on request-local params.
Also records whether watermarking was requested on a watermarking engine but could not be applied, as opposed to an explicit opt-out.
assign_request_id(request)
staticmethod
¶
Replace the externally supplied request ID with an internal request ID that adds 8 random characters in order to ensure uniqueness.
inject_into_mm_cache(mm_hashes, mm_kwargs)
¶
Inject pre-processed mm_kwargs into the processor cache.
Call this when mm_kwargs have already been through the HF processor externally (e.g. by a frontend that transfers pre-processed tensors to the backend). This ensures MM cache hit rate metrics are reported accurately and avoids redundant processing on subsequent requests with the same images.
Uses get_and_update_item() with an empty prompt_updates list,
since token expansion has already been handled externally.
process_inputs_async(request_id, prompt, *args, **kwargs)
async
¶
Run process_inputs off the event loop.
resolve_watermarking(params)
¶
Return whether watermarking will be applied to this request.
None and True request watermarking, while False opts out.
If watermarking is unavailable or incompatible with the request, emit
a warning and return False.
_has_multimodal_data(prompt)
¶
Whether a raw prompt (or either side of an encoder-decoder prompt)
carries multi_modal_data.