Skip to content

vllm.transformers_utils.configs.deepseek_vl2

DeepseekVLV2Config

Bases: PretrainedConfig

Source code in vllm/transformers_utils/configs/deepseek_vl2.py
class DeepseekVLV2Config(PretrainedConfig):
    model_type = "deepseek_vl_v2"
    vision_config: VisionEncoderConfig
    projector_config: MlpProjectorConfig

    tile_tag: str = "2D"
    global_view_pos: str = "head"
    candidate_resolutions: tuple[tuple[int, int]] = ((384, 384),)

    def __init__(
        self,
        tile_tag: str = "tile_tag",
        global_view_pos: str = "head",
        candidate_resolutions: tuple[tuple[int, int]] = ((384, 384),),
        **kwargs,
    ):
        super().__init__(**kwargs)

        vision_config = kwargs.get("vision_config", {})
        self.vision_config = VisionEncoderConfig(**vision_config)

        projector_config = kwargs.get("projector_config", {})
        self.projector_config = MlpProjectorConfig(**projector_config)

        language_config = kwargs.get("language_config", {})
        self.text_config = DeepseekV2Config(**language_config)

        self.tile_tag = tile_tag
        self.global_view_pos = global_view_pos
        self.candidate_resolutions = candidate_resolutions
        self.vocab_size = self.text_config.vocab_size

        # update model_type for OCR model
        if "DeepseekOCRForCausalLM" in (
            self.architectures or kwargs.get("architectures", [])
        ):
            self.model_type = "deepseek_ocr"

candidate_resolutions class-attribute instance-attribute

candidate_resolutions: tuple[tuple[int, int]] = (
    candidate_resolutions
)

global_view_pos class-attribute instance-attribute

global_view_pos: str = global_view_pos

model_type class-attribute instance-attribute

model_type = 'deepseek_vl_v2'

projector_config instance-attribute

projector_config: MlpProjectorConfig = MlpProjectorConfig(
    **projector_config
)

text_config instance-attribute

text_config = DeepseekV2Config(**language_config)

tile_tag class-attribute instance-attribute

tile_tag: str = tile_tag

vision_config instance-attribute

vision_config: VisionEncoderConfig = VisionEncoderConfig(
    **vision_config
)

vocab_size instance-attribute

vocab_size = vocab_size

__init__

__init__(
    tile_tag: str = "tile_tag",
    global_view_pos: str = "head",
    candidate_resolutions: tuple[tuple[int, int]] = (
        (384, 384),
    ),
    **kwargs,
)
Source code in vllm/transformers_utils/configs/deepseek_vl2.py
def __init__(
    self,
    tile_tag: str = "tile_tag",
    global_view_pos: str = "head",
    candidate_resolutions: tuple[tuple[int, int]] = ((384, 384),),
    **kwargs,
):
    super().__init__(**kwargs)

    vision_config = kwargs.get("vision_config", {})
    self.vision_config = VisionEncoderConfig(**vision_config)

    projector_config = kwargs.get("projector_config", {})
    self.projector_config = MlpProjectorConfig(**projector_config)

    language_config = kwargs.get("language_config", {})
    self.text_config = DeepseekV2Config(**language_config)

    self.tile_tag = tile_tag
    self.global_view_pos = global_view_pos
    self.candidate_resolutions = candidate_resolutions
    self.vocab_size = self.text_config.vocab_size

    # update model_type for OCR model
    if "DeepseekOCRForCausalLM" in (
        self.architectures or kwargs.get("architectures", [])
    ):
        self.model_type = "deepseek_ocr"

MlpProjectorConfig

Bases: PretrainedConfig

Source code in vllm/transformers_utils/configs/deepseek_vl2.py
class MlpProjectorConfig(PretrainedConfig):
    model_type = "mlp_projector"
    projector_type: str = "downsample_mlp_gelu"
    input_dim: int = 1152
    n_embed: int = 2048
    depth: int = 2
    mlp_ratio: int = 1
    downsample_ratio: int = 2
    token_pooling: bool = False

    def __init__(
        self,
        projector_type: str = "downsample_mlp_gelu",
        input_dim: int = 1152,
        n_embed: int = 2048,
        depth: int = 2,
        mlp_ratio: int = 1,
        downsample_ratio: int = 2,
        **kwargs,
    ):
        self.projector_type = projector_type
        self.input_dim = input_dim
        self.n_embed = n_embed
        self.depth = depth
        self.mlp_ratio = mlp_ratio
        self.downsample_ratio = downsample_ratio

        super().__init__(**kwargs)

depth class-attribute instance-attribute

depth: int = depth

downsample_ratio class-attribute instance-attribute

downsample_ratio: int = downsample_ratio

input_dim class-attribute instance-attribute

input_dim: int = input_dim

mlp_ratio class-attribute instance-attribute

mlp_ratio: int = mlp_ratio

model_type class-attribute instance-attribute

model_type = 'mlp_projector'

n_embed class-attribute instance-attribute

n_embed: int = n_embed

projector_type class-attribute instance-attribute

