text
stringlengths
14
100k
source
stringclasses
1 value
repo
stringclasses
810 values
language
stringclasses
13 values
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project # Copyright 2025 The Seed team. # Copyright 2023 The vLLM team. # Copyright 2022 EleutherAI and the HuggingFace Inc. team. All rights reserved. # # This code is based on EleutherAI's GPT-NeoX librar...
fim
vllm-project/vllm
python
<|fim_suffix|>dden_states, return_all_hidden_states=select_layers is not None, ) # In the case that we have multiple feature layers, # we stack and concatenate them into a tensor. # NOTE: post layer norm and the attention pooling head # are handled by last_hs_proc, w...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Implementation of SiglipVisionModel intended to be only used within a vision language model.""" from collections.abc import Iterable import torch from torch import nn from torch.nn import functi...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project # adapted from https://huggingface.co/Skywork/Skywork-R1V-38B/blob/main/modeling_skywork_chat.py # -------------------------------------------------------- # SkyworkR1V # Copyright (c) 2025 Skywork # Licensed und...
fim
vllm-project/vllm
python
<|fim_suffix|>init__(self, *, vllm_config: VllmConfig, prefix: str = ""): super().__init__( vllm_config=vllm_config, prefix=prefix, ) <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from transformers impor...
fim
vllm-project/vllm
python
<|fim_suffix|>_states, residual, ) if not get_pp_group().is_last_rank: return IntermediateTensors( {"hidden_states": hidden_states, "residual": residual} ) hidden_states, _ = self.norm(hidden_states, residual) return hidden_st...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project # Copyright 2023 Stability AI, EleutherAI, and The HuggingFace Inc. team. # All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file excep...
fim
vllm-project/vllm
python
<|fim_suffix|>self.use_bias, quant_config=quant_config, prefix=f"{prefix}.qkv_proj", ) self.o_proj = RowParallelLinear( self.total_num_heads * self.head_dim, self.hidden_size, bias=self.use_bias, quant_config=quant_config, ...
fim
vllm-project/vllm
python
<|fim_suffix|>t] self.make_empty_intermediate_tensors = ( self.model.make_empty_intermediate_tensors ) def embed_input_ids(self, input_ids: torch.Tensor) -> torch.Tensor: return self.model.embed_input_ids(input_ids) def forward( self, input_ids: torch.LongT...
fim
vllm-project/vllm
python
<|fim_suffix|> continue name = name.replace(weight_name, param_name) # Skip layers on other devices. if is_pp_missing_parameter(name, self): continue # Skip loading extra bias for GPTQ models. ...
fim
vllm-project/vllm
python
<|fim_suffix|>nfig, prefix=f"{prefix}.self_attn", ) self.layer_norm1 = nn.LayerNorm(self.embed_dim, eps=config.layer_norm_eps) self.mlp = Step3VisionMLP( config, quant_config, prefix=f"{prefix}.mlp", ) self.layer_norm2 = nn.LayerNor...
fim
vllm-project/vllm
python
<|fim_suffix|> f"the number of experts {config.moe_num_experts}." ) self.gate = FP32ReplicatedLinear( config.hidden_size, config.moe_num_experts, bias=False, quant_config=None, params_dtype=torch.float32, # Use FP32 for hig...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from collections.abc import Iterable import torch import torch.nn as nn from transformers import PretrainedConfig from vllm.config import VllmConfig from vllm.logger import init_logger from vllm.mo...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Inference-only Jurassic model.""" import torch from vllm.config import VllmConfig from vllm.logger import init_logger from vllm.model_executor.layers.activation import get_act_fn from vllm.model...
fim
vllm-project/vllm
python
<|fim_suffix|>ead.": "language_model.lm_head.", }, orig_to_new_substr={ ".attn.in_proj_weight": ".attn.qkv_proj.weight", ".attn.in_proj_bias": ".attn.qkv_proj.bias", ".mlp.c_fc": ".mlp.fc1", ".mlp.c_proj": ".mlp.fc2", }, ) def __init__(sel...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import math from collections.abc import Iterable, Mapping, Sequence from typing import Annotated, Final, Literal, Protocol, TypeAlias, TypeVar import torch import torch.nn as nn from transformers import ( Ba...
fim
vllm-project/vllm
python
<|fim_suffix|>oaded_weight) loaded_params.add(name) return loaded_params class TeleChat2ForCausalLM(LlamaForCausalLM): hf_to_vllm_mapper = WeightsMapper( orig_to_new_prefix={ "transformer.": "model.", }, orig_to_new_substr={ ".h.": ".layers.", ...
fim
vllm-project/vllm
python
<|fim_suffix|>License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BA...
fim
vllm-project/vllm
python
<|fim_suffix|>d_data, hf_processor_mm_kwargs, is_shared=False, ), ) with timing_ctx.record("get_mm_hashes"): mm_hashes = inputs.get_mm_hashes(self.info.model_id) mm_placeholders = {"image": [PlaceholderRange(offset=0, length=0)]} ...
fim
vllm-project/vllm
python
<|fim_suffix|>ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Wrapper around `transformers` models""" from vllm.model_executor.models.transformers.base import Base from vllm.model_executor.models.transformers.causal import C...
fim
vllm-project/vllm
python
<|fim_suffix|>asattr(self.config, "layer_types") and self.config.layer_types[i] == "sliding_attention" ): per_layer_sliding_window = self.config.sliding_window attn_cls = ( EncoderOnlyAttention if attn_type == AttentionType.ENCODER...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project # Copyright 2024 The v<|fim_suffix|>icense"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICE...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project # Copyright 2024 The vLLM team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # #...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project # Copyright 2024 The vLLM team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the ...
fim
vllm-project/vllm
python
<|fim_suffix|>r().forward( input_ids, positions, intermediate_tensors, inputs_embeds ) return model_output def get_language_model(self) -> torch.nn.Module: """Transformers modeling backend multimodal classes do not contain a separate vLLM language model class. Therefore,...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project # Copyright 2024 The vLLM team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the ...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project # Copyright 2024 The vLLM team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # #...
fim
vllm-project/vllm
python
<|fim_suffix|>t_idx: torch.Tensor = torch.cumsum( num_chunks, dim=0, dtype=torch.int32 ) chunks_start_idx = torch.cat( [torch.tensor([0], dtype=torch.int32), chunks_start_idx] ) def get_replacement_ultravox(item_idx: int): start = chunks_start_idx[ite...
fim
vllm-project/vllm
python
<|fim_suffix|>ensor] | torch.Tensor, *, concat: Literal[True], ) -> torch.Tensor: ... @overload def flatten_bn( x: list[torch.Tensor] | torch.Tensor, *, concat: bool = False, ) -> list[torch.Tensor] | torch.Tensor: ... def flatten_bn( x: list[torch.Tensor] | torch.Tensor, *, concat: ...
fim
vllm-project/vllm
python
<|fim_suffix|> dimensions for each image rope_type: Type of rope used in the vision model. Different rope types have different dimension to do ViT. "rope_3d" for 3D rope (e.g., Qwen2.5-VL) "rope_2d" for 2D rope (e.g., Kimi-VL) Returns: torch.T...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import math from collections.abc import Iterable, Mapping, Sequence from functools import partial from typing import cast import numpy as np import regex as re import torch import torch.nn as nn fr...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import asyncio import math from collections.abc import AsyncGenerator, Iterable, Iterator, Mapping import numpy as np import torch from mistral_common.audio import Audio from mistral_common.protoco...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from __future__ import annotations from collections.abc import Iterable import torch import torch.nn as nn from vllm.config import VllmConfig from vllm.model_executor.models.qwen3 import Qwen3Model from vllm.mo...
fim
vllm-project/vllm
python
<|fim_suffix|>o_input = self._parse_and_validate_audio_input(**kwargs) # Split concatenated encoder outputs into one tensor per audio input enc_output = self.model.get_encoder_outputs(audio_input["input_features"]) # The assumption is we can only process whole mm items (audios) return en...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import copy import functools import logging import math from dataclasses import replace from functools import partial import torch import torch.nn.functional as F from torch import nn from vllm.con...
fim
vllm-project/vllm
python
<|fim_suffix|>n", "az": "Azerbaijani", "be": "Belarusian", "bs": "Bosnian", "bg": "Bulgarian", "ca": "Catalan", "zh": "Chinese", "hr": "Croatian", "cs": "Czech", "da": "Danish", "nl": "Dutch", "en": "English", "et": "Estonian", "fi": "Finnish", "fr": "French", ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """PyTorch Zamba2 model implementation for vLLM. This module implements the Zamba2 architecture from https://arxiv.org/abs/2411.15242, which combines Mamba and Transformer architectures in a hybrid ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyri<|fim_suffix|>ht contributors to the vLLM project """Model parameter offloading infrastructure.""" from vllm.model_executor.offloader.base import ( BaseOffloader, NoopOffloader, create_offloader, get_offloader, set_...
fim
vllm-project/vllm
python
<|fim_suffix|>erride in subclasses.""" pass class NoopOffloader(BaseOffloader): """No-op offloader that returns modules as-is without any offloading.""" def wrap_modules( self, modules_generator: Generator[nn.Module, None, None], ) -> list[nn.Module]: """Return modules unc...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project # Adapted from # https://github.com/sgl-project/sglang/blob/main/python/sglang/srt/utils/offloader.py """Prefetch-based CPU offloading with async prefetching. Uses static buffers and event-based str...
fim
vllm-project/vllm
python
<|fim_suffix|>_prefetch_offloader_ops() -> None: """Register custom ops for prefetch offloader. Must be called before the ops are used. This is typically done at module import time. """ direct_register_custom_op( op_name="wait_prefetch", op_func=_wait_prefetch_impl, mutates_...
fim
vllm-project/vllm
python
<|fim_suffix|>load_to_cpu(module) for module in modules_generator] if self.cpu_offload_bytes > 0: logger.info( "Total CPU offloaded parameters: %s", format_gib(self.cpu_offload_bytes), ) return modules def _maybe_offload_to_cpu(self, module: n...
fim
vllm-project/vllm
python
<|fim_suffix|>partition_id = self._shard_id_as_int(kwargs.pop("shard_id")) partition = self.partitions[partition_id] input_dim = self.kwargs.get("input_dim") shard_size = partition.data.size(input_dim) // self.tp_size shard_offset = self.tp_rank * shard_size shard_id = "q" # fa...
fim
vllm-project/vllm
python
<|fim_suffix|> conflicts from {type(child).__name__}." ) else: parent_map.update(child_map) return parent_map def get_moe_expert_mapping( model: torch.nn.Module, ) -> list[tuple[str, str, int, str]]: if parent_map := getattr(model, "get_expert_mapping", None): retur...
fim
vllm-project/vllm
python
<|fim_suffix|>mm(m)] for dgm in dg_modules: w, ws, _ = _extract_data_from_linear_base_module(dgm) _deepgemm_fp8_gemm_nt_warmup(w=w, ws=ws, max_tokens=max_tokens, pbar=pbar) def deepgemm_grouped_fp8_gemm_nt_contiguous_warmup( model: torch.nn.Module, max_tokens: int, pbar: tqdm | None = None ):...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ Warmup kernels used during model execution. This is useful specifically for JIT'ed kernels as we don't want JIT'ing to happen during model execution. """ import hashlib from pathlib import Path ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Model inspection utilities for vLLM.""" import torch.nn as nn def _get_module_info(module: nn.Module) -> str: """Get info string for a module.""" class_name = type(module).__name__ ...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project <|endoftext|>
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """DeepSeek V4 model — hardware-isolated entry point. The actual implementation lives under ``nvidia/`` and ``amd/``; this module picks the right one for the current platform and re-exports the public classes use...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-Lic<|fim_suffix|>Copyright contributors to the vLLM project <|fim_middle|>ense-Identifier: Apache-2.0 # SPDX-FileCopyrightText: <|endoftext|>
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import typing from collections.abc import Callable, Iterable from itertools import islice import regex as re import torch import torch.nn as nn from vllm.config import VllmConfig from vllm.distribu...
fim
vllm-project/vllm
python
<|fim_suffix|>have " f"been quantized without including the MTP layers. " f"Use a checkpoint that includes MTP layer weights, " f"or disable speculative decoding." ) logger.info_once("MTP draft model loaded: %d params", len(loaded_param...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from dataclasses import dataclass from typing import cast import torch from vllm.forward_context import get_forward_context from vllm.models.deepseek_v4.attention import DeepseekV4Attention from v...
fim
vllm-project/vllm
python
<|fim_suffix|>.Tensor | None = None, ) -> torch.Tensor: # Pre-allocate attention output with FlashMLA-padded head count. # The op writes into `o_padded`; we slice to n_local_heads after. num_tokens = hidden_states.shape[0] o_padded = torch.empty( (num_tokens, self.padded_...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-I<|fim_suffix|>0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project <|fim_middle|>dentifier: Apache-2.<|endoftext|>
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from .cache_utils import ( build_flashinfer_mixed_sparse_indices, combine_topk_swa_indices, compute_global_topk_indices_and_lens, dequantize_and_gather_k_cache, quantize_and_inse...
fim
vllm-project/vllm
python
<|fim_suffix|>t, compress_ratio: int, topk: int, decode_compressed_indices_are_local: bool = False, decode_is_valid_token: torch.Tensor | None = None, ) -> tuple[torch.Tensor, torch.Tensor]: """Build the FlashInfer DSV4 sparse-index matrix for decode-first batches. Produces ``sparse_indices`` o...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ Fused compressor + FP8/MXFP4 UE8M0 quantization + KV cache insert kernels. Three specialized kernels: - _fused_kv_compress_norm_rope_insert_sparse_attn: head=512, nope=448 FP8 + rope=6...
fim
vllm-project/vllm
python
<|fim_suffix|>ads, num_scale_blocks), dtype=torch.uint8, device=index_q.device, ) if has_cutedsl(): # lazily import, otherwise some tests fail due to CUDA driver init failure. from vllm.models.deepseek_v4.nvidia.ops.fused_indexer_q_cutedsl import ( ...
fim
vllm-project/vllm
python
<|fim_suffix|>zation. Args: o: Attention output [num_tokens, num_heads, head_dim] bf16. positions: Token positions [num_tokens] int64. cos_sin_cache: Precomputed [max_pos, rope_dim] with cos||sin. n_groups: Number of output groups. heads_per_group: Heads per group. n...
fim
vllm-project/vllm
python
<|fim_suffix|>eps, HIDDEN=hidden, HC_MULT=hc_mult, BLOCK_SIZE=block_size, ) return enorm_out, hnorm_out <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Fused MTP-input RMSNorm: enorm (with mask-zero at position 0...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import torch from vllm.triton_utils import tl, triton @triton.jit def _fused_q_kv_rmsnorm_kernel( q_ptr, q_out_ptr, q_weight_ptr, q_in_stride, q_out_stride, kv_ptr, kv_out_ptr, k...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import torch from vllm.triton_utils import tl, triton def save_partial_states( kv: torch.Tensor, score: torch.Tensor, ape: torch.Tensor, positions: torch.Tensor, state_cache: ...
fim
vllm-project/vllm
python
<|fim_suffix|>arameters rope_parameters["rope_theta"] = ( config.compress_rope_theta if compress_ratio > 1 else config.rope_theta ) if rope_parameters["rope_type"] != "default": rope_parameters["rope_type"] = ( "deepseek_yarn" if rope_parameters.get("apply_yarn_scalin...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from dataclasses import dataclass from typing import Any, ClassVar, cast import torch from torch import nn from vllm.config import VllmConfig, get_current_vllm_config from vllm.forward_context imp...
fim
vllm-project/vllm
python
<|fim_suffix|>s to the vLLM project <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyri<|fim_middle|>ghtText: Copyright contributor<|endoftext|>
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """DeepSeek V4 FlashInfer TRTLLM-gen sparse MLA backend. Uses FlashInfer's public ``trtllm_batch_decode_sparse_mla_dsv4`` launcher with a plain bf16 / per-tensor FP8 KV row (vs FlashMLA's packed ``f...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from typing import TYPE_CHECKING, cast import torch from vllm.forward_context import get_forward_context from vllm.models.deepseek_v4.attention import DeepseekV4Attention from vllm.models.deepseek_v4.common.ops...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import typing from collections.abc import Callable, Iterable, MutableSequence, Sequence from itertools import islice import regex as re import torch import torch.nn as nn from vllm.config import VllmConfig from ...
fim
vllm-project/vllm
python
<|fim_suffix|>.copy_(narrow_weight) loaded_params.add(name) continue else: if ".shared_experts.w2" in name: name = name.replace( ".shared_experts.w2", ".shared_experts.down_proj" ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """NVIDIA-only (cutedsl/cutlass) kernels for DeepSeek V4. These modules import ``cutlass``/``cutedsl`` at module top level, so they must not be imported on non-CUDA platforms. Callers should gate on...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from functools import cache import cutlass import cutlass.cute as cute import torch from cuda.bindings.driver import CUstream from cutlass import BFloat16, Int32, Uint8, Uint32 from cutlass.cute.nv...
fim
vllm-project/vllm
python
<|fim_suffix|> weights[weight_token_id, weight_head_id].to(Float32) * scale ) @cache @staticmethod def compile( head_dim: int = 128, rope_dim: int = 64, num_heads: int = 64, cos_sin_dtype: type[cutlass.Numeric] = Float32, coarsen: int = 4, ): ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import torch import torch.nn as nn from vllm.models.deepseek_v4.common.ops import fused_inv_r<|fim_suffix|> ) fp8_einsum( "bhr,hdr->bhd", (o_fp8, o_scale), (wo_a.weight...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Triton input-staging kernel for DeepSeek V4 MegaMoE. Quantizes hidden states to fp8 with E8M0 group scales and repacks the routing top-k tensors into the int64/float32 layout that the DeepGEMM MegaMoE kernels ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """CuTe DSL sparse-attention compressor for DeepSeek V4. The public wrappers provide the C4 fused and C128 split kernels. """ from __future__ import annotations from functools import cache from ty...
fim
vllm-project/vllm
python
<|fim_suffix|> def get_name(cls) -> QuantizationMethods: return "deepseek_v4_fp8" @classmethod def override_quantization_method( cls, hf_quant_cfg, user_quant, hf_config=None ) -> QuantizationMethods | None: if not ( isinstance(hf_quant_cfg, dict) and hf_qua...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """DeepSeek-V4 FlashMLA sparse backend, metadata, and metadata builder.""" from dataclasses import dataclass from typing import Any, ClassVar import numpy as np import torch from vllm.config impor...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX<|fim_suffix|> vLLM project <|fim_middle|>-FileCopyrightText: Copyright contributors to the<|endoftext|>
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import typing from collections.abc import Callable, Iterable from itertools import islice import regex as re import torch import torch.nn as nn from vllm.compilation.decorators import support_torch...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """MTP draft model for DeepSeek V4 (internal codename: DeepseekV4). Split from ``deepseek_mtp.py`` because the V4 architecture introduces several pieces that have no analogue in V3/V32: * separate ``e_proj`` / ...
fim
vllm-project/vllm
python
<|fim_suffix|>_cache_ptr + pos * ROPE_DIM + HALF_ROPE + rope_pair_idx ).to(tl.float32) if head_idx < num_heads: # ========== Q: per-head RMSNorm + GPT-J RoPE ========== q_base = q_ptr + token_idx * num_heads * HEAD_DIM + head_idx * HEAD_DIM # Load full head offs = tl.arange(0, ...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """XPU DeepSeek-V4 attention subclass. Subclasses the shared ``DeepseekV4Attention`` ABC and provides XPU-native Triton kernels for decode (FP8 dequant + BF16 attention) and prefill (BF16 gathered KV + sparse att...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """XPU sparse decode for DeepSeek V4 with FP8 KV cache. Strategy: dequantize FP8 UE8M0 KV cache pages to BF16 on the fly, then reuse the BF16 sparse MLA attention kernel (xpu_sparse_mla_bf16). This ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copy<|fim_suffix|> processing according to the target model. Info: [mm_processing](../../../design/mm_processing.md) """ __all__ = [ "BatchedTensorInputs", "MultiModalHasher", "MultiModalKwargsItems", "NestedTensors", ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import math from dataclasses import dataclass from enum import Enum from typing import Literal import numpy as np import numpy.typing as npt import torch from vllm.utils.import_utils import Placeho...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import operator import sys from abc import ABC, abstractmethod from collections.abc import Mapping, Sequence from multiprocessing.synchronize import Lock as LockType from typing import TYPE_CHECKING,...
fim
vllm-project/vllm
python
<|fim_suffix|>s_per_prompt, max_items_per_batch def get_modality_with_max_tokens(self) -> str: mm_max_toks_per_item = self.mm_max_toks_per_item modality, _ = max(mm_max_toks_per_item.items(), key=lambda x: (x[1], x[0])) return modality def get_encoder_budget(self) -> int: retu...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project # SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this ...
fim
vllm-project/vllm
python
<|fim_suffix|> for bytes_ in cls.iter_item_to_bytes(k, v): hasher.update(bytes_) return hasher.hexdigest() <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import functools import hashlib import pickle import uuid from col...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import contextlib from PIL import Image, ImageOps def rescale_image_size( image: Image.Image, size_factor: float, transpose: int = -1 ) -> Image.Image: """Rescale the dimensions of an ima...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from abc import ABC, abstractmethod from collections import UserDict, defaultdict from collections.abc import Mapping, Sequence from dataclasses import dataclass from functools import cached_propert...
fim
vllm-project/vllm
python
<|fim_suffix|>CTOR_REGISTRY", "MediaConnector", ] <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from .audio import AudioEmbeddingMediaIO, AudioMediaIO from .base import MediaIO, MediaWithBytes from .connector import MEDIA_CONNECTOR_REGISTRY,...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import math from io import BytesIO from pathlib import Path import numpy as np import numpy.typing as npt import pybase64 import torch from vllm.logger import init_logger from vllm.multimodal.audio...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from abc import ABC, abstractmethod from dataclasses import dataclass, field from pathlib import Path from typing import Any, Generic, TypeVar import numpy as np _T = TypeVar("_T") @dataclass cl...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import asyncio import atexit import contextlib import hashlib import os import tempfile import time from concurrent.futures import ThreadPoolExecutor from pathlib import Path from typing import Any, TypeVar from ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from io import BytesIO from pathlib import Path import numpy as np import pybase64 import torch from PIL import Image from vllm.utils.serial_utils import tensor2base64 from ..image import convert...
fim
vllm-project/vllm
python
<|fim_suffix|> ) total = int(frames.shape[0]) fps = float(self.kwargs.get("fps", 1)) # validate and extract frames_indices frames_indices = self.kwargs.get("frames_indices") if frames_indices is not None: if not ( is...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from abc import ABC, abstractmethod from collections import UserDict from collections.abc import Callable, Iterator, Mapping, Sequence, Set from typing import ( TYPE_CHECKING, Any, Gener...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from .context import BaseProcessingInfo, InputProcessingContext, TimingContext from .dummy_inputs import BaseDummyInputsBuilder from .inputs import ProcessorInputs from .processor import ( BaseMu...
fim
vllm-project/vllm
python