bridge.models.glm_vl.data.collate_fn#

GLM VL collator implementations.

Module Contents#

Functions#

glm4v_collate_fn

Collate function for GLM-4.5V model.

API#

bridge.models.glm_vl.data.collate_fn.glm4v_collate_fn(
examples: list,
processor,
*,
visual_keys: object = None,
min_pixels: int | None = None,
max_pixels: int | None = None,
sequence_length: int | None = None,
pad_to_max_length: bool = False,
pad_to_multiple_of: int = 128,
enable_in_batch_packing: bool = False,
in_batch_packing_pad_to_multiple_of: int = 1,
) dict[str, torch.Tensor]#

Collate function for GLM-4.5V model.

GLM-4.5V requires mm_token_type_ids to distinguish image (1) and video (2) tokens from text (0) when computing 3D MRoPE positions. The processor returns this field by default (return_mm_token_type_ids=True in Glm4vProcessor defaults). We wrap all visual tensors — including mm_token_type_ids — in

Class:

GenericVisualInputs so they flow through vlm_step.py to the model.