why need  slice outputs tensor in prediction_step function in Trainer
Author: hanguangmic
Pull request: no
Labels: name: bug

### System Info

Hi Staffs
when I used Trainer to finetune my model, during the evaluation preprcess, I found a little problems in predtion_step function,
the outputs  which is generated from self.compute_loss reference as following 
https://github.com/huggingface/transformers/blob/v4.10.0/src/transformers/trainer.py#L2432
it was sliced as logits = outputs[1:], I did not know why is operation is applied,if the output is already the result of model

my model code is as follow:


class Custom_Bert_Simple(nn.Module):
    def __init__(self):
        super().__init__()

        config = AutoConfig.from_pretrained(CFG.model_path)
        config.max_position_embeddings = CFG.max_position_embeddings
        config.num_labels = CFG.num_labels
        config.attention_probs_dropout_prob = 0
        config.hidden_dropout_prob = 0
        self.backbone = AutoModelForSequenceClassification.from_pretrained(CFG.model_path, config=config)

    def forward(self, input_ids, attention_mask, labels=None):
        base_output = self.backbone(input_ids=input_ids, attention_mask=attention_mask)

        output = base_output[0]
        if labels is None:
            return output

        else:
            return (nn.SmoothL1Loss()(output, labels), output)

my Trainer code is as following:

class CustomTrainer(Trainer):
    def compute_loss(self, model, inputs, return_outputs=False):
        # forward pass
        loss, outputs = model(**inputs)
        # compute custom loss (suppose one has 3 labels with different weights)
        return (loss, outputs) if return_outputs else loss

### Who can help?

_No response_

### Information

- [ ] The official example scripts
- [X] My own modified scripts

### Tasks

- [ ] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [X] My own task or dataset (give details below)

### Reproduction

my model code is as follow:


class Custom_Bert_Simple(nn.Module):
    def __init__(self):
        super().__init__()

        config = AutoConfig.from_pretrained(CFG.model_path)
        config.max_position_embeddings = CFG.max_position_embeddings
        config.num_labels = CFG.num_labels
        config.attention_probs_dropout_prob = 0
        config.hidden_dropout_prob = 0
        self.backbone = AutoModelForSequenceClassification.from_pretrained(CFG.model_path, config=config)

    def forward(self, input_ids, attention_mask, labels=None):
        base_output = self.backbone(input_ids=input_ids, attention_mask=attention_mask)

        output = base_output[0]
        if labels is None:
            return output

        else:
            return (nn.SmoothL1Loss()(output, labels), output)

my Trainer code is as following:

class CustomTrainer(Trainer):
    def compute_loss(self, model, inputs, return_outputs=False):
        # forward pass
        loss, outputs = model(**inputs)
        # compute custom loss (suppose one has 3 labels with different weights)
        return (loss, outputs) if return_outputs else loss

### Expected behavior

the output batch size will be one less than the predicted

Comments:
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md) are likely to be ignored.