def preprocess_function(examples):
        """Tokenize text, preprocess images, and generate other relevant inputs for the model."""
        return processor(
            text=examples["text"],
            images=examples["image"],
            padding="max_length",
            truncation=True,
            max_length=1024,  # longer than for text-only b/c images require quite a few tokens
            return_tensors="pt",
        )
Tokenize text, preprocess images, and generate other relevant inputs for the model.
test/convergence/bf16/test_mini_models_multimodal.py