Unverified Commit 6c9fdbf7 authored by Harry Mellor's avatar Harry Mellor Committed by GitHub
Browse files

[Docs] Replace `rst` style double-backtick with `md` single-backtick (#27091)


Signed-off-by: default avatarHarry Mellor <19981378+hmellor@users.noreply.github.com>
parent 483ea646
...@@ -1251,7 +1251,7 @@ async def main() -> None: ...@@ -1251,7 +1251,7 @@ async def main() -> None:
default=None, default=None,
help="The model name used in the API. " help="The model name used in the API. "
"If not specified, the model name will be the " "If not specified, the model name will be the "
"same as the ``--model`` argument. ", "same as the `--model` argument. ",
) )
parser.add_argument( parser.add_argument(
......
...@@ -3,4 +3,4 @@ Loading Model weights with fastsafetensors ...@@ -3,4 +3,4 @@ Loading Model weights with fastsafetensors
Using fastsafetensors library enables loading model weights to GPU memory by leveraging GPU direct storage. See [their GitHub repository](https://github.com/foundation-model-stack/fastsafetensors) for more details. Using fastsafetensors library enables loading model weights to GPU memory by leveraging GPU direct storage. See [their GitHub repository](https://github.com/foundation-model-stack/fastsafetensors) for more details.
To enable this feature, use the ``--load-format fastsafetensors`` command-line argument To enable this feature, use the `--load-format fastsafetensors` command-line argument
...@@ -67,17 +67,17 @@ class _HfExamplesInfo: ...@@ -67,17 +67,17 @@ class _HfExamplesInfo:
is_available_online: bool = True is_available_online: bool = True
""" """
Set this to ``False`` if the name of this architecture no longer exists on Set this to `False` if the name of this architecture no longer exists on
the HF repo. To maintain backwards compatibility, we have not removed them the HF repo. To maintain backwards compatibility, we have not removed them
from the main model registry, so without this flag the registry tests will from the main model registry, so without this flag the registry tests will
fail. fail.
""" """
trust_remote_code: bool = False trust_remote_code: bool = False
"""The ``trust_remote_code`` level required to load the model.""" """The `trust_remote_code` level required to load the model."""
hf_overrides: dict[str, Any] = field(default_factory=dict) hf_overrides: dict[str, Any] = field(default_factory=dict)
"""The ``hf_overrides`` required to load the model.""" """The `hf_overrides` required to load the model."""
max_model_len: int | None = None max_model_len: int | None = None
""" """
......
...@@ -162,7 +162,7 @@ def check_logprobs_close( ...@@ -162,7 +162,7 @@ def check_logprobs_close(
# Test prompt logprobs closeness # Test prompt logprobs closeness
if prompt_logprobs_0 is not None and prompt_logprobs_1 is not None: if prompt_logprobs_0 is not None and prompt_logprobs_1 is not None:
# Both sequences' prompt logprobs lists are not `None`` # Both sequences' prompt logprobs lists are not `None`
# (although individual list elements may be `None`); # (although individual list elements may be `None`);
# for each token's logprobs: # for each token's logprobs:
for idx, (logprobs_elem_0, logprobs_elem_1) in enumerate( for idx, (logprobs_elem_0, logprobs_elem_1) in enumerate(
......
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project # SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""Ensure we perform lazy loading in vllm/__init__.py. """Ensure we perform lazy loading in vllm/__init__.py.
i.e: appears only within the ``if typing.TYPE_CHECKING:`` guard, i.e: appears only within the `if typing.TYPE_CHECKING:` guard,
**except** for a short whitelist. **except** for a short whitelist.
""" """
......
...@@ -21,7 +21,7 @@ def get_cache_dir() -> Path: ...@@ -21,7 +21,7 @@ def get_cache_dir() -> Path:
@lru_cache @lru_cache
def get_vllm_public_assets(filename: str, s3_prefix: str | None = None) -> Path: def get_vllm_public_assets(filename: str, s3_prefix: str | None = None) -> Path:
""" """
Download an asset file from ``s3://vllm-public-assets`` Download an asset file from `s3://vllm-public-assets`
and return the path to the downloaded file. and return the path to the downloaded file.
""" """
asset_directory = get_cache_dir() / "vllm_public_assets" asset_directory = get_cache_dir() / "vllm_public_assets"
......
...@@ -1231,7 +1231,7 @@ def add_cli_args(parser: argparse.ArgumentParser): ...@@ -1231,7 +1231,7 @@ def add_cli_args(parser: argparse.ArgumentParser):
default=None, default=None,
help="The model name used in the API. " help="The model name used in the API. "
"If not specified, the model name will be the " "If not specified, the model name will be the "
"same as the ``--model`` argument. ", "same as the `--model` argument. ",
) )
parser.add_argument( parser.add_argument(
......
...@@ -138,8 +138,8 @@ def support_torch_compile( ...@@ -138,8 +138,8 @@ def support_torch_compile(
""" """
def cls_decorator_helper(cls: _T) -> _T: def cls_decorator_helper(cls: _T) -> _T:
# helper to pass `dynamic_arg_dims`` to `_support_torch_compile`` # helper to pass `dynamic_arg_dims` to `_support_torch_compile`
# to avoid too much indentation for `_support_torch_compile`` # to avoid too much indentation for `_support_torch_compile`
if not hasattr(cls, "forward"): if not hasattr(cls, "forward"):
raise TypeError("decorated class should have a forward method.") raise TypeError("decorated class should have a forward method.")
sig = inspect.signature(cls.forward) sig = inspect.signature(cls.forward)
......
...@@ -66,15 +66,15 @@ class PoolerConfig: ...@@ -66,15 +66,15 @@ class PoolerConfig:
""" """
step_tag_id: int | None = None step_tag_id: int | None = None
""" """
If set, only the score corresponding to the ``step_tag_id`` in the If set, only the score corresponding to the `step_tag_id` in the
generated sentence should be returned. Otherwise, the scores for all tokens generated sentence should be returned. Otherwise, the scores for all tokens
are returned. are returned.
""" """
returned_token_ids: list[int] | None = None returned_token_ids: list[int] | None = None
""" """
A list of indices for the vocabulary dimensions to be extracted, A list of indices for the vocabulary dimensions to be extracted,
such as the token IDs of ``good_token`` and ``bad_token`` in the such as the token IDs of `good_token` and `bad_token` in the
``math-shepherd-mistral-7b-prm`` model. `math-shepherd-mistral-7b-prm` model.
""" """
def compute_hash(self) -> str: def compute_hash(self) -> str:
......
...@@ -117,7 +117,7 @@ class ZmqEventPublisher(EventPublisher): ...@@ -117,7 +117,7 @@ class ZmqEventPublisher(EventPublisher):
Parameters Parameters
---------- ----------
endpoint: endpoint:
PUB address. Use ``tcp://*:5557`` to bind or ``tcp://host:5557`` to PUB address. Use `tcp://*:5557` to bind or `tcp://host:5557` to
connect. connect.
replay_endpoint: replay_endpoint:
Optional ROUTER address for replay requests. When given, subscribers can Optional ROUTER address for replay requests. When given, subscribers can
......
...@@ -515,7 +515,7 @@ class StreamingHarmonyContext(HarmonyContext): ...@@ -515,7 +515,7 @@ class StreamingHarmonyContext(HarmonyContext):
def render_for_completion(self) -> list[int]: def render_for_completion(self) -> list[int]:
# now this list of tokens as next turn's starting tokens # now this list of tokens as next turn's starting tokens
# `<|start|>assistant``, # `<|start|>assistant`,
# we need to process them in parser. # we need to process them in parser.
rendered_tokens = super().render_for_completion() rendered_tokens = super().render_for_completion()
......
...@@ -1504,7 +1504,7 @@ class LLM: ...@@ -1504,7 +1504,7 @@ class LLM:
"""Return a snapshot of aggregated metrics from Prometheus. """Return a snapshot of aggregated metrics from Prometheus.
Returns: Returns:
A ``MetricSnapshot`` instance capturing the current state A `MetricSnapshot` instance capturing the current state
of all aggregated metrics from Prometheus. of all aggregated metrics from Prometheus.
Note: Note:
......
...@@ -26,12 +26,12 @@ class RenderConfig: ...@@ -26,12 +26,12 @@ class RenderConfig:
max_length: int | None = None max_length: int | None = None
"""Maximum allowable total input token length. If provided, """Maximum allowable total input token length. If provided,
token inputs longer than this raise ``ValueError``.""" token inputs longer than this raise `ValueError`."""
truncate_prompt_tokens: int | None = None truncate_prompt_tokens: int | None = None
"""Number of tokens to keep. ``None`` means no truncation. """Number of tokens to keep. `None` means no truncation.
``0`` yields an empty list (and skips embeds). `0` yields an empty list (and skips embeds).
``-1`` maps to ``model_config.max_model_len``.""" `-1` maps to `model_config.max_model_len`."""
add_special_tokens: bool | None = True add_special_tokens: bool | None = True
"""Whether to add model-specific special tokens during tokenization.""" """Whether to add model-specific special tokens during tokenization."""
...@@ -107,10 +107,10 @@ class BaseRenderer(ABC): ...@@ -107,10 +107,10 @@ class BaseRenderer(ABC):
Args: Args:
prompt_or_prompts: One of: prompt_or_prompts: One of:
- ``str``: Single text prompt. - `str`: Single text prompt.
- ``list[str]``: Batch of text prompts. - `list[str]`: Batch of text prompts.
- ``list[int]``: Single pre-tokenized sequence. - `list[int]`: Single pre-tokenized sequence.
- ``list[list[int]]``: Batch of pre-tokenized sequences. - `list[list[int]]`: Batch of pre-tokenized sequences.
config: Render configuration controlling how prompts are prepared config: Render configuration controlling how prompts are prepared
(e.g., tokenization and length handling). (e.g., tokenization and length handling).
...@@ -134,9 +134,9 @@ class BaseRenderer(ABC): ...@@ -134,9 +134,9 @@ class BaseRenderer(ABC):
Convert text/token and/or base64-encoded embeddings inputs into Convert text/token and/or base64-encoded embeddings inputs into
engine-ready prompt objects using a unified RenderConfig. engine-ready prompt objects using a unified RenderConfig.
At least one of ``prompt_or_prompts`` or ``prompt_embeds`` must be At least one of `prompt_or_prompts` or `prompt_embeds` must be
provided and non-empty. If both are omitted or empty (e.g., empty provided and non-empty. If both are omitted or empty (e.g., empty
string and empty list), a ``ValueError`` is raised. string and empty list), a `ValueError` is raised.
Args: Args:
prompt_or_prompts: Text or token inputs to include. prompt_or_prompts: Text or token inputs to include.
...@@ -150,7 +150,7 @@ class BaseRenderer(ABC): ...@@ -150,7 +150,7 @@ class BaseRenderer(ABC):
Engine-ready prompt objects. Engine-ready prompt objects.
Raises: Raises:
ValueError: If both ``prompt_or_prompts`` and ``prompt_embeds`` ValueError: If both `prompt_or_prompts` and `prompt_embeds`
are omitted or empty (decoder prompt cannot be empty), or if are omitted or empty (decoder prompt cannot be empty), or if
length limits are exceeded. length limits are exceeded.
""" """
......
...@@ -327,7 +327,7 @@ def zip_enc_dec_prompts( ...@@ -327,7 +327,7 @@ def zip_enc_dec_prompts(
[`ExplicitEncoderDecoderPrompt`][vllm.inputs.data.ExplicitEncoderDecoderPrompt] [`ExplicitEncoderDecoderPrompt`][vllm.inputs.data.ExplicitEncoderDecoderPrompt]
instances. instances.
``mm_processor_kwargs`` may also be provided; if a dict is passed, the same `mm_processor_kwargs` may also be provided; if a dict is passed, the same
dictionary will be used for every encoder/decoder prompt. If an iterable is dictionary will be used for every encoder/decoder prompt. If an iterable is
provided, it will be zipped with the encoder/decoder prompts. provided, it will be zipped with the encoder/decoder prompts.
""" """
......
...@@ -27,7 +27,7 @@ __all__ = [ ...@@ -27,7 +27,7 @@ __all__ = [
def is_flashinfer_fp4_cutlass_moe_available() -> bool: def is_flashinfer_fp4_cutlass_moe_available() -> bool:
"""Return ``True`` when FlashInfer CUTLASS NV-FP4 kernels can be used.""" """Return `True` when FlashInfer CUTLASS NV-FP4 kernels can be used."""
return ( return (
envs.VLLM_USE_FLASHINFER_MOE_FP4 envs.VLLM_USE_FLASHINFER_MOE_FP4
and has_flashinfer_cutlass_fused_moe() and has_flashinfer_cutlass_fused_moe()
......
...@@ -887,11 +887,11 @@ def requant_weight_ue8m0_inplace( ...@@ -887,11 +887,11 @@ def requant_weight_ue8m0_inplace(
UE8M0 (power-of-two) format expected by the new DeepGEMM kernels inplace. UE8M0 (power-of-two) format expected by the new DeepGEMM kernels inplace.
Args: Args:
weight: Block-quantised weight tensor stored in ``torch.float8_e4m3fn``. weight: Block-quantised weight tensor stored in `torch.float8_e4m3fn`.
Expected shape ``(..., M, K)``. Expected shape `(..., M, K)`.
weight_scale: Corresponding per-block scale tensor (``torch.float32``) weight_scale: Corresponding per-block scale tensor (`torch.float32`)
with shape ``(..., M // block_size[0], K // block_size[1])``. with shape `(..., M // block_size[0], K // block_size[1])`.
block_size: 2-element iterable ``[block_m, block_k]`` describing the block_size: 2-element iterable `[block_m, block_k]` describing the
block quantisation granularity. block quantisation granularity.
""" """
if weight.numel() == 0: if weight.numel() == 0:
......
...@@ -64,7 +64,7 @@ from .utils import ( ...@@ -64,7 +64,7 @@ from .utils import (
class OlmoAttention(nn.Module): class OlmoAttention(nn.Module):
""" """
This is the attention block where the output is computed as This is the attention block where the output is computed as
``Attention(LN(x))`` in ``MLP(LN(x + Attention(LN(x))))`` `Attention(LN(x))` in `MLP(LN(x + Attention(LN(x))))`
(plus another skip connection). (plus another skip connection).
""" """
...@@ -144,7 +144,7 @@ class OlmoAttention(nn.Module): ...@@ -144,7 +144,7 @@ class OlmoAttention(nn.Module):
class OlmoMLP(nn.Module): class OlmoMLP(nn.Module):
""" """
This is the MLP block where the output is computed as This is the MLP block where the output is computed as
``MLP(LN(x))`` in ``MLP(LN(x + Attention(LN(x))))`` `MLP(LN(x))` in `MLP(LN(x + Attention(LN(x))))`
(plus another skip connection). (plus another skip connection).
""" """
...@@ -193,7 +193,7 @@ class OlmoMLP(nn.Module): ...@@ -193,7 +193,7 @@ class OlmoMLP(nn.Module):
class OlmoDecoderLayer(nn.Module): class OlmoDecoderLayer(nn.Module):
""" """
This is a typical transformer block where the output is This is a typical transformer block where the output is
computed as ``MLP(LN(x + Attention(LN(x))))`` computed as `MLP(LN(x + Attention(LN(x))))`
(plus another skip connection). (plus another skip connection).
""" """
......
...@@ -69,7 +69,7 @@ from vllm.transformers_utils.configs import Olmo3Config ...@@ -69,7 +69,7 @@ from vllm.transformers_utils.configs import Olmo3Config
class Olmo2Attention(nn.Module): class Olmo2Attention(nn.Module):
""" """
This is the attention block where the output is computed as This is the attention block where the output is computed as
``Attention(LN(x))`` in ``MLP(LN(x + Attention(LN(x))))`` `Attention(LN(x))` in `MLP(LN(x + Attention(LN(x))))`
(plus another skip connection). (plus another skip connection).
""" """
...@@ -190,7 +190,7 @@ class Olmo2Attention(nn.Module): ...@@ -190,7 +190,7 @@ class Olmo2Attention(nn.Module):
class Olmo2MLP(nn.Module): class Olmo2MLP(nn.Module):
""" """
This is the MLP block where the output is computed as This is the MLP block where the output is computed as
``MLP(x)`` in ``LN(MLP(x + LN(Attention(x))))`` `MLP(x)` in `LN(MLP(x + LN(Attention(x))))`
(plus another skip connection). (plus another skip connection).
""" """
...@@ -235,7 +235,7 @@ class Olmo2MLP(nn.Module): ...@@ -235,7 +235,7 @@ class Olmo2MLP(nn.Module):
class Olmo2DecoderLayer(nn.Module): class Olmo2DecoderLayer(nn.Module):
""" """
This is a typical transformer block where the output is This is a typical transformer block where the output is
computed as ``MLP(LN(x + Attention(LN(x))))`` computed as `MLP(LN(x + Attention(LN(x))))`
(plus another skip connection). (plus another skip connection).
""" """
......
...@@ -166,7 +166,7 @@ class VisualTokenizer(torch.nn.Module): ...@@ -166,7 +166,7 @@ class VisualTokenizer(torch.nn.Module):
# e.g., for hidden_stride=2, this leads to a token length reduction: # e.g., for hidden_stride=2, this leads to a token length reduction:
# 1024 -> 256 for aimv2 # 1024 -> 256 for aimv2
if self.config.hidden_stride > 1: if self.config.hidden_stride > 1:
# this `d` maybe different from the above `d`` # this `d` maybe different from the above `d`
n, L, d = features.shape n, L, d = features.shape
sqrt_l = int(L**0.5) sqrt_l = int(L**0.5)
assert sqrt_l**2 == L, ( assert sqrt_l**2 == L, (
......
...@@ -99,13 +99,13 @@ class AutoWeightsLoader: ...@@ -99,13 +99,13 @@ class AutoWeightsLoader:
the weights only once. the weights only once.
The weight loading logic for individual modules can be overridden The weight loading logic for individual modules can be overridden
by defining a ``load_weights`` method. by defining a `load_weights` method.
Similarly, the weight loading logic for individual parameters can be Similarly, the weight loading logic for individual parameters can be
overridden by defining a ``weight_loader`` method. overridden by defining a `weight_loader` method.
Detailed weight loading information can be viewed by setting the Detailed weight loading information can be viewed by setting the
environment variable ``VLLM_LOGGING_LEVEL=DEBUG``. environment variable `VLLM_LOGGING_LEVEL=DEBUG`.
""" """
# Models trained using early version ColossalAI # Models trained using early version ColossalAI
...@@ -372,9 +372,9 @@ def flatten_bn( ...@@ -372,9 +372,9 @@ def flatten_bn(
concat: bool = False, concat: bool = False,
) -> list[torch.Tensor] | torch.Tensor: ) -> list[torch.Tensor] | torch.Tensor:
""" """
Flatten the ``B`` and ``N`` dimensions of batched multimodal inputs. Flatten the `B` and `N` dimensions of batched multimodal inputs.
The input tensor should have shape ``(B, N, ...)```. The input tensor should have shape `(B, N, ...)`.
""" """
if isinstance(x, torch.Tensor): if isinstance(x, torch.Tensor):
return x.flatten(0, 1) return x.flatten(0, 1)
...@@ -424,12 +424,12 @@ def _merge_multimodal_embeddings( ...@@ -424,12 +424,12 @@ def _merge_multimodal_embeddings(
is_multimodal: torch.Tensor, is_multimodal: torch.Tensor,
) -> torch.Tensor: ) -> torch.Tensor:
""" """
Merge ``multimodal_embeddings`` into ``inputs_embeds`` by overwriting the Merge `multimodal_embeddings` into `inputs_embeds` by overwriting the
positions in ``inputs_embeds`` corresponding to placeholder tokens in positions in `inputs_embeds` corresponding to placeholder tokens in
``input_ids``. `input_ids`.
Note: Note:
This updates ``inputs_embeds`` in place. This updates `inputs_embeds` in place.
""" """
if len(multimodal_embeddings) == 0: if len(multimodal_embeddings) == 0:
return inputs_embeds return inputs_embeds
...@@ -475,14 +475,14 @@ def merge_multimodal_embeddings( ...@@ -475,14 +475,14 @@ def merge_multimodal_embeddings(
placeholder_token_id: int | list[int], placeholder_token_id: int | list[int],
) -> torch.Tensor: ) -> torch.Tensor:
""" """
Merge ``multimodal_embeddings`` into ``inputs_embeds`` by overwriting the Merge `multimodal_embeddings` into `inputs_embeds` by overwriting the
positions in ``inputs_embeds`` corresponding to placeholder tokens in positions in `inputs_embeds` corresponding to placeholder tokens in
``input_ids``. `input_ids`.
``placeholder_token_id`` can be a list of token ids (e.g, token ids `placeholder_token_id` can be a list of token ids (e.g, token ids
of img_start, img_break, and img_end tokens) when needed: This means of img_start, img_break, and img_end tokens) when needed: This means
the order of these tokens in the ``input_ids`` MUST MATCH the order of the order of these tokens in the `input_ids` MUST MATCH the order of
their embeddings in ``multimodal_embeddings`` since we need to their embeddings in `multimodal_embeddings` since we need to
slice-merge instead of individually scattering. slice-merge instead of individually scattering.
For example, if input_ids is "TTTTTSIIIBIIIBIIIETTT", where For example, if input_ids is "TTTTTSIIIBIIIBIIIETTT", where
...@@ -497,7 +497,7 @@ def merge_multimodal_embeddings( ...@@ -497,7 +497,7 @@ def merge_multimodal_embeddings(
input_ids for a correct embedding merge. input_ids for a correct embedding merge.
Note: Note:
This updates ``inputs_embeds`` in place. This updates `inputs_embeds` in place.
""" """
if isinstance(placeholder_token_id, list): if isinstance(placeholder_token_id, list):
is_multimodal = isin_list(input_ids, placeholder_token_id) is_multimodal = isin_list(input_ids, placeholder_token_id)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment