def get_inputs(batch, device, model_name, train_mode=True):
        """
        Creates an input dictionary given a model name.

        Args:
            batch (tuple): A tuple containing input ids, attention mask,
                segment ids, and labels tensors.
            device (torch.device): A PyTorch device.
            model_name (bool, optional): Model name used to format the inputs.
            train_mode (bool, optional): Training mode flag.
                Defaults to True.

        Returns:
            dict: Dictionary containing input ids, segment ids, masks, and labels.
                Labels are only returned when train_mode is True.
        """
        batch = tuple(t.to(device) for t in batch)
        model_type = model_name.split("-")[0]

        inputs = {"input_ids": batch[0], "attention_mask": batch[1]}

        if train_mode:
            inputs.update({"start_positions": batch[3], "end_positions": batch[4]})

        if model_type not in ["distilbert"]:
            inputs.update({"token_type_ids": batch[2]})

        if model_type in ["xlnet"]:
            if train_mode:
                inputs.update({"cls_index": batch[5], "p_mask": batch[6]})
            else:
                inputs.update({"cls_index": batch[3], "p_mask": batch[4]})

        return inputs

        Creates an input dictionary given a model name.

        Args:
            batch (tuple): A tuple containing input ids, attention mask,
                segment ids, and labels tensors.
            device (torch.device): A PyTorch device.
            model_name (bool, optional): Model name used to format the inputs.
            train_mode (bool, optional): Training mode flag.
                Defaults to True.

        Returns:
            dict: Dictionary containing input ids, segment ids, masks, and labels.
                Labels are only returned when train_mode is True.
        
utils_nlp/models/transformers/question_answering.py