Skip to content

vllm.model_executor.models.glm4v

Inference-only CogAgent model compatible with THUDM weights.

Classes:

EVA2CLIPGLU

Bases: Module

Methods:

  • __init__ –

    The original implementation is the same as:

__init__(config, in_features, quant_config=None, prefix='')

The original implementation is the same as:

self.dense_h_to_4h = ColumnParallelLinear(
    config.hidden_size,
    config.ffn_hidden_size,
    bias=False,
    quant_config=quant_config,
)

self.gate_proj = ColumnParallelLinear(
    config.hidden_size,
    config.ffn_hidden_size,
    bias=False,
    quant_config=quant_config,
)
gate_proj_output, _ = self.gate_proj(x)
dense_h_to_4h_output, _ = self.dense_h_to_4h(x)
x = torch.cat([gate_proj_output, dense_h_to_4h_output], dim=-1)

We merge two ColumnParallelLinear into one MergedColumnParallelLinear:

self.merged_proj = MergedColumnParallelLinear(
    config.hidden_size,
    [config.ffn_hidden_size] * 2,
    bias=False,
    quant_config=quant_config,
)
x, _ = self.merged_proj(x)

EVA2CLIPModel

Bases: Module

Methods:

  • forward –

    Encode images into language-model embeddings.

forward(images)

Encode images into language-model embeddings.

Parameters:

  • images

    (Tensor) –

    Input image tensor with shape (B, C, H, W)

Returns:

  • Tensor –

    Transformed tensor with shape (B, L, D)

EVA2CLIPPatchEmbedding

Bases: Module

Methods:

  • forward –

    Embed image patches and prepend the class embedding.

forward(images)

Embed image patches and prepend the class embedding.

Parameters:

  • images

    (Tensor) –

    Input image tensor with shape (B, C, H, W)

Returns:

  • Tensor –

    Transformed tensor with shape (B, L, D)

GLM4VForCausalLM

Bases: ChatGLMBaseModel, SupportsMultiModal, SupportsLoRA, SupportsPP, SupportsMRoPE

Methods:

get_mm_mapping()

Get the module prefix in multimodal models.

GLMVImagePixelInputs

Bases: TensorSchema

Dimensions: - b: Batch size - c: Number of channels (3) - h: Height of image - w: Width of image