nemo_automodel.components.datasets.multimodal.utils
nemo_automodel.components.datasets.multimodal.utils
Data utilities: tokenization, patchify, position IDs, attention masks.
Module Contents
Functions
API
Add BAGEL’s four special tokens to a Qwen2 tokenizer and return the ids.
Returns:
tuple (tokenizer, new_token_ids, num_new_tokens) where
Return flattened 2D patch position IDs by direct grid extrapolation.
Return flattened 2D patch position IDs by interpolating to the max grid.
Convert a sequence length into BAGEL’s per-sample loss weight.
Patchify a CxHxW image tensor into (H/p * W/p, ppC).
Convert a PIL image to RGB, compositing transparent pixels on white.
Build a per-sample additive float mask honoring causal / full / noise splits.
Split an integer into random positive chunks with optional exponential decay.