[Doc] Convert Sphinx directives ( {class}, {meth}, {attr}, ...) to MkDocs format for better documentation linking (#18663)
Signed-off-by: Zerohertz <ohg3417@gmail.com>
This commit is contained in:
@@ -475,7 +475,8 @@ class _AsyncLLMEngine(LLMEngine):
|
||||
*,
|
||||
inputs: Optional[PromptType] = None, # DEPRECATED
|
||||
) -> None:
|
||||
"""Async version of {meth}`add_request`."""
|
||||
"""Async version of
|
||||
[`add_request`][vllm.engine.llm_engine.LLMEngine.add_request]."""
|
||||
if inputs is not None:
|
||||
prompt = inputs
|
||||
assert prompt is not None and params is not None
|
||||
@@ -582,20 +583,21 @@ async def build_guided_decoding_logits_processor_async(
|
||||
|
||||
|
||||
class AsyncLLMEngine(EngineClient):
|
||||
"""An asynchronous wrapper for {class}`LLMEngine`.
|
||||
"""An asynchronous wrapper for [`LLMEngine`][vllm.LLMEngine].
|
||||
|
||||
This class is used to wrap the {class}`LLMEngine` class to make it
|
||||
asynchronous. It uses asyncio to create a background loop that keeps
|
||||
processing incoming requests. The {class}`LLMEngine` is kicked by the
|
||||
generate method when there are requests in the waiting queue. The generate
|
||||
method yields the outputs from the {class}`LLMEngine` to the caller.
|
||||
This class is used to wrap the [`LLMEngine`][vllm.LLMEngine] class to
|
||||
make it asynchronous. It uses asyncio to create a background loop that keeps
|
||||
processing incoming requests. The [`LLMEngine`][vllm.LLMEngine] is kicked
|
||||
by the generate method when there are requests in the waiting queue. The
|
||||
generate method yields the outputs from the [`LLMEngine`][vllm.LLMEngine]
|
||||
to the caller.
|
||||
|
||||
Args:
|
||||
log_requests: Whether to log the requests.
|
||||
start_engine_loop: If True, the background task to run the engine
|
||||
will be automatically started in the generate call.
|
||||
*args: Arguments for {class}`LLMEngine`.
|
||||
**kwargs: Arguments for {class}`LLMEngine`.
|
||||
*args: Arguments for [`LLMEngine`][vllm.LLMEngine].
|
||||
**kwargs: Arguments for [`LLMEngine`][vllm.LLMEngine].
|
||||
"""
|
||||
|
||||
_engine_class: Type[_AsyncLLMEngine] = _AsyncLLMEngine
|
||||
@@ -985,8 +987,9 @@ class AsyncLLMEngine(EngineClient):
|
||||
from the LLMEngine to the caller.
|
||||
|
||||
Args:
|
||||
prompt: The prompt to the LLM. See {class}`~vllm.inputs.PromptType`
|
||||
for more details about the format of each input.
|
||||
prompt: The prompt to the LLM. See
|
||||
[`PromptType`][vllm.inputs.PromptType] for more details about
|
||||
the format of each input.
|
||||
sampling_params: The sampling parameters of the request.
|
||||
request_id: The unique id of the request.
|
||||
lora_request: LoRA request to use for generation, if any.
|
||||
@@ -1003,7 +1006,7 @@ class AsyncLLMEngine(EngineClient):
|
||||
Details:
|
||||
- If the engine is not running, start the background loop,
|
||||
which iteratively invokes
|
||||
{meth}`~vllm.engine.async_llm_engine.AsyncLLMEngine.engine_step`
|
||||
[`engine_step`][vllm.engine.async_llm_engine.AsyncLLMEngine.engine_step]
|
||||
to process the waiting requests.
|
||||
- Add the request to the engine's `RequestTracker`.
|
||||
On the next background loop, this request will be sent to
|
||||
@@ -1075,8 +1078,9 @@ class AsyncLLMEngine(EngineClient):
|
||||
from the LLMEngine to the caller.
|
||||
|
||||
Args:
|
||||
prompt: The prompt to the LLM. See {class}`~vllm.inputs.PromptType`
|
||||
for more details about the format of each input.
|
||||
prompt: The prompt to the LLM. See
|
||||
[`PromptType`][vllm.inputs.PromptType] for more details about
|
||||
the format of each input.
|
||||
pooling_params: The pooling parameters of the request.
|
||||
request_id: The unique id of the request.
|
||||
lora_request: LoRA request to use for generation, if any.
|
||||
@@ -1089,15 +1093,15 @@ class AsyncLLMEngine(EngineClient):
|
||||
for the request.
|
||||
|
||||
Details:
|
||||
- If the engine is not running, start the background loop,
|
||||
which iteratively invokes
|
||||
{meth}`~vllm.engine.async_llm_engine.AsyncLLMEngine.engine_step`
|
||||
to process the waiting requests.
|
||||
- Add the request to the engine's `RequestTracker`.
|
||||
On the next background loop, this request will be sent to
|
||||
the underlying engine.
|
||||
Also, a corresponding `AsyncStream` will be created.
|
||||
- Wait for the request outputs from `AsyncStream` and yield them.
|
||||
- If the engine is not running, start the background loop,
|
||||
which iteratively invokes
|
||||
[`vllm.engine.async_llm_engine.AsyncLLMEngine.engine_step`][]
|
||||
to process the waiting requests.
|
||||
- Add the request to the engine's `RequestTracker`.
|
||||
On the next background loop, this request will be sent to
|
||||
the underlying engine.
|
||||
Also, a corresponding `AsyncStream` will be created.
|
||||
- Wait for the request outputs from `AsyncStream` and yield them.
|
||||
|
||||
Example:
|
||||
```
|
||||
|
||||
@@ -130,11 +130,11 @@ class LLMEngine:
|
||||
iteration-level scheduling and efficient memory management to maximize the
|
||||
serving throughput.
|
||||
|
||||
The [LLM][vllm.LLM] class wraps this class for offline batched inference
|
||||
and the [AsyncLLMEngine][] class wraps this class for online serving.
|
||||
The [`LLM`][vllm.LLM] class wraps this class for offline batched inference
|
||||
and the [`AsyncLLMEngine`][vllm.engine.async_llm_engine.AsyncLLMEngine]
|
||||
class wraps this class for online serving.
|
||||
|
||||
The config arguments are derived from [EngineArgs][vllm.EngineArgs]. (See
|
||||
[engine-args][])
|
||||
The config arguments are derived from [`EngineArgs`][vllm.EngineArgs].
|
||||
|
||||
Args:
|
||||
vllm_config: The configuration for initializing and running vLLM.
|
||||
|
||||
@@ -492,8 +492,9 @@ class MQLLMEngineClient(EngineClient):
|
||||
from the LLMEngine to the caller.
|
||||
|
||||
Args:
|
||||
prompt: The prompt to the LLM. See {class}`~vllm.inputs.PromptType`
|
||||
for more details about the format of each input.
|
||||
prompt: The prompt to the LLM. See
|
||||
[`PromptType`][vllm.inputs.PromptType] for more details about
|
||||
the format of each input.
|
||||
sampling_params: The sampling parameters of the request.
|
||||
request_id: The unique id of the request.
|
||||
lora_request: LoRA request to use for generation, if any.
|
||||
@@ -561,8 +562,9 @@ class MQLLMEngineClient(EngineClient):
|
||||
from the LLMEngine to the caller.
|
||||
|
||||
Args:
|
||||
prompt: The prompt to the LLM. See {class}`~vllm.inputs.PromptType`
|
||||
for more details about the format of each input.
|
||||
prompt: The prompt to the LLM. See
|
||||
[`PromptType`][vllm.inputs.PromptType] for more details about
|
||||
the format of each input.
|
||||
pooling_params: The pooling parameters of the request.
|
||||
request_id: The unique id of the request.
|
||||
lora_request: LoRA request to use for generation, if any.
|
||||
|
||||
@@ -42,19 +42,22 @@ HEALTHY_RESPONSE = (pickle.dumps(VLLM_RPC_SUCCESS_STR), )
|
||||
|
||||
|
||||
class MQLLMEngine:
|
||||
"""A multiprocessing wrapper for {class}`LLMEngine`.
|
||||
"""A multiprocessing wrapper for
|
||||
[`LLMEngine`][vllm.engine.llm_engine.LLMEngine].
|
||||
|
||||
This class is used to wrap the {class}`LLMEngine` class to enable use
|
||||
This class is used to wrap the
|
||||
[`LLMEngine`][vllm.engine.llm_engine.LLMEngine] class to enable use
|
||||
in concurrnet manner. It runs a background loop and uses zeromq to
|
||||
receive new requests and stream outputs incrementally via ipc.
|
||||
|
||||
The {class}`LLMEngine` generate or encode process is kicked off when a new
|
||||
RPCProcessRequest is received by the input_socket.
|
||||
The [`LLMEngine`][vllm.engine.llm_engine.LLMEngine] generate or encode
|
||||
process is kicked off when a new RPCProcessRequest is received by the
|
||||
input_socket.
|
||||
|
||||
The self.engine_loop checks the input_socket for new requests,
|
||||
adds them to the LLMEngine if there are any, calls the internal
|
||||
{class}`LLMEngine.step()`, and sends the RequestOutputs back over
|
||||
the output_socket.
|
||||
[`LLMEngine.step()`][vllm.engine.llm_engine.LLMEngine.step], and sends
|
||||
the RequestOutputs back over the output_socket.
|
||||
|
||||
If use_async_sockets is set, the logic associated with reading new
|
||||
requests from the socket and sending data to the socket is passed
|
||||
@@ -65,8 +68,8 @@ class MQLLMEngine:
|
||||
ipc_path: Base path for zeromq interprocess messaging
|
||||
use_async_sockets: Whether to make send/recv async with GPU
|
||||
log_requests: Whether to log the requests.
|
||||
*args: Arguments for {class}`LLMEngine`.
|
||||
**kwargs: Arguments for {class}`LLMEngine`.
|
||||
*args: Arguments for [`LLMEngine`][vllm.engine.llm_engine.LLMEngine].
|
||||
**kwargs: Arguments for [`LLMEngine`][vllm.engine.llm_engine.LLMEngine].
|
||||
"""
|
||||
|
||||
def __init__(self,
|
||||
|
||||
@@ -56,8 +56,11 @@ class MultiStepOutputProcessor(SequenceGroupOutputProcessor):
|
||||
scheduled computation.
|
||||
|
||||
Args:
|
||||
seq_group: the outputs are associated with this {class}`SequenceGroup`
|
||||
outputs: the {class}`SequenceGroupOutput`s for all scheduler steps
|
||||
seq_group: the outputs are associated with this
|
||||
[`SequenceGroup`][vllm.sequence.SequenceGroup]
|
||||
outputs: the
|
||||
[`SequenceGroupOutput`][vllm.sequence.SequenceGroupOutput]s
|
||||
for all scheduler steps
|
||||
"""
|
||||
for output in outputs:
|
||||
# Concatenate single-step prompt logprob processing results.
|
||||
|
||||
@@ -19,17 +19,21 @@ logger = init_logger(__name__)
|
||||
def single_step_process_prompt_logprob(
|
||||
sg_output_proc: SequenceGroupOutputProcessor, seq_group: SequenceGroup,
|
||||
output: CompletionSequenceGroupOutput) -> None:
|
||||
"""Process prompt logprobs associated with the {class}`SequenceGroupOutput`
|
||||
for a given step.
|
||||
"""Process prompt logprobs associated with the
|
||||
[`SequenceGroupOutput`][vllm.sequence.SequenceGroupOutput] for a given step.
|
||||
|
||||
Do nothing if the output has no prompt logprobs.
|
||||
|
||||
Account for the fact that transformers do not compute first-token logprobs.
|
||||
|
||||
Args:
|
||||
sg_output_proc: {class}`SequenceGroupOutputProcessor` instance
|
||||
seq_group: the output is associated with this {class}`SequenceGroup`
|
||||
output: the {class}`SequenceGroupOutput` for a single scheduler step
|
||||
sg_output_proc:
|
||||
[`SequenceGroupOutputProcessor`][vllm.engine.output_processor.interfaces.SequenceGroupOutputProcessor]
|
||||
instance
|
||||
seq_group: the output is associated with this
|
||||
[`SequenceGroup`][vllm.sequence.SequenceGroup]
|
||||
output: the [`SequenceGroupOutput`][vllm.sequence.SequenceGroupOutput]
|
||||
for a single scheduler step
|
||||
"""
|
||||
prompt_logprobs = output.prompt_logprobs
|
||||
|
||||
@@ -103,8 +107,11 @@ class SingleStepOutputProcessor(SequenceGroupOutputProcessor):
|
||||
scheduled computation.
|
||||
|
||||
Args:
|
||||
seq_group: the output is associated with this {class}`SequenceGroup`
|
||||
outputs: the {class}`SequenceGroupOutput` for a single scheduler step
|
||||
seq_group: the output is associated with this
|
||||
[`SequenceGroup`][vllm.sequence.SequenceGroup]
|
||||
outputs: the
|
||||
[`SequenceGroupOutput`][vllm.sequence.SequenceGroupOutput]
|
||||
for a single scheduler step
|
||||
"""
|
||||
assert len(outputs) == 1, "Single step should only have 1 output."
|
||||
output = outputs[0]
|
||||
|
||||
Reference in New Issue
Block a user