def METHOD_NAME(self, data: Dict[str, Any]) -> Dict[str, Any]:
    r"""
    build sample for training tasks.
    step 1. execute the `_build_infer_sample` function to get a batch sample
        for inference.
    step 2. process the label data for training.
    """
    sample = self._build_infer_sample(data)
    target = sample['label']
    target_token_list = target.lower().strip().split()
    target = ' '.join(target_token_list[:self.max_tgt_length])
    sample['target'] = self.tokenize_text(target, add_bos=False)
    sample['prev_output_tokens'] = torch.cat(
        [self.bos_item, sample['target'][:-1]])
    return sample