main
py 57 lines 1.74 KB
Raw
1 # SPDX-License-Identifier: Apache-2.0
2 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3 """ColQwen3 configuration that extends Qwen3VLConfig with embedding projection
4 fields. This allows ColQwen3 models to be loaded without trust_remote_code
5 by mapping their custom model_type (colqwen3, ops_colqwen3, etc.) to a
6 standard config class that vLLM understands.
7
8 Supported model_types:
9 - colqwen3 (TomoroAI/tomoro-colqwen3-embed-8b)
10 - ops_colqwen3 (OpenSearch-AI/Ops-Colqwen3-4B)
11 - qwen3_vl_nemotron_embed (nvidia/nemotron-colembed-vl-8b-v2)
12 """
13
14 from transformers.models.qwen3_vl.configuration_qwen3_vl import Qwen3VLConfig
15
16
17 class ColQwen3Config(Qwen3VLConfig):
18 """Configuration class for ColQwen3 models.
19
20 Extends Qwen3VLConfig with additional fields used by ColQwen3 variants
21 for the embedding projection layer.
22 """
23
24 # Accept any ColQwen3 variant model_type
25 model_type = "colqwen3"
26
27 def __init__(
28 self,
29 embed_dim: int | None = None,
30 dims: int | None = None,
31 dim: int | None = None,
32 projection_dim: int | None = None,
33 colbert_dim: int | None = None,
34 pooling: str | None = None,
35 **kwargs,
36 ):
37 # Store embedding projection config fields
38 self.embed_dim = embed_dim
39 self.dims = dims
40 self.dim = dim
41 self.projection_dim = projection_dim
42 self.colbert_dim = colbert_dim
43 self.pooling = pooling
44
45 super().__init__(**kwargs)
46
47
48 class OpsColQwen3Config(ColQwen3Config):
49 """Configuration for OpenSearch-AI ColQwen3 variants."""
50
51 model_type = "ops_colqwen3"
52
53
54 class Qwen3VLNemotronEmbedConfig(ColQwen3Config):
55 """Configuration for NVIDIA Nemotron ColEmbed variants."""
56
57 model_type = "qwen3_vl_nemotron_embed"