text
stringlengths
14
100k
source
stringclasses
1 value
repo
stringclasses
810 values
language
stringclasses
13 values
<|fim_suffix|>ry = self._apply_rotary_embedding( self.cos_sin_q_cache[positions_with_offsets % chunk_len], query_rot, query_pass, ) query_succ = self._apply_rotary_embedding( self.cos_sin_qc_cache[positions_with_offsets % chunk_len], query_rot,...
fim
vllm-project/vllm
python
<|fim_suffix|>m=-1) return cache <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import torch from .base import RotaryEmbedding class DynamicNTKAlphaRotaryEmbedding(RotaryEmbedding): """RotaryEmbedding extended with Dynamic NTK alp...
fim
vllm-project/vllm
python
<|fim_suffix|>rch.float) freqs = torch.einsum("i,j -> ij", t, inv_freq) cos = freqs.cos() sin = freqs.sin() cache = torch.cat((cos, sin), dim=-1) return cache <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import torch from .mrope import MRotaryEmbedding class Ernie4_5_VLRotaryEmbedding(MRotaryEmbedding): """3D rotary positional embedding. 3D is t:time h:height w:width""" def forward_nati...
fim
vllm-project/vllm
python
<|fim_suffix|> return inv_freq def _compute_cos_sin_cache(self) -> torch.Tensor: """Compute the cos and sin cache.""" device = self.inv_freq.device t = torch.arange(self.max_position_embeddings, dtype=torch.float, device=device) freqs = torch.einsum("j,i -> ji", t, self.inv_freq)...
fim
vllm-project/vllm
python
<|fim_suffix|>lf.nope_angles, dtype=torch.float), ] ) return inv_freq def extra_repr(self) -> str: s = f"head_size={self.head_size}, rotary_dim={self.rotary_dim}" s += f", rope_angles={self.rope_angles}, nope_angles={self.nope_angles}" s += f", max_positi...
fim
vllm-project/vllm
python
<|fim_suffix|>nt]: return self._scaling_factor_to_offset <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project # Adapted from # https://github.com/huggingface/transformers/blob/v4.33.2/src/transformers/models/llama/modeling_llama.py # Copyrigh...
fim
vllm-project/vllm
python
<|fim_suffix|> / ( self.high_freq_factor - self.low_freq_factor ) else: smooth = 0 new_freqs = torch.where( wave_len < high_freq_wavelen, inv_freqs, torch.where( wave_len > low_freq_wavelen, inv_f...
fim
vllm-project/vllm
python
<|fim_suffix|>= (query_.ndim - 1) else 1 for i, d in enumerate(query_.shape) ] freqs_ci = cos_sin_cache.view(*broadcast_shape) query_out = torch.view_as_real(query_ * freqs_ci).flatten(3) key_out = torch.view_as_real(key_ * freqs_ci).flatten(3) return query_out.type_a...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import numpy as np import torch from vllm.triton_utils import tl, triton from .base import RotaryEmbeddingBase from .yarn_scaling_rope import YaRNScalingRotaryEmbedding, yarn_get_mscale @triton...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project # # Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved. # Adapted from vllm/model_executor/layers/rotary_embedding/__init__.py # Copyright 2023 The vLLM team. # # This file is a part of the vllm-...
fim
vllm-project/vllm
python
<|fim_suffix|>d_b is None: inv_freq = inv_freq / self.scaling_factor ** (2 / self.rotary_dim) else: a = ( torch.tensor(self.scaling_factor).log() / (self.rotary_dim / 2) ** self.mixed_b ) lambda_1_m = ( a * torch.ara...
fim
vllm-project/vllm
python
<|fim_suffix|>ey = torch.cat((key_rot, key_pass), dim=-1) return query.flatten(-2), key.flatten(-2) <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import math import torch import torch.nn as nn from vllm.config import get_current_vllm_...
fim
vllm-project/vllm
python
<|fim_suffix|>oat(get_mscale(self.scaling_factor) * attn_factor) # Initialization must be performed after mscale, otherwise mscale is useless RotaryEmbedding.__init__( self, head_size, rotary_dim, max_position_embeddings, base, is_n...
fim
vllm-project/vllm
python
<|fim_suffix|>sin, ) query = torch.cat((query_rot, query_pass), dim=-1).reshape(query_shape) key_shape = key.shape key = key.view(num_tokens, -1, self.head_size) key_rot = key[..., : self.rotary_dim] key_pass = key[..., self.rotary_dim :] key_rot = self.apply_rot...
fim
vllm-project/vllm
python
<|fim_suffix|>_freq_extrapolation = 1.0 / pos_freqs inv_freq_interpolation = 1.0 / (scaling_factor * pos_freqs) low, high = yarn_find_correction_range( self.beta_fast, self.beta_slow, self.rotary_dim, self.base, self.max_position_embeddings, ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Custom Sparse Attention Indexer layers.""" import torch import vllm.envs as envs from vllm import _custom_ops as ops from vllm._aiter_ops import rocm_aiter_ops from vllm.compilation.breakable_cu...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Utility methods for model layers.""" from collections.abc import Callable import torch from vllm import _cust<|fim_suffix|>!= 2: # this is not a linear layer # For now it should...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from collections.abc import Sequence from dataclasses import dataclass import torch import torch.nn.functional as F from torch.nn.parameter import Parameter import vllm.envs as envs from vllm.distributed import...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from typing import Literal from torch import nn from vllm.config import ModelConfig, VllmConfig from vllm.config.load import LoadConfig from vllm.logger import init_logger from vllm.model_executor...
fim
vllm-project/vllm
python
<|fim_suffix|>m_config.load_config load_device = ( device_config.device if load_config.device is None else load_config.device ) target_device = torch.device(load_device) with set_default_torch_dtype(model_config.dtype): with target_device: model = ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import fnmatch import glob import itertools import math import os from collections.abc import Callable, Generator from typing import Any import numpy as np import torch from packaging import version...
fim
vllm-project/vllm
python
<|fim_suffix|>_track ) if enable_weights_track: self.track_weights_loading(model, loaded_weights) def track_weights_loading( self, model: nn.Module, loaded_weights: set[str] | None ) -> None: weights_to_load = {name for name, _ in model.named_parameters()} if...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import torch.nn as nn from vllm.config import ModelConfig from vllm.config.load import LoadConfig from vllm.model_executor.layers.quantization.base_config import QuantizeMethodBase from vllm.model_e...
fim
vllm-project/vllm
python
<|fim_suffix|> if *weight_name* is an expert weight that does not belong to the local rank and should be skipped during loading.""" if local_expert_ids is None: return False eid = parse_expert_id(weight_name) if eid is None: # Not an expert weight (dense / shared-expert / embedding) → ke...
fim
vllm-project/vllm
python
<|fim_suffix|> _MODELEXPRESS_LOADER_MODULE, } ) def _missing_modelexpress_error() -> ImportError: return ImportError( "The 'modelexpress' load format requires the ModelExpress Python package. " "Install it with `pip install modelexpress`." ) class ModelExpressModelLoader(BaseModelLoade...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: <|fim_suffix|>attrs", "support_quantized_model_reload_from_hp_weights", ] from .layerwise import ( finalize_layerwise_processing, finalize_layerwise_reload, initialize_layerwise_reload, record_metadata_for_reloading, ) fr...
fim
vllm-project/vllm
python
<|fim_suffix|> loader_signature.bind(*args, **kwargs) bound_args.apply_defaults() # Buffer loaded weights, track loading progress info.loaded_weights.append((param_name, bound_args)) num_loaded, ret = get_numel_loaded(original_loader, bound_args) info.load_numel += num_loaded ...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import inspect from collections.abc import Callable import torch from torch.nn.parameter import UninitializedParameter from torch.utils._python_dispatch import TorchDispatchMode from .sanitize import restore_lay...
fim
vllm-project/vllm
python
<|fim_suffix|>l) return tensor def restore_layer_refs(tensor: torch.Tensor, layer: torch.nn.Module) -> torch.Tensor: """ Restores references to layer held by tensor attributes. Used by `restore_layer_on_meta` to add back layer references, allowing for proper weight loading. Args: te...
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 from functools import wraps from types import FunctionType from typing import TYPE_CHECKING import torch from vllm.config import ModelConfig from .layerwise i...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from dataclasses import dataclass, field from inspect import BoundArguments import torch __all__ = ["LayerTensors", "LayerReloadingInfo"] # encodes both parameters and buffers separately LayerTensors = tuple[di...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from inspect import BoundArguments import torch from .types import LayerReloadingInfo, LayerTensors __all__ = [ "get_layer_tensors", "get_layer_params_buffers", "get_layer_size", ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import os from collections.abc import Generator import torch from torch import nn from transformers.utils im<|fim_suffix|>streamer_s3_endpoint = os.getenv("RUNAI_STREAMER_S3_ENDPOINT") a...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import collections import glob import os import time from collections.abc import Generator from copy import copy from typing import Any import torch from torch import nn from vllm.config import ModelConfig from...
fim
vllm-project/vllm
python
<|fim_suffix|>nce.", ) group.add_argument( "--s3-access-key-id", type=str, default=None, help="The access key for the S3 bucket. Can also be set via the " "S3_ACCESS_KEY_ID environment variable.", ) group.add_argument( ...
fim
vllm-project/vllm
python
<|fim_suffix|>s not an allowed Tensorizer argument.") class TensorizerLoader(BaseModelLoader): """Model loader using CoreWeave's tensorizer library.""" def __init__(self, load_config: LoadConfig): super().__init__(load_config) if isinstance(load_config.model_loader_extra_config, TensorizerCon...
fim
vllm-project/vllm
python
<|fim_suffix|>cked_name: continue for index, param_name in enumerate(sub_params): self.inverse_packed_mapping[param_name] = ( packed_name, index, ) def get_sub_modules(self, module_name: str) -> tuple[str, list[str]...
fim
vllm-project/vllm
python
<|fim_suffix|>ache.scale", ) ): import regex as re for pattern, replacement in scale_mapping_patterns: if re.search(pattern, name): remapped_name = re.sub(pattern, replacement, name) if remapped_name not in params_dict: scale_t...
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/huggingface/transformers/blob/v4.28.0/src/transformers/models/llama/modeling_llama.py # Copyright 2023 The vLLM team. # # This code is based on EleutherAI's GPT-N...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from .interfaces import ( HasInnerState, SupportsLoRA, SupportsMRoPE, SupportsMultiModal, SupportsPP, SupportsTranscription, has_inner_state, supports_lora, suppo...
fim
vllm-project/vllm
python
<|fim_suffix|> ModelForSequenceClassification.__name__ = _get_pooling_model_name( cls.__name__, "ForSequenceClassification" ) return ModelForSequenceClassification # type: ignore class SequenceClassificationConfig(VerifyAndUpdateConfig): @staticmethod def verify_and_update_config(vllm_c...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Inference-only AfMoE model compatible with HuggingFace weights.""" import typing from collections.abc import Callable, Iterable from itertools import islice import torch from torch import nn fr...
fim
vllm-project/vllm
python
<|fim_suffix|> config, quant_config=quant_config, prefix=f"{prefix}.attn" ) self.norm_1 = RMSNorm(config.hidden_size, eps=config.rms_norm_eps) self.mlp = AIMv2SwiGLUFFN( config, quant_config=quant_config, prefix=f"{prefix}.mlp" ) self.norm_2 = RMSNorm(config.hidde...
fim
vllm-project/vllm
python
<|fim_suffix|>ttention_bias = getattr(config, "attention_bias", False) or getattr( config, "bias", False ) bias_o_proj = attention_bias # support internlm/internlm3-8b with qkv_bias if hasattr(config, "qkv_bias"): attention_bias = config.qkv_bias # Apertu...
fim
vllm-project/vllm
python
<|fim_suffix|>_loader # type: ignore[attr-defined] weight_loader(param, loaded_weight, shard_id) loaded_params.add(name) mapped = True break if mapped: continue if name.endswith(".bias") and name not in params_dic...
fim
vllm-project/vllm
python
<|fim_suffix|>ghts: Iterable[tuple[str, torch.Tensor]]) -> set[str]: stacked_params_mapping = [ # (param_name, shard_name, shard_id) ("qkv_proj", "q_proj", "q"), ("qkv_proj", "k_proj", "k"), ("qkv_proj", "v_proj", "v"), ] mlp_params_mapping: list[...
fim
vllm-project/vllm
python
<|fim_suffix|>tten(1) image_attn_mask = torch.logical_not(flattened_mask) return self.multi_modal_projector(image_outputs, image_attn_mask) def embed_multimodal(self, **kwargs: object) -> MultiModalEmbeddings: image_input = self._parse_and_validate_image_input(**kwargs) if imag...
fim
vllm-project/vllm
python
<|fim_suffix|> prompt_ids = self._apply_hf_processor_tokens_only(prompt_ids) return BatchFeature(dict(input_ids=[prompt_ids]), tensor_type="pt") processor = self.info.get_hf_processor(**mm_kwargs) feature_extractor = processor.feature_extractor mm_kwargs = dict( **mm_...
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/huggingface/transformers/tree/main/src/transformers/models/aya_vision from collections.abc import Iterable, Mapping, Sequence from typing import Annotated, Literal ...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project # Copyright 2025 Bytedance Ltd. and/or its affiliates. """Inference-only BAGEL model compatible with HuggingFace weights. BAGEL is a unified multimodal model for image understanding and generation. For vLLM, we f...
fim
vllm-project/vllm
python
<|fim_suffix|>self.logits_processor = LogitsProcessor(config.vocab_size) 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) de...
fim
vllm-project/vllm
python
<|fim_suffix|>str, str, int, str]]: return self.model.get_expert_mapping() class BailingMoeV2ForCausalLM(BailingMoeForCausalLM): pass <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project # Adapted from # https://github.com/inclusionAI/Li...
fim
vllm-project/vllm
python
<|fim_suffix|>]) if "layers." in name else 0 ) attn_name = ( "self_attn.dense" if is_linear_layer(layer_idx, self.config.layer_group_size) else "self_attn.o_proj" ) ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Inference-only Bamba model.""" # Added by the IBM Team, 2024 from collections.abc import Iterable import torch from torch import nn from transformers import BambaConfig from vllm.compilation.de...
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 Mapping import torch import torch.nn as nn from transformers.activations import GELUActivation from vllm.config import VllmConfig from vllm.config.multimodal import Bas...
fim
vllm-project/vllm
python
<|fim_suffix|> loaded.update({"model." + n for n in loaded_model}) if mlm_side: name_map = { "cls.predictions.transform.dense.weight": "mlm_head.dense.weight", "cls.predictions.transform.dense.bias": "mlm_head.dense.bias", ("cls.predictions.trans...
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 from torch import nn from transformers import PretrainedConfig from vllm.compilation.decorators import support_torch_compile from vllm.config impor...
fim
vllm-project/vllm
python
<|fim_suffix|>_name) param = params_dict[name] weight_loader = param.weight_loader weight_loader(param, loaded_weight, shard_id) break else: param = params_dict[name] weight_loader = getattr(param, "weight_loader...
fim
vllm-project/vllm
python
<|fim_suffix|>ets.start(), insertion=image_tokens, ) ] @MULTIMODAL_REGISTRY.register_processor( Blip2MultiModalProcessor, info=Blip2ProcessingInfo, dummy_inputs=Blip2DummyInputsBuilder, ) class Blip2ForConditionalGeneration( nn.Module, SupportsLoRA, SupportsMultiMod...
fim
vllm-project/vllm
python
<|fim_suffix|>ors: IntermediateTensors | None = None, inputs_embeds: torch.Tensor | None = None, ) -> torch.Tensor | IntermediateTensors: hidden_states = self.transformer( input_ids, positions, intermediate_tensors, inputs_embeds ) return hidden_states def compute_lo...
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, Mapping, Sequence from functools import cached_property from itertools import islice from typing import Annotated, Any, Literal import torch import torch.nn as...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project # Adapted from # https://github.com/zai-org/ChatGLM2-6B """Inference-only ChatGLM model compatible with THUDM weights.""" import json from collections.abc import Iterable from itertools import islice import torc...
fim
vllm-project/vllm
python
<|fim_suffix|> z_channels = _cfg(config, "z_channels", d) out_ch = _cfg(config, "out_ch", d) num_resolutions = len(ch_mult) self.post_quant_conv = nn.Conv2d(z_channels, z_channels, 1) block_in = ch * ch_mult[num_resolutions - 1] self.conv_in = nn.Conv2d(z_channels, block_in, 3, ...
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 Callable, Iterable, Mapping, Sequence from functools import cached_property from typing import Annotated, Literal import torch import torch.nn as nn from transformers imp...
fim
vllm-project/vllm
python
<|fim_suffix|> return self.logits_processor(self.model.embed_tokens, hidden_states) def load_weights(self, weights: Iterable[tuple[str, torch.Tensor]]) -> set[str]: loader = AutoWeightsLoader(self, skip_prefixes=["lm_head."]) return loader.load_weights(weights) <|fim_prefix|># SPDX-License-Identi...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project # Adapted from vllm/model_executor/models/aya_vision.py """Command-A-Vision (Cohere2Vision) multimodal model implementation for vLLM.""" from collections.abc import Iterable, Mapping, Sequence from typing import ...
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 typing import Any, ClassVar import torch import torch.nn.functional as F from torch import nn from transformers import Pretr...
fim
vllm-project/vllm
python
<|fim_suffix|>{type(self).__name__} does not support multimodal inputs yet." ) return self.model(input_ids, positions, hidden_states) def load_weights(self, weights: Iterable[tuple[str, torch.Tensor]]): def _track_and_forward(inputs): name, weight = inputs proces...
fim
vllm-project/vllm
python
<|fim_suffix|>--------------------------------------------------------------- @default_pooling_type(seq_pooling_type="CLS", tok_pooling_type="ALL") class ColBERTLfm2Model(ColBERTMixin, nn.Module, HasInnerState, IsHybrid): """ColBERT late interaction model with LFM2 backbone. For ``LiquidAI/LFM2-ColBERT-350M`...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ColModernVBERT: multimodal late-interaction retrieval model. Combines SigLIP vision encoder + ModernBERT text encoder with a pixel shuffle connector and ColBERT-style 128-dim per-token embeddings...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ ColPali late interaction model for multi-modal retrieval and reranking. ColPali extends PaliGemma with a ColBERT-style late interaction head, producing per-token embeddings for both text and image inputs. It ...
fim
vllm-project/vllm
python
<|fim_suffix|>f __init__(self, *, vllm_config: VllmConfig, prefix: str = "model"): super().__init__(vllm_config=vllm_config, prefix=prefix) config = vllm_config.model_config.hf_config head_dtype = vllm_config.model_config.head_dtype hidden_size = getattr(config, "hidden_size", None) ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ ColQwen3.5 late interaction model for multi-modal retrieval and reranking. ColQwen3.5 extends Qwen3.5 with a ColBERT-style late interaction head, producing per-token embeddings for both text and...
fim
vllm-project/vllm
python
<|fim_suffix|> assert config.tie_word_embeddings self.quant_config = quant_config self.logits_processor = LogitsProcessor( config.vocab_size, scale=config.logit_scale ) self.model = CohereModel( vllm_config=vllm_config, prefix=maybe_prefix(prefix, "model") ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from typing import TYPE_CHECKING from vllm.logger import init_logger from vllm.utils.math_utils import round_up if TYPE_CHECKING: from transformers import PretrainedConfig from vllm.config...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ Shared Conformer encoder components for FireRedASR2 and FireRedLID. Both models use the same Conformer-based audio encoder architecture (Conv2dSubsampling → RelPositionalEncoding → N × RelPosEmb...
fim
vllm-project/vllm
python
<|fim_suffix|> Using secondary_weights here to load all necessary weights for the Reasoner-only part. """ def __init__(self, *, vllm_config: VllmConfig, prefix: str = "") -> None: super().__init__(vllm_config=vllm_config, prefix=prefix) self.secondary_weights = [ DefaultModel...
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 from itertools import islice import torch import torch.nn as nn from transformers import DbrxConfig from vllm.config import CacheConfig, VllmConfig from vllm.d...
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/deepseek-ai/DeepSeek-OCR/blob/main/DeepSeek-OCR-master/DeepSeek-OCR-vllm/deepencoder/sam_vary_sdpa.py # Copyright (c) Meta Platforms, Inc. and affiliates. # All ...
fim
vllm-project/vllm
python
<|fim_suffix|> initializer_range: float = 0.02, ): super().__init__() # load Qwen2Model = transformers.models.qwen2.modeling_qwen2.Qwen2Model Qwen2Config = transformers.Qwen2Config # config config = Qwen2Config( hidden_size=hidden_dimension, ...
fim
vllm-project/vllm
python
<|fim_suffix|> otherwise # name will be updated to mlp.experts[0].gate_up_proj, which # will then be updated below in expert_params_mapping # for mlp.experts[0].gate_gate_up_proj, which breaks load. if ("mlp.experts." in name) and name not in params_dict: ...
fim
vllm-project/vllm
python
<|fim_suffix|>ates. aux_output = hidden_states if self.norm_output else hidden_prenorm return hidden_states, aux_output def load_weights(self, weights: Iterable[tuple[str, torch.Tensor]]) -> set[str]: stacked_params_mapping = [ # (param_name, shard_name, shard_id) (...
fim
vllm-project/vllm
python
<|fim_suffix|>moe_shared_experts_layer: name = name_mapped else: loaded_params.add(name_mapped) break else: if is_expert_weight: ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Inference-only Deepseek-OCR model compatible with HuggingFace weights.""" import math from collections.abc import Iterable, Mapping, Sequence from typing import Annotated, Literal import torch i...
fim
vllm-project/vllm
python
<|fim_suffix|>_config multimodal_config = vllm_config.model_config.multimodal_config self.config = config self.multimodal_config = multimodal_config self.vision_config = config.vision_config self.projector_config = config.projector_config self.text_config = config.text_...
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/huggingface/transformers/blob/v4.28.0/src/transformers/models/llama/modeling_llama.py # Copyright 2023 The vLLM team. # Copyright 2023 DeepSeek-AI and the Hugging...
fim
vllm-project/vllm
python
<|fim_suffix|> * (num_width_tiles * w + 1) return global_views_tokens + local_views_tokens + 1 def get_image_size_with_most_features(self) -> ImageSize: hf_config = self.get_hf_config() candidate_resolutions = hf_config.candidate_resolutions height, width = max( candidat...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """DiffusionGemma model, ModelState, and Sampler for vLLM. Single Gemma4 backbone run in two modes (like YOCO): - encoder mode: causal attention, writes KV cache - decoder mode: bidirectional attent...
fim
vllm-project/vllm
python
<|fim_suffix|>: qkv, _ = self.qkv_proj(hidden_states) q, k, v = qkv.split([self.q_size, self.kv_size, self.kv_size], dim=-1) q = self.q_norm(q.reshape(-1, self.num_heads, self.head_dim)).reshape(q.shape) k = self.k_norm(k.reshape(-1, self.num_kv_heads, self.head_dim)).reshape( ...
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, Mapping from typing import Annotated, Literal, TypeAlias import torch import torch.nn as nn from torch.nn import LayerNorm from transformers.models.qwen2_vl imp...
fim
vllm-project/vllm
python
<|fim_suffix|> "input_ids": input_ids, "positions": positions, "intermediate_tensors": intermediate_tensors, "inputs_embeds": inputs_embeds, } hidden_states = self.language_model.model(**forward_kwargs) return hidden_states def compute_logits( ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project # Copyright 2025 The Baidu 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 libra...
fim
vllm-project/vllm
python
<|fim_suffix|>ange(config.num_hidden_layers) if ( i >= config.moe_layer_start_index and i <= config.moe_layer_end_index and (i + 1) % config.moe_layer_interval == 0 ) ] self.num_moe_layers = len(moe_layers_indices) self.num_...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project # Copyright 2025 The Baidu 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 libra...
fim
vllm-project/vllm
python
<|fim_suffix|>args: object, ) -> torch.Tensor | IntermediateTensors: hidden_states = self.model( input_ids, positions, intermediate_tensors, inputs_embeds, **kwargs ) return hidden_states def compute_logits( self, hidden_states: torch.Tensor, ) -> torch.T...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project # Copyright 2025 The Baidu 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 library and the GPT...
fim
vllm-project/vllm
python
<|fim_suffix|> "residual"], config.hidden_size ) def embed_input_ids(self, input_ids: torch.Tensor) -> torch.Tensor: return self.wte(input_ids) def forward( self, input_ids: torch.Tensor | None, positions: torch.Tensor, intermediate_tensors: IntermediateTensors ...
fim
vllm-project/vllm
python
<|fim_suffix|>m, eps=config.rms_norm_eps) self.k_norm = RMSNorm(self.head_dim, eps=config.rms_norm_eps) is_neox_style = True layer_idx = extract_layer_index(prefix) is_sliding = config.layer_types[layer_idx] == "sliding_attention" self.sliding_window = config.sliding_window if ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project # ruff: noqa: E501 # 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