def __call__(self, features):
    labels = ([feature['labels'] for feature in features] if ('labels' in features[0].keys()) else None)
    if (labels is not None):
        max_label_length = max((len(l) for l in labels))
        padding_side = self.tokenizer.padding_side
        for feature in features:
            remainder = ([self.label_pad_token_id] * (max_label_length - len(feature['labels'])))
            feature['labels'] = ((feature['labels'] + remainder) if (padding_side == 'right') else (remainder + feature['labels']))
    features = self.tokenizer.pad(features, padding=self.padding, max_length=self.max_length, pad_to_multiple_of=self.pad_to_multiple_of, return_tensors='pt')
    if ((self.model is not None) and hasattr(self.model, 'prepare_decoder_input_ids_from_labels')):
        decoder_input_ids = self.model.prepare_decoder_input_ids_from_labels(labels=features['labels'])
        features['decoder_input_ids'] = decoder_input_ids
    return features
def __call__(self, features):
    labels = ([feature['labels'] for feature in features] if ('labels' in features[0].keys()) else None)
    if (labels is not None):
        max_label_length = max((len(l) for l in labels))
        padding_side = self.tokenizer.padding_side
        for feature in features:
            remainder = ([self.label_pad_token_id] * (max_label_length - len(feature['labels'])))
            feature['labels'] = ((feature['labels'] + remainder) if (padding_side == 'right') else (remainder + feature['labels']))
    features = self.tokenizer.pad(features, padding=self.padding, max_length=self.max_length, pad_to_multiple_of=self.pad_to_multiple_of, return_tensors='pt')
    if ((self.model is not None) and hasattr(self.model, 'prepare_decoder_input_ids_from_labels')):
        decoder_input_ids = self.model.prepare_decoder_input_ids_from_labels(labels=features['labels'])
        features['decoder_input_ids'] = decoder_input_ids
    return features