def _get_inputs_dict(self, batch):
    device = self.device
    if (self.args.model_type in ['bart', 'marian']):
        pad_token_id = self.encoder_tokenizer.pad_token_id
        (source_ids, source_mask, y) = (batch['source_ids'], batch['source_mask'], batch['target_ids'])
        y_ids = y[:, :(- 1)].contiguous()
        lm_labels = y[:, 1:].clone()
        lm_labels[(y[:, 1:] == pad_token_id)] = (- 100)
        inputs = {'input_ids': source_ids.to(device), 'attention_mask': source_mask.to(device), 'decoder_input_ids': y_ids.to(device), 'lm_labels': lm_labels.to(device)}
    else:
        lm_labels = batch[1]
        lm_labels_masked = lm_labels.clone()
        lm_labels_masked[(lm_labels_masked == self.decoder_tokenizer.pad_token_id)] = (- 100)
        inputs = {'input_ids': batch[0].to(device), 'decoder_input_ids': lm_labels.to(device), 'labels': lm_labels_masked.to(device)}
    return inputs
def _get_inputs_dict(self, batch):
    device = self.device
    if (self.args.model_type in ['bart', 'marian']):
        pad_token_id = self.encoder_tokenizer.pad_token_id
        (source_ids, source_mask, y) = (batch['source_ids'], batch['source_mask'], batch['target_ids'])
        y_ids = y[:, :(- 1)].contiguous()
        lm_labels = y[:, 1:].clone()
        lm_labels[(y[:, 1:] == pad_token_id)] = (- 100)
        inputs = {'input_ids': source_ids.to(device), 'attention_mask': source_mask.to(device), 'decoder_input_ids': y_ids.to(device), 'lm_labels': lm_labels.to(device)}
    else:
        lm_labels = batch[1]
        lm_labels_masked = lm_labels.clone()
        lm_labels_masked[(lm_labels_masked == self.decoder_tokenizer.pad_token_id)] = (- 100)
        inputs = {'input_ids': batch[0].to(device), 'decoder_input_ids': lm_labels.to(device), 'labels': lm_labels_masked.to(device)}
    return inputs