    def _mm_on_the_fly(
        self,
        cmasks,
        vmasks,
        attention_mask
    ):
        """helper function for mask, seg_ids and token_type_ids."""
        if attention_mask is None:
            attention_mask = self._mm_attention_mask(cmasks, vmasks)

        """
        0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1
        | first sequence    | second sequence |
        """
        token_type_ids = torch.cat(
            [
                torch.zeros(
                    (vmasks.size(0), vmasks.size(1) + 2),
                    dtype=torch.long,
                    device=vmasks.device,
                ),
                torch.ones(
                    (cmasks.size(0), cmasks.size(1) - 2),
                    dtype=torch.long,
                    device=cmasks.device,
                ),
            ],
            dim=1,
        )
        return attention_mask, token_type_ids
helper function for mask, seg_ids and token_type_ids.
examples/MMPT/mmpt/models/mmfusion.py