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
"""PyTorch MAMBA model."""
from collections.abc import Iterable
from itertools import islice
import torch
from torch import nn
from transformers import MambaConfig
from vllm.compilation.decorators... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""PyTorch MAMBA2 model."""
from collections.abc import Iterable
import torch
from torch import nn
from transformers import MambaConfig
from vllm.compilation.decorators import support_torch_compil... | 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 vllm.config import VllmConfig
from vllm.model_executor.layers.logits_processor import LogitsProcessor
from vllm.model_e... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
from typing import Any
from torch import nn
from vllm.compilation.decorators import support_torch_compile
from vllm.config import VllmConfig
from vllm.distributed import get_tensor_model_parallel_... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
# Copyright 2025 Horizon team, Xiaomi MiLM Plus.
# Copyright 2024 The Qwen team.
# Copyright 2023 The vLLM team.
# Copyright 2022 EleutherAI and the HuggingFace Inc. team. All rights reserved.
#
# Th... | fim | vllm-project/vllm | python |
<|fim_suffix|>me not in params_dict:
continue
# Remapping the name of FP8 kv-scale.
name = maybe_remap_kv_scale_name(name, params_dict)
if name is None:
continue
if is_pp_missing_parameter(name, self):
... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""MiMo audio: tokenizer, encoding utilities, and audio encoder.
Ported from SGLang's mimo_audio.py.
Audio tokenizer adapted from https://github.com/XiaomiMiMo/MiMo-Audio-Tokenizer.git
"""
import d... | fim | vllm-project/vllm | python |
<|fim_suffix|>ds, positions, hidden_states, inputs_embeds, spec_step_idx
)
return hidden_states
def compute_logits(
self,
hidden_states: torch.Tensor,
spec_step_idx: int = 0,
) -> torch.Tensor | None:
return self.model.compute_logits(hidden_states, self.lm_head, ... | fim | vllm-project/vllm | python |
<|fim_suffix|> stacked_matched = True
break
if stacked_matched:
continue
if name.endswith(".bias") and name not in params_dict:
continue
orig_name = name
mapped_name = maybe_remap_kv_scale_name(name, params_dict)
... | fim | vllm-project/vllm | python |
<|fim_suffix|>proj merging.
stacked_matched = False
for param_name, weight_name, shard_id in stacked_params_mapping:
if weight_name not in name:
continue
name_rewritten = name.replace(weight_name, param_name)
if (
... | 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 Callable, Iterable, Mapping, Sequence
from functools import partial
from typing import Any
import einops
import numpy as np
import torch
import torch.nn as nn... | fim | vllm-project/vllm | python |
<|fim_suffix|>lb and getattr(config, "num_experts", 0) > 0:
raise NotImplementedError("EPLB is not supported for MiniCPM yet.")
def _init_model(self, *, vllm_config: VllmConfig, prefix: str = ""):
return MiniCPMModel(vllm_config=vllm_config, prefix=prefix)
def embed_input_ids(self, input_i... | 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 2024 The ModelBest team.
# Copyright 2023 The vLLM team.
# Copyr... | fim | vllm-project/vllm | python |
<|fim_suffix|> intermediate_size=self.config.intermediate_size,
prefix=f"{self.prefix}.mlp",
)
def forward(
self,
positions: torch.Tensor,
hidden_states: torch.Tensor,
residual: torch.Tensor | None,
) -> tuple[torch.Tensor, torch.Tensor]:
... | fim | vllm-project/vllm | python |
<|fim_suffix|>NDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Inference-only MiniCPM-O model compatible with HuggingFace weights."""
import os
from collections.abc import Callable, Iterable, Mapping, Sequence
fro... | 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 2022 EleutherAI and the HuggingF... | fim | vllm-project/vllm | python |
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""Inference-only MiniCPM-V 4.6 model (MiniCPMV4_6ForConditionalGeneration)."""
from collections.abc import Iterable, Mapping
from typing import Any
import numpy as np
import torch
from PIL import Image as PILIm... | fim | vllm-project/vllm | python |
<|fim_suffix|>s) > 0:
return hidden_states, aux_hidden_states
return hidden_states
def get_expert_mapping(self) -> list[tuple[str, str, int, str]]:
return fused_moe_make_expert_params_mapping(
self,
ckpt_gate_proj_name="w1",
ckpt_down_proj_name="w2",... | fim | vllm-project/vllm | python |
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""Inference-only MiniMaxText01 model."""
from collections.abc import Iterable
from itertools import islice
from typing import TYPE_CHECKING
if TYPE_CHECKING:
pass
import regex as re
import torch
from torch... | 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 transformers import BatchFeature, PretrainedConfig
from transfo... | fim | vllm-project/vllm | python |
<|fim_suffix|>cale_weight": "weight_scale",
"kv_fake_quantizer.qscale_act": "kv_scale",
"q_fake_quantizer.qscale_act": "attn.q_scale",
"k_fake_quantizer.qscale_act": "k_scale",
"v_fake_quantizer.qscale_act": "v_scale",
"wq": "q_proj",
"wk": "k_proj",
"wv": "v_proj... | 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 typing import Annotated, Literal
import torch
import torch.nn as nn
from transformers import BatchFeature, Mistral3Config, PixtralVision... | 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 vllm.compilation.decorators import support_torch_compile
from vllm.config import VllmConfig
from vllm.logger import ini... | fim | vllm-project/vllm | python |
<|fim_suffix|>del.layers.\1.mlp.experts.\2.up_proj.\3", # noqa: E501
r"norm\.weight": "model.norm.weight", # noqa: E501
r"tok_embeddings\.weight": "model.embed_tokens.weight", # noqa: E501
r"output\.weight": "lm_head.weight", # noqa: E501
}
# fmt: on
def load_weights(self, weigh... | fim | vllm-project/vllm | python |
<|fim_suffix|>_states: torch.Tensor,
inputs_embeds: torch.Tensor | None = None,
) -> tuple[torch.Tensor, torch.Tensor]:
hidden_states = self.model(input_ids, positions, hidden_states, inputs_embeds)
return hidden_states, hidden_states
def load_weights(self, weights: Iterable[tuple[str, ... | 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 2022 EleutherAI and the HuggingF... | fim | vllm-project/vllm | python |
<|fim_suffix|>ta_parallel,
)
return [
img.flatten(0, 1)
for img in vision_embeddings_flat.split(patches_per_image, dim=0)
]
def embed_multimodal(self, **kwargs) -> MultiModalEmbeddings:
image_input = self._parse_and_validate_image_input(**kwargs)
if ... | fim | vllm-project/vllm | python |
<|fim_suffix|>self.emb = nn.ModuleList(
[
VocabParallelEmbedding(
config.vocab_size,
self.inner_dim,
)
for _ in range(self.max_speculative_tokens)
]
)
self... | fim | vllm-project/vllm | python |
<|fim_suffix|>weight_loader(param, loaded_weight)
if name.startswith("head"):
param = params_dict["pooling." + name[len("head") + 1 :]]
weight_loader = getattr(param, "weight_loader", default_weight_loader)
weight_loader(param, loaded_weight)
def forward(... | 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/modelscope/ms-swift/blob/v2.4.2/swift/utils/module_mapping.py
from datac<|fim_suffix|>ue, str) else list(value)
return MultiModelKeys(
lang... | 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 dataclasses import dataclass
from functools import partial
from itertools import islice
from typing import Annotated
import numpy as np
im... | 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 dataclasses import dataclass, fields
from functools import partial
from itertools import islice
from typing import Annotated, ... | fim | vllm-project/vllm | python |
<|fim_suffix|>7 vision grid under
# the same bidirectional prefix mask: 1 BOS + 729 image embeddings.
return 730
def get_image_size_with_most_features(self) -> ImageSize:
return ImageSize(width=378, height=378)
def get_max_image_tokens(self) -> int:
return 730
def get_mm_m... | fim | vllm-project/vllm | python |
<|fim_suffix|>reqs_cis: torch.Tensor | None = None,
) -> torch.Tensor:
"""
Args:
hidden_states: non-packed (B, N, D) or packed (L, D). if non-packed, seqlens should be None, if packed, seqlens should be set
Returns:
output: same shape of input, non-packed (B, N, D) f... | fim | vllm-project/vllm | python |
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
# Adapted from https://huggingface.co/mosaicml/mpt-7b/tree/main
import math
from collections.abc import Iterable
from itertools import islice
import torch
import torch.nn as nn
from transformers import MptConfig... | fim | vllm-project/vllm | python |
<|fim_suffix|> int(self.max_seq_len_cached),
device=inv_freq.device,
dtype=inv_freq.dtype,
)
positions = positions / self.max_seq_len_cached * (2 * pi)
position_angles = positions.unsqueeze(-1) * inv_freq
position_angles = torch.repeat_interleave(position_ang... | fim | vllm-project/vllm | python |
<|fim_suffix|>dalities["images"] = self._parse_and_validate_image_input(**kwargs)
if input_key in ("pixel_values_flat_video",) and "videos" not in modalities:
modalities["videos"] = self._parse_and_validate_video_input(**kwargs)
if (
input_key
in (... | fim | vllm-project/vllm | python |
<|fim_suffix|>Support abacusai/Smaug-72B-v0.1 with attention_bias
attention_bias = getattr(config, "attention_bias", False) or getattr(
config, "bias", False
)
self.self_attn = NemotronAttention(
config=config,
hidden_size=self.hidden_size,
num_hea... | fim | vllm-project/vllm | python |
<|fim_suffix|> None
hidden_states = intermediate_tensors["hidden_states"]
residual = intermediate_tensors["residual"]
aux_hidden_states = self._maybe_add_hidden_state([], 0, hidden_states, residual)
for idx, layer in enumerate(
islice(self.layers, self.start_layer, s... | fim | vllm-project/vllm | python |
<|fim_suffix|> if weight_name not in name:
continue
is_expert_weight = True
# Replace the expert-specific weight name with fused parameter name
# e.g., "experts.0.up_proj." -> "experts.w13_"
name_mapped = name.replace(weight_n... | fim | vllm-project/vllm | python |
<|fim_suffix|>DeciModel(nn.Module):
def __init__(
self,
*,
vllm_config: VllmConfig,
prefix: str = "",
layer_type: type[DeciLMDecoderLayer] = DeciLMDecoderLayer,
):
super().__init__()
config = vllm_config.model_config.hf_config
cache_config = vllm_... | 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/amalad/vllm/blob/nemotron_parse/vllm/model_executor/models/nemotron_parse.py
# that's based on https://huggingface.co/nvidia/NVIDIA-Nemotron-Parse-v1.1/blob/main/h... | fim | vllm-project/vllm | python |
<|fim_suffix|>atModel, VllmModelForPooling):
"""
LlamaNemotronVL model for embeddings.
Inherits from LlamaNemotronVLChatModel and specializes it for embedding tasks:
- Uses SigLIP vision encoder instead of C-RADIO
- Uses bidirectional LLaMA (via llm_config) instead of causal LLaMA
- Adds pooler... | fim | vllm-project/vllm | python |
<|fim_suffix|>"image")
return {
"image": self._get_dummy_images(
width=target_width,
height=target_height,
num_images=num_images,
overrides=image_overrides,
)
}
class NVLMMultiModalProcessor(BaseInternVLMultiModal... | 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.40.1/src/transformers/models/olmo/modeling_olmo.py
# Copyright 2024 The vLLM team.
# Copyright 2024 EleutherAI and the HuggingFac... | fim | vllm-project/vllm | python |
<|fim_suffix|>QKVParallelLinear(
hidden_size,
self.head_dim,
self.total_num_heads,
self.total_num_kv_heads,
bias=False,
quant_config=vllm_config.quant_config,
prefix=f"{prefix}.qkv_proj",
)
self.tp_rank = get_tensor_mod... | fim | vllm-project/vllm | python |
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
# Adapted from:
# https://github.com/huggingface/transformers/blob/main/src/transformers/models/olmo_hybrid/modeling_olmo_hybrid.py
# Copyright 2026 The vLLM team.
#
# This code combines OLMo2/OLMo3 attention wit... | fim | vllm-project/vllm | python |
<|fim_suffix|>ant_config=quant_config,
prefix=f"{prefix}.qkv_proj",
)
self.tp_size = tp_size
self.tp_rank = get_tensor_model_parallel_rank()
self.q_norm = RMSNorm(self.total_num_heads * self.head_dim, eps=1e-5)
self.k_norm = RMSNorm(self.total_num_kv_heads * self.head... | fim | vllm-project/vllm | python |
<|fim_suffix|>age_model(vllm_config):
self.language_model = init_vllm_registered_model(
vllm_config=vllm_config,
hf_config=config.text_config,
prefix=maybe_prefix(prefix, "language_model"),
architectures=["Qwen2ForCausalLM"],
)
... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
# Copyright 2023 The vLLM team.
# Copyright 2022 EleutherAI and the HuggingFace Inc. team. All rights reserved.
#
# This code i... | fim | vllm-project/vllm | python |
<|fim_suffix|>place(weight_name, param_name)
param = params_dict[name]
weight_loader = param.weight_loader
weight_loader(
param,
loaded_weight,
name,
shard_id=shar... | fim | vllm-project/vllm | python |
<|fim_suffix|>: float | list[float] | None = None,
image_std: float | list[float] | None = None,
do_rescale: bool | None = None,
rescale_factor: float | None = None,
device: Optional["torch.device"] = None,
) -> tuple:
if do_rescale and do_normalize:
# Fused rescale and normalize
ima... | fim | vllm-project/vllm | python |
<|fim_suffix|>orted_mm_limits(self) -> Mapping[str, int | None]:
return {"image": 1}
def get_num_image_tokens(
self,
*,
image_width: int,
image_height: int,
) -> int:
image_size = self.get_hf_config().image_sizes[0]
return _get_num_image_tokens(image_size... | fim | vllm-project/vllm | python |
<|fim_suffix|> super().__init__()
config = vllm_config.model_config.hf_config
cache_config = vllm_config.cache_config
quant_config = vllm_config.quant_config
self.decoder = OPTDecoder(
config, cache_config, quant_config, prefix=f"{prefix}.decoder"
)
se... | fim | vllm-project/vllm | python |
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
# Adapted from
# https://huggingface.co/OrionStarAI/Orion-14B-Base/blob/main/modeling_orion.py
# Copyright (c) OrionStar Inc.
# LICENSE: https://huggingface.co/OrionStarAI/Orion-14B-Base/blob/main/LICENSE
"""Infe... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
# Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
# Adapted from
# https://github.com/huggingface/transformers/blob/v4.28.0/src/transformers/models/qwen2/modeling_qwen2.py
# Copyright 2024 T... | fim | vllm-project/vllm | python |
<|fim_suffix|>logits(
self,
hidden_states: torch.Tensor,
) -> torch.Tensor | None:
return self.llm.compute_logits(hidden_states)
def load_weights(self, weights: Iterable[tuple[str, torch.Tensor]]) -> set[str]:
loader = AutoWeightsLoader(self)
return loader.load_weights(w... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""PyTorch Ovis model."""
from collections.abc import Iterable, Mapping
from functools import partial
from typing import Annotated, Literal
import torch
import torch.nn as nn
from transformers impo... | fim | vllm-project/vllm | python |
<|fim_suffix|>input(
self, image_input: PaddleOCRImagePixelInputs
) -> MultiModalEmbeddings:
pixel_values = image_input.pixel_values
image_grid_thw = image_input.image_grid_thw
vision_outputs = tuple(
self.encode_image(pixel, grid).squeeze(0)
for pixel, grid i... | 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 typing import Annotated, Literal, TypeAlias
import torch
from torch import nn
from transformers import BatchFeature, PaliGemmaConfig
fro... | fim | vllm-project/vllm | python |
<|fim_suffix|>ded_params.add(target_name)
return loaded_params
def _can_skip_missing_named_param(self, target_name: str) -> bool:
if self.config.convolution_bias:
return False
# In transformers v5 (not v4), `convolution_bias=False` is
# propagated from parakeet config.... | fim | vllm-project/vllm | python |
<|fim_suffix|>fig.vocab_size)
else:
self.lm_head = PPMissingLayer()
self.logits_processor = None # type: ignore[assignment]
self.make_empty_intermediate_tensors = (
self.model.make_empty_intermediate_tensors
)
self.expert_weights: list[torch.Tensor]... | fim | vllm-project/vllm | python |
<|fim_suffix|>e_heads(k)
q, k = self.rotary_emb(position_ids, q, k)
attn_output = self.attn(q, k, v)
output, _ = self.dense(attn_output)
return output
class PersimmonDecoderLayer(nn.Module):
def __init__(
self,
config: PersimmonConfig,
cache_config: CacheCo... | fim | vllm-project/vllm | python |
<|fim_suffix|>d_params: set[str] = set()
for name, loaded_weight in weights:
if "rotary_emb.inv_freq" in name:
continue
for param_name, weight_name, shard_id in stacked_params_mapping:
if weight_name not in name:
continue
... | fim | vllm-project/vllm | python |
<|fim_suffix|>oj",
],
}
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contribut<|fim_middle|>ors to the vLLM project
# Adapted from llama.py
"""Inference-only Phi3 model code inherit from Llama.py"""
from vllm.model_executor.models.llama import LlamaForCausalLM
... | 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.
# Copyright 2024 Microsoft and the HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use 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 typing import Annotated, Any, Literal, TypeAlias
import numpy as np
import torch
import torch.nn as nn
from transformers impo... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
# Code copied from Microsoft/MoE by Jacob Platin (jacobplatin@microsoft.com)
# but implemented by the Phi-Speech team
#!/usr/b... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
# Code copied from Microsoft/MoE by Jacob Platin (jacobplatin@microsoft.com)
# but implemented by the Phi-Speech team
#!/usr/b... | fim | vllm-project/vllm | python |
<|fim_suffix|>wargs: object) -> MultiModalEmbeddings:
image_input = self._parse_and_validate_image_input(**kwargs)
if image_input is None:
return []
return self._process_image_input(image_input)
def forward(
self,
input_ids: torch.Tensor | None,
position... | fim | vllm-project/vllm | python |
<|fim_suffix|> )
self.rotary_emb = get_rope(
self.head_dim,
max_position=max_position,
rope_parameters=rope_parameters,
is_neox_style=True,
)
self.attn = Attention(
self.num_heads,
self.head_dim,
self.scalin... | fim | vllm-project/vllm | python |
<|fim_suffix|>on_lang_adapter_dict.get(trimmed_name)
if param is not None:
weight_loader = getattr(
param, "weight_loader", default_weight_loader
)
weight_loader(param, w)
else:
... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""Inference-only PLaMo2 model."""
from collections.abc import Iterable
from itertools import islice
from typing import TYPE_CHECKING
import torch
from torch import nn
from transformers import Pret... | fim | vllm-project/vllm | python |
<|fim_suffix|>n_states: torch.Tensor,
) -> torch.Tensor | None:
logits = self.logits_processor(self.lm_head, hidden_states)
return logits
def load_weights(self, weights: Iterable[tuple[str, torch.Tensor]]):
loader = AutoWeightsLoader(
self,
skip_prefixes=(["lm_he... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
# QianfanOCR is<|fim_suffix|>layer)
<|fim_middle|> built on InternVL with a Qwen3 language backbone.
# The model architecture and weights are fully compatible with InternVLChatModel,
# only the conf... | 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/qwen2/modeling_qwen2.py
# Copyright 2024 The Qwen team.
# Copyright 2023 The vLLM team.
# Copyright ... | fim | vllm-project/vllm | python |
<|fim_suffix|>eo_input(
self,
**kwargs: dict[str, Any],
) -> Qwen2_5_VLVideoInputs | None:
pixel_values_videos = kwargs.pop("pixel_values_videos", None)
video_embeds = kwargs.pop("video_embeds", None)
video_grid_thw = kwargs.pop("video_grid_thw", None)
if pixel_value... | 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/main/src/transformers/models/qwen2_5_vl/modeling_qwen2_5_vl.py
# Copyright 2025 The vLLM team.
# Copyright 2025 The Qwen Team.
# Cop... | fim | vllm-project/vllm | python |
<|fim_suffix|>_items: MultiModalDataItems,
hf_processor_mm_kwargs: Mapping[str, object],
out_mm_kwargs: MultiModalKwargsItems,
) -> Sequence[PromptUpdate]:
processor = self.info.get_hf_processor(**hf_processor_mm_kwargs)
audio_token_id = processor.audio_token_id
out_mm_data ... | fim | vllm-project/vllm | python |
<|fim_suffix|>"gate_up_proj", "gate_proj", 0),
("gate_up_proj", "up_proj", 1),
]
params_dict = dict(self.named_parameters())
loaded_params: set[str] = set()
expert_params_mapping = self.get_expert_mapping()
for name, loaded_weight in weights:
for param_na... | fim | vllm-project/vllm | python |
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
# Adapted from
# https://huggingface.co/Qwen/Qwen2.5-Math-RM-72B/blob/main/modeling_qwen2_rm.py
# Copyright 2024 The Qwen team.
# Copyright 2023 The vLLM team.
"""Inference-only Qwen2-RM model compatible with Hug... | fim | vllm-project/vllm | python |
<|fim_suffix|>
patch_embed = self.visual.patch_embed
in_channels = patch_embed.proj.in_channels
patch_size = patch_embed.patch_size
temporal_patch_size = patch_embed.temporal_patch_size
total_patches = sum(t * h * w for t, h, w in grid_config)
flattened_patch_size = (
... | fim | vllm-project/vllm | python |
<|fim_suffix|> self.total_num_kv_heads,
bias=qkv_bias,
quant_config=quant_config,
prefix=f"{prefix}.qkv_proj",
)
self.o_proj = RowParallelLinear(
self.total_num_heads * self.head_dim,
hidden_size,
bias=False,
quant_... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
# Copyright 2025 The vLLM team.
# Copyright 2025 The Qwen Team.
# Copyright 2025 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|>all' prefix caching, "
"please use '--mamba-cache-mode=align' instead"
)
self.quant_config = vllm_config.quant_config
super().__init__()
self.config = config
self.model = Qwen3_5MultiTokenPredictor(
vllm_config=vllm_config, prefix=m... | fim | vllm-project/vllm | python |
<|fim_suffix|> f"<|im_start|>assistant\n"
)
lang_code = to_language if task_type == "translate" else language
if lang_code is not None:
full_lang_name = cls.supported_languages.get(lang_code, lang_code)
prompt += f"language {full_lang_name}{_ASR_TEXT_TAG}"
promp... | fim | vllm-project/vllm | python |
<|fim_suffix|> "architectures": ["Qwen3ASRForcedAlignerForTokenClassification"]
},
)
outputs = llm.encode(
[{"prompt": prompt, "multi_modal_data": {"audio": audio}}],
pooling_task="token_classify",
)
"""
is_pooling_model = True
# Map thinker... | fim | vllm-project/vllm | python |
<|fim_suffix|>_pad_id],
is_embed=None,
)
return expanded_ids, {"audio": [features_info]}
# NOTE: A separate model class is required here because the multimodal
# processor registry binds one processor per model class. The realtime
# endpoint needs a different processor (Qwen3ASRRealtimeMul... | 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.functional as F
from torch import nn
from transformers import Qwen3Config
from vllm import _custom_ops as ops
from vllm.compilatio... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
# Copyright 2024 The Qwen 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|>f self.layer_type == "linear_attention":
self.linear_attn = QwenGatedDeltaNetAttention(
config,
vllm_config=vllm_config,
prefix=f"{prefix}.linear_attn",
gqa_interleaved_layout=True,
)
elif self.layer_type == "f... | fim | vllm-project/vllm | python |
<|fim_suffix|>d)
is_fse = rocm_aiter_ops.is_fusion_moe_shared_experts_enabled()
num_experts = self.config.num_experts
if is_fse:
num_experts += 1
expert_params_mapping = fused_moe_make_expert_params_mapping(
self,
ckpt_gate_proj_name="gate_proj",
... | fim | vllm-project/vllm | python |
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
# Copyright 2025 The Qwen 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-N... | fim | vllm-project/vllm | python |
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
# Copyright 2025 The vLLM team.
# Copyright 2025 The Qwen Team.
# Copyright 2025 The HuggingFace Inc. team.
# All rights reserved.
#
# This code is based on EleutherAI's GPT-NeoX library and the GPT-NeoX
# and OP... | fim | vllm-project/vllm | python |
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
# Copyright (c) 2023-2024, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentatio... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""
Whenever you add an architecture to this page, please also update
`tests/models/registry.py` with example HuggingFace models for it.
"""
import importlib
import importlib.util
import json
import... | fim | vllm-project/vllm | python |
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
#
# RNJ-1 model: Gemma3-based architecture with chunked (block-local) attention.
# Chunked attention restricts local layers to attend within aligned blocks,
# with lookback to one previous block.
fro... | fim | vllm-project/vllm | python |
<|fim_suffix|>weight_loader(param, loaded_weight)
@default_pooling_type(seq_pooling_type="CLS")
class RobertaForSequenceClassification(nn.Module, SupportsCrossEncoding):
"""A model that uses Roberta to provide embedding functionalities.
This class encapsulates the BertModel and provides an interface for
... | fim | vllm-project/vllm | python |
# 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 BaseDummyOptions
... | fim | vllm-project/vllm | python |
<|fim_suffix|> input_ids=input_ids,
positions=positions,
intermediate_tensors=intermediate_tensors,
inputs_embeds=inputs_embeds,
)
def compute_logits(
self,
hidden_states: torch.Tensor,
) -> torch.Tensor | None:
if not get_pp_group().is_... | fim | vllm-project/vllm | python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.