forked from vllm-project/vllm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Core] Registry for processing model inputs (vllm-project#5214)
Co-authored-by: ywang96 <ywang@roblox.com> Signed-off-by: Alvant <alvasian@yandex.ru>
- Loading branch information
Showing
26 changed files
with
778 additions
and
392 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
docs/source/dev/input_processing/input_processing_pipeline.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
.. _input_processing_pipeline: | ||
|
||
Input Processing Pipeline | ||
========================= | ||
|
||
1. Input data is passed to :class:`~vllm.LLMEngine` (or :class:`~vllm.AsyncLLMEngine`). | ||
|
||
2. Tokenize the data if necessary. | ||
|
||
3. Process the inputs using :meth:`INPUT_REGISTRY.process_input <vllm.inputs.registry.InputRegistry.process_input>`. | ||
|
||
- For example, add placeholder tokens to reserve KV cache for multi-modal embeddings. | ||
|
||
4. Send the processed inputs to :class:`~vllm.executor.executor_base.ExecutorBase`. | ||
|
||
5. Distribute the inputs via :class:`~vllm.worker.worker_base.WorkerBase` to :class:`~vllm.worker.model_runner_base.ModelRunnerBase`. | ||
|
||
6. If the data contains multi-modal data, convert it into keyword arguments using :meth:`MULTIMODAL_REGISTRY.map_input <vllm.multimodal.MultiModalRegistry.map_input>`. | ||
|
||
- For example, convert a :class:`PIL.Image.Image` input to its pixel values for a vision language model. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
.. _input_processing: | ||
|
||
Input Processing | ||
================ | ||
|
||
.. currentmodule:: vllm.inputs | ||
|
||
vLLM provides a mechanism for defining input processors for each model so that the inputs are processed | ||
in :class:`~vllm.LLMEngine` before they are passed to model executors. | ||
|
||
Currently, this mechanism is only utilized in **multi-modal models** for preprocessing multi-modal input | ||
data in addition to input prompt, but it can be extended to text-only language models when needed. | ||
|
||
Guides | ||
++++++ | ||
|
||
.. toctree:: | ||
:maxdepth: 1 | ||
|
||
input_processing_pipeline | ||
|
||
Module Contents | ||
+++++++++++++++ | ||
|
||
LLM Engine Inputs | ||
----------------- | ||
|
||
.. autoclass:: vllm.inputs.LLMInputs | ||
:members: | ||
:show-inheritance: | ||
|
||
Registry | ||
-------- | ||
|
||
.. autodata:: vllm.inputs.INPUT_REGISTRY | ||
|
||
.. automodule:: vllm.inputs.registry | ||
:members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.