Add pydocstyle to the ruff rules (#52136)
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> Signed-off-by: Harry Mellor <hej.mellor@gmail.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
804e5377aa
commit
8c1557a79c
+23
-23
@@ -94,8 +94,7 @@ class AsyncLLM(EngineClient):
|
||||
client_index: int = 0,
|
||||
profiler: TorchProfilerWrapper | None = None,
|
||||
) -> None:
|
||||
"""
|
||||
Create an AsyncLLM.
|
||||
"""Create an AsyncLLM.
|
||||
|
||||
Args:
|
||||
vllm_config: global configuration.
|
||||
@@ -105,13 +104,21 @@ class AsyncLLM(EngineClient):
|
||||
mm_registry: Multi-modal registry.
|
||||
log_requests: Whether to log requests.
|
||||
start_engine_loop: Whether to start the engine loop.
|
||||
client_addresses: ZMQ addresses of an externally launched engine,
|
||||
when not launching one in-process.
|
||||
client_count: Number of API-server clients sharing the engine.
|
||||
client_index: Index of this client within ``client_count``.
|
||||
aggregate_engine_logging: Whether to aggregate per-engine logs
|
||||
into a single stat logger.
|
||||
stat_loggers: customized stat loggers for the engine.
|
||||
If not provided, default stat loggers will be used.
|
||||
PLEASE BE AWARE THAT STAT LOGGER IS NOT STABLE
|
||||
IN V1, AND ITS BASE CLASS INTERFACE MIGHT CHANGE.
|
||||
profiler: Torch profiler wrapper used to trace the frontend.
|
||||
|
||||
Returns:
|
||||
None
|
||||
|
||||
"""
|
||||
# Ensure we can serialize custom transformer configs
|
||||
maybe_register_config_serialize_by_value()
|
||||
@@ -255,7 +262,6 @@ class AsyncLLM(EngineClient):
|
||||
stat_loggers: list[StatLoggerFactory] | None = None,
|
||||
) -> "AsyncLLM":
|
||||
"""Create an AsyncLLM from the EngineArgs."""
|
||||
|
||||
# Create the engine configs.
|
||||
vllm_config = engine_args.create_engine_config(usage_context)
|
||||
executor_class = Executor.get_class(vllm_config)
|
||||
@@ -319,6 +325,7 @@ class AsyncLLM(EngineClient):
|
||||
Raises:
|
||||
QueueOverflowError: If ``max_num_queued_reqs`` would be exceeded.
|
||||
MaxQueuedTokensError: If ``max_num_queued_tokens`` would be exceeded.
|
||||
|
||||
"""
|
||||
max_num_reqs = self.scheduler_config.max_num_queued_reqs
|
||||
if max_num_reqs is not None:
|
||||
@@ -378,7 +385,6 @@ class AsyncLLM(EngineClient):
|
||||
reasoning_parser_kwargs: dict[str, Any] | None = None,
|
||||
) -> RequestOutputCollector:
|
||||
"""Add new request to the AsyncLLM."""
|
||||
|
||||
if self.errored:
|
||||
raise EngineDeadError()
|
||||
|
||||
@@ -654,8 +660,7 @@ class AsyncLLM(EngineClient):
|
||||
reasoning_ended: bool | None = None,
|
||||
reasoning_parser_kwargs: dict[str, Any] | None = None,
|
||||
) -> AsyncGenerator[RequestOutput, None]:
|
||||
"""
|
||||
Main function called by the API server to kick off a request
|
||||
"""Main function called by the API server to kick off a request
|
||||
* 1) Making an AsyncStream corresponding to the Request.
|
||||
* 2) Processing the Input.
|
||||
* 3) Adding the Request to the Detokenizer.
|
||||
@@ -678,8 +683,8 @@ class AsyncLLM(EngineClient):
|
||||
>>> params = self.renderer.default_cmpl_tok_params
|
||||
>>> (engine_input,) = self.renderer.render_cmpl([parsed], params)
|
||||
>>> gen = self.generate(engine_input, sampling_params, request_id)
|
||||
"""
|
||||
|
||||
"""
|
||||
q: RequestOutputCollector | None = None
|
||||
try:
|
||||
q = await self.add_request(
|
||||
@@ -763,7 +768,6 @@ class AsyncLLM(EngineClient):
|
||||
|
||||
def _run_output_handler(self):
|
||||
"""Background loop: pulls from EngineCore and pushes to AsyncStreams."""
|
||||
|
||||
if self.output_handler is not None:
|
||||
return
|
||||
|
||||
@@ -849,7 +853,6 @@ class AsyncLLM(EngineClient):
|
||||
self, request_id: str | Iterable[str], internal: bool = False
|
||||
) -> None:
|
||||
"""Abort RequestId in OutputProcessor and EngineCore."""
|
||||
|
||||
request_ids = (
|
||||
(request_id,) if isinstance(request_id, str) else as_list(request_id)
|
||||
)
|
||||
@@ -868,7 +871,8 @@ class AsyncLLM(EngineClient):
|
||||
) -> None:
|
||||
"""Submit a pre-aborted request so the connector's request_finished
|
||||
hook runs to free any pre-admission KV-transfer resources (e.g. NIXL
|
||||
prefill blocks pinned on the P node)."""
|
||||
prefill blocks pinned on the P node).
|
||||
"""
|
||||
request = EngineCoreRequest(
|
||||
request_id=request_id,
|
||||
prompt_token_ids=[0],
|
||||
@@ -893,8 +897,7 @@ class AsyncLLM(EngineClient):
|
||||
wait_for_inflight_requests: bool | None = None,
|
||||
clear_cache: bool = True,
|
||||
) -> None:
|
||||
"""
|
||||
Pause generation to allow model weight updates.
|
||||
"""Pause generation to allow model weight updates.
|
||||
|
||||
All mode handling (abort / wait / keep) and cache clearing is done
|
||||
in the engine. New generation/encoding requests will not be scheduled
|
||||
@@ -910,6 +913,7 @@ class AsyncLLM(EngineClient):
|
||||
wait_for_inflight_requests: DEPRECATED: use mode argument.
|
||||
clear_cache: Whether to clear KV cache and prefix cache after
|
||||
draining. Set to ``False`` to preserve cache for faster resume.
|
||||
|
||||
"""
|
||||
if wait_for_inflight_requests:
|
||||
warnings.warn(
|
||||
@@ -950,8 +954,7 @@ class AsyncLLM(EngineClient):
|
||||
tokenization_kwargs: dict[str, Any] | None = None,
|
||||
reasoning_ended: bool | None = None,
|
||||
) -> AsyncGenerator[PoolingRequestOutput, None]:
|
||||
"""
|
||||
Main function called by the API server to kick off a request
|
||||
"""Main function called by the API server to kick off a request
|
||||
* 1) Making an AsyncStream corresponding to the Request.
|
||||
* 2) Processing the Input.
|
||||
* 3) Adding the Request to the EngineCore (separate process).
|
||||
@@ -963,7 +966,6 @@ class AsyncLLM(EngineClient):
|
||||
The caller of generate() iterates the returned AsyncGenerator,
|
||||
returning the RequestOutput back to the caller.
|
||||
"""
|
||||
|
||||
q: RequestOutputCollector | None = None
|
||||
try:
|
||||
q = await self.add_request(
|
||||
@@ -1116,9 +1118,7 @@ class AsyncLLM(EngineClient):
|
||||
args: tuple = (),
|
||||
kwargs: dict | None = None,
|
||||
):
|
||||
"""
|
||||
Perform a collective RPC call to the given path.
|
||||
"""
|
||||
"""Perform a collective RPC call to the given path."""
|
||||
return await self.engine_core.collective_rpc_async(
|
||||
method, timeout, args, kwargs
|
||||
)
|
||||
@@ -1198,7 +1198,7 @@ class AsyncLLM(EngineClient):
|
||||
async def handle_fault(
|
||||
self, fault_tolerance_request: FaultToleranceRequest
|
||||
) -> FaultToleranceResult:
|
||||
"""send fault tolerance instruction to the engine"""
|
||||
"""Send fault tolerance instruction to the engine."""
|
||||
return await self.engine_core.handle_fault(fault_tolerance_request)
|
||||
|
||||
async def get_status(self):
|
||||
@@ -1224,11 +1224,11 @@ class AsyncLLM(EngineClient):
|
||||
async def init_weight_transfer_engine(
|
||||
self, request: WeightTransferInitRequest
|
||||
) -> None:
|
||||
"""
|
||||
Initialize weight transfer for RL training.
|
||||
"""Initialize weight transfer for RL training.
|
||||
|
||||
Args:
|
||||
request: Weight transfer initialization request with backend-specific info
|
||||
|
||||
"""
|
||||
await self.collective_rpc(
|
||||
"init_weight_transfer_engine", kwargs={"init_info": request.init_info}
|
||||
@@ -1243,11 +1243,11 @@ class AsyncLLM(EngineClient):
|
||||
await self.collective_rpc("start_draft_weight_update")
|
||||
|
||||
async def update_weights(self, request: WeightTransferUpdateRequest) -> None:
|
||||
"""
|
||||
Batched weight update for RL training.
|
||||
"""Batched weight update for RL training.
|
||||
|
||||
Args:
|
||||
request: Weight update request with backend-specific update info
|
||||
|
||||
"""
|
||||
await self.collective_rpc(
|
||||
"update_weights", kwargs={"update_info": request.update_info}
|
||||
|
||||
Reference in New Issue
Block a user