NoBadWordsLogitsProcessor banned_mask and indices not in same device
### System Info

transformers version: 4.29.2
Platform: Linux-6.1.22-aufs-1-x86_64-with-glibc2.31
Python version: 3.9.2
PyTorch version (GPU?): 2.0.1+cu117 (True)

### Who can help?

_No response_

### Information

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

### Tasks

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

### Reproduction


import torch
import transformers
from transformers import AutoModelForCausalLM, set_seed
from transformers import GenerationConfig, LogitsProcessorList, NoBadWordsLogitsProcessor


set_seed(0)
torch.set_default_device("cuda")
model_name_or_path = 'facebook/opt-125m'

model = AutoModelForCausalLM.from_pretrained(model_name_or_path, device_map='auto')
tokenizer = transformers.AutoTokenizer.from_pretrained(model_name_or_path, add_prefix_space=True)

human = 'give me a sentence, more than 20 words, containing word pig'
input_ids = tokenizer(human, return_tensors='pt').input_ids
input_ids = input_ids.to('cuda')
bad_words = ['pigs', 'piggy', 'pig', 'piggies', 'piggish']
bad_words_ids = [tokenizer(bad_word, add_special_tokens=False).input_ids for bad_word in bad_words]
processor = LogitsProcessorList([NoBadWordsLogitsProcessor(bad_words_ids=bad_words_ids, eos_token_id=model.config.eos_token_id)])
generation_config = GenerationConfig.from_pretrained(model_name_or_path, max_length=100, do_sample=True)
outputs = model.generate(input_ids, generation_config=generation_config, logits_processor=processor)

output_str = tokenizer.decode(outputs[0],  skip_special_tokens=True)
print(output_str)

### Expected behavior

run success
the reason is pytorch default device
```python
import torch

torch.set_default_device("cuda")
print(torch.cuda.is_available())

banned_mask = torch.LongTensor([0, 1, 2])
indices = torch.ones(len(banned_mask))

print(f"banned_mask.device: {banned_mask.device}")
print(f"indices.device: {indices.device}")
```
![image](https://github.com/huggingface/transformers/assets/45619430/389aca59-98c4-4d93-bcaf-434f4cca95b9)

