'str' object has no attribute 'to'
Author: andysingal
Pull request: no

### System Info

Colab Notebook, T4

Colab Notebook: https://colab.research.google.com/drive/10JDBNsLlYrQdnI2FWfDK3F5M8wvVUDXG?usp=sharing

### Who can help?

@pacman100 @muellerz @younesbelkada 
 
### Information

- [X] The official example scripts
- [ ] My own modified scripts

### Tasks

- [ ] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [ ] My own task or dataset (give details below)

### Reproduction

```
import torch
from transformers import TrainingArguments, Trainer
model = "distilgpt2"
device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu")
training_args = TrainingArguments(
		  output_dir="test_trainer", 
		  evaluation_strategy="epoch",
		  report_to="wandb")

trainer = Trainer(
    model=model,
    args=training_args,
    train_dataset=small_train_dataset,
    eval_dataset=small_eval_dataset,
    compute_metrics=compute_metrics,
)
trainer.train()

```
ERROR
```
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
[<ipython-input-6-80c6086794e8>](https://localhost:8080/#) in <cell line: 10>()
      8 		  report_to="wandb")
      9 
---> 10 trainer = Trainer(
     11     model=model,
     12     args=training_args,

1 frames
[/usr/local/lib/python3.10/dist-packages/transformers/trainer.py](https://localhost:8080/#) in _move_model_to_device(self, model, device)
    688 
    689     def _move_model_to_device(self, model, device):
--> 690         model = model.to(device)
    691         # Moving a model to an XLA device disconnects the tied weights, so we have to retie them.
    692         if self.args.parallel_mode == ParallelMode.TPU and hasattr(model, "tie_weights"):

AttributeError: 'str' object has no attribute 'to'
```

### Expected behavior

run the model

Comments:
Hey, according to the documentation: 
>         model ([`PreTrainedModel`] or `torch.nn.Module`, *optional*):
            The model to train, evaluate or use for predictions. If not provided, a `model_init` must be passed.

you are passing a string. 

> Hey, according to the documentation:
> 
> > ```
> >     model ([`PreTrainedModel`] or `torch.nn.Module`, *optional*):
> > ```
> 
> ```
>         The model to train, evaluate or use for predictions. If not provided, a `model_init` must be passed.
> ```
> 
> you are passing a string.

Thanks, where can i add: https://colab.research.google.com/drive/10JDBNsLlYrQdnI2FWfDK3F5M8wvVUDXG?usp=sharing 

> > Hey, according to the documentation:
> > > ```
> > >     model ([`PreTrainedModel`] or `torch.nn.Module`, *optional*):
> > > ```
> > 
> > 
> > ```
> >         The model to train, evaluate or use for predictions. If not provided, a `model_init` must be passed.
> > ```
> > 
> > 
> >     
> >       
> >     
> > 
> >       
> >     
> > 
> >     
> >   
> > you are passing a string.
> 
> Thanks, where can i add: https://colab.research.google.com/drive/10JDBNsLlYrQdnI2FWfDK3F5M8wvVUDXG?usp=sharing

i added: ```
def model_init():
    return AutoModelForSequenceClassification.from_pretrained( 'distilgpt2', return_dict=True)```

but got error:
```
---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
[<ipython-input-10-856d04b69f6c>](https://localhost:8080/#) in <cell line: 18>()
     16     compute_metrics=compute_metrics,
     17 )
---> 18 trainer.train()

6 frames
[/usr/local/lib/python3.10/dist-packages/transformers/models/gpt2/modeling_gpt2.py](https://localhost:8080/#) in forward(self, input_ids, past_key_values, attention_mask, token_type_ids, position_ids, head_mask, inputs_embeds, labels, use_cache, output_attentions, output_hidden_states, return_dict)
   1446 
   1447         assert (
-> 1448             self.config.pad_token_id is not None or batch_size == 1
   1449         ), "Cannot handle batch sizes > 1 if no padding token is defined."
   1450         if self.config.pad_token_id is None:

AssertionError: Cannot handle batch sizes > 1 if no padding token is defined.
```
Colab: https://colab.research.google.com/drive/10JDBNsLlYrQdnI2FWfDK3F5M8wvVUDXG?usp=sharing 


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.