Trainer doesn't run `compute_metrics` when a `torch.compile` model is passed.
### System Info

- `transformers` version: 4.28.1
- Platform: Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.31
- Python version: 3.10.8
- Huggingface_hub version: 0.12.1
- Safetensors version: not installed
- PyTorch version (GPU?): 2.0.0+cu117 (True)
- Tensorflow version (GPU?): not installed (NA)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using GPU in script?: Yes
- Using distributed or parallel set-up in script?: No

### Who can help?

@sgugger

### 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

Run training with evaluation that has a `compute_metrics` function defined.

When passing the model to `Trainer`, pass a `torch.compile()` wrapped model.

In `Trainer.__init__()` there's the line `default_label_names = find_labels(self.model.__class__)` but the model class is `torch._dynamo.eval_frame.OptimizedModule` so no labels are assigned and this has the side effect of `compute_metrics` not being run.

It would be great if this checked for this case and got the correct model, or just threw a warning. I'm guessing lots of people are going to come across this as Torch 2.0 gains traction.

I only realised _after_ chasing down the cause of evaluation not running that I can pass `torch_compile=True`, so this bug no longer affects me.

### Expected behavior

Works the same as passing a non-wrapped model.
Another thing I just discovered, it also doesn't complete `save_pretrained()` correctly. Is saves _something_, but there isn't a `config.json` file in there. I'm guessing it's the line in `_save()` starting with `if not isinstance(self.model, PreTrainedModel)...`

Again, I know now I can do `torch_compile`, but I reckon this is going to sting lots of users as they try to pass in a compile model with the understanding that it "just works" without any code changes.<|||||>You shouldn't pass a `torch.compile`-d model to the Trainer, but let the Trainer do the compilation itself.<|||||>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.