projector_type: str = projector_type

token_pooling class-attribute instance-attribute

token_pooling: bool = False

__init__

__init__(
    projector_type: str = "downsample_mlp_gelu",
    input_dim: int = 1152,
    n_embed: int = 2048,
    depth: int = 2,
    mlp_ratio: int = 1,
    downsample_ratio: int = 2,
    **kwargs,
)
Source code in vllm/transformers_utils/configs/deepseek_vl2.py
def __init__(
    self,
    projector_type: str = "downsample_mlp_gelu",
    input_dim: int = 1152,
    n_embed: int = 2048,
    depth: int = 2,
    mlp_ratio: int = 1,
    downsample_ratio: int = 2,
    **kwargs,
):
    self.projector_type = projector_type
    self.input_dim = input_dim
    self.n_embed = n_embed
    self.depth = depth
    self.mlp_ratio = mlp_ratio
    self.downsample_ratio = downsample_ratio

    super().__init__(**kwargs)

VisionEncoderConfig

Bases: PretrainedConfig

Source code in vllm/transformers_utils/configs/deepseek_vl2.py
class VisionEncoderConfig(PretrainedConfig):
    model_type: str = "vision"

    model_name: str = "vit_so400m_patch14_siglip_384.webli"
    image_size: int = 384
    patch_size: int = 16
    width: int = 1024
    layers: int = 24
    heads: int = 16
    mlp_ratio: int = 4
    global_pool: str = "map"
    ignore_head: bool = True
    class_token: bool = False
    num_classes: int = 0
    use_checkpoint: bool = False
    weight_init: str = "skip"
    deterministic: bool = False
    num_recomputing_layers: int = 0

    def __init__(
        self,
        model_name: str = "vit_so400m_patch14_siglip_384.webli",
        image_size: int = 384,
        patch_size: int = 16,
        width: int = 1024,
        layers: int = 24,
        heads: int = 16,
        mlp_ratio: int = 4,
        global_pool: str = "map",
        ignore_head: bool = True,
        class_token: bool = False,
        num_classes: int = 0,
        use_checkpoint: bool = False,
        **kwargs,
    ):
        self.model_name = model_name
        self.image_size = image_size
        self.patch_size = patch_size
        self.width = width
        self.layers = layers
        self.heads = heads
        self.mlp_ratio = mlp_ratio
        self.global_pool = global_pool
        self.ignore_head = ignore_head
        self.class_token = class_token
        self.num_classes = num_classes
        self.use_checkpoint = use_checkpoint

        super().__init__(**kwargs)

class_token class-attribute instance-attribute

class_token: bool = class_token

deterministic class-attribute instance-attribute

deterministic: bool = False

global_pool class-attribute instance-attribute

global_pool: str = global_pool

heads class-attribute instance-attribute

heads: int = heads

ignore_head class-attribute instance-attribute

ignore_head: bool = ignore_head

image_size class-attribute instance-attribute

image_size: int = image_size

layers class-attribute instance-attribute

layers: int = layers

mlp_ratio class-attribute instance-attribute

mlp_ratio: int = mlp_ratio

model_name class-attribute instance-attribute

model_name: str = model_name

model_type class-attribute instance-attribute

model_type: str = 'vision'

num_classes class-attribute instance-attribute

num_classes: int = num_classes

num_recomputing_layers class-attribute instance-attribute

num_recomputing_layers: int = 0

patch_size class-attribute instance-attribute

patch_size: int = patch_size

use_checkpoint class-attribute instance-attribute

use_checkpoint: bool = use_checkpoint

weight_init class-attribute instance-attribute

weight_init: str = 'skip'

width class-attribute instance-attribute

width: int = width

__init__

__init__(
    model_name: str = "vit_so400m_patch14_siglip_384.webli",
    image_size: int = 384,
    patch_size: int = 16,
    width: int = 1024,
    layers: int = 24,
    heads: int = 16,
    mlp_ratio: int = 4,
    global_pool: str = "map",
    ignore_head: bool = True,
    class_token: bool = False,
    num_classes: int = 0,
    use_checkpoint: bool = False,
    **kwargs,
)
Source code in vllm/transformers_utils/configs/deepseek_vl2.py
def __init__(
    self,
    model_name: str = "vit_so400m_patch14_siglip_384.webli",
    image_size: int = 384,
    patch_size: int = 16,
    width: int = 1024,
    layers: int = 24,
    heads: int = 16,
    mlp_ratio: int = 4,
    global_pool: str = "map",
    ignore_head: bool = True,
    class_token: bool = False,
    num_classes: int = 0,
    use_checkpoint: bool = False,
    **kwargs,
):
    self.model_name = model_name
    self.image_size = image_size
    self.patch_size = patch_size
    self.width = width
    self.layers = layers
    self.heads = heads
    self.mlp_ratio = mlp_ratio
    self.global_pool = global_pool
    self.ignore_head = ignore_head
    self.class_token = class_token
    self.num_classes = num_classes
    self.use_checkpoint = use_checkpoint

    super().__init__(**kwargs)