def METHOD_NAME(self, data: Dict[str, Any]) -> Dict[str, Any]:
    r"""
    Building training samples.
    step 1. Preprocess the data using the logic of `_build_infer_sample`
        and make sure the label data in the result.
    step 2. Preprocess the label data. Contains:
        - Get the lower case of label, and using `pre_caption` function
        to do the str preprocessing as new input label.
        - Tokenize the new input label as `target` for model input.
        - Add noise to the `target`
        - Calculate the `prev_output_tokens` from noise `target` for model input.
    Args:
        data (`Dict[str, Any]`): Input data, should contains the key of `image`, `prompt` and
            `label`, `image` refers the image input data, `prompt` refers the text input data
            and the `label` is the supervised data for training.
    Return:
        A dict object, contains source, image, mask, label, target tokens,
        and previous output tokens data.
    """
    sample = self._build_infer_sample(data)
    target_str = sample['label'].lower()
    target = super().pre_caption(target_str, max_words=self.max_tgt_length)
    target = target.replace('[unk]', 'unk').replace('<unk>', 'unk')
    sample['target'] = self.tokenize_text(target, add_bos=False)
    noise_target_item = self.add_noise_to_tgt(
        sample['target'][:-1].clone())
    sample['prev_output_tokens'] = torch.cat(
        [self.bos_item, noise_target_item])
    return sample