Fix: unfinished_sequences with correct device 
Author: Stxr
Pull request: yes

The original code was causing errors when running torch.jit.trace due to the tensor options being incorrect. I fixed this by using torch.ones to create a tensor with the correct device and dtype. This should resolve the issue with running torch.jit.trace.

# What does this PR do?
This PR fixes a bug that causes errors when running torch.jit.trace in transformers.


<!--
Congratulations! You've made it this far! You're not quite done yet though.

Once merged, your PR is going to appear in the release notes with the title you set, so make sure it's a great title that fully reflects the extent of your awesome contribution.

Then, please replace this with a description of the change and which issue is fixed (if applicable). Please also include relevant motivation and context. List any dependencies (if any) that are required for this change.

Once you're done, someone will review your PR shortly (see the section "Who can review?" below to tag some potential reviewers). They may suggest changes to make the code even better. If no one reviewed your PR after a week has passed, don't hesitate to post a new comment @-mentioning the same persons---sometimes notifications get lost.
-->

<!-- Remove if not applicable -->



## Before submitting
- [x] This PR fixes a bug.
- [x] I read the contributor guideline.
- [ ] This was discussed in issue # (insert issue number here).
- [ ] I updated the documentation.
- [ ] I wrote new tests.


## Who can review?

Please tag @ArthurZucker and @younesbelkada for text models review.

<!-- Your PR will be replied to more quickly if you can figure out the right person to tag with @

 If you know how to use git blame, that is the easiest way, otherwise, here is a rough guide of **who to tag**.
 Please tag fewer than 3 people.

Models:

- text models: @ArthurZucker and @younesbelkada
- vision models: @amyeroberts
- speech models: @sanchit-gandhi
- graph models: @clefourrier

Library:

- flax: @sanchit-gandhi
- generate: @gante
- pipelines: @Narsil
- tensorflow: @gante and @Rocketknight1
- tokenizers: @ArthurZucker
- trainer: @sgugger

Integrations:

- deepspeed: HF Trainer: @stas00, Accelerate: @pacman100
- ray/raytune: @richardliaw, @amogkam

Documentation: @sgugger, @stevhliu and @MKhalusova

HF projects:

- accelerate: [different repo](https://github.com/huggingface/accelerate)
- datasets: [different repo](https://github.com/huggingface/datasets)
- diffusers: [different repo](https://github.com/huggingface/diffusers)
- rust tokenizers: [different repo](https://github.com/huggingface/tokenizers)

Maintained examples (not research project or legacy):

- Flax: @sanchit-gandhi
- PyTorch: @sgugger
- TensorFlow: @Rocketknight1

 -->


Comments:
cc @gante 

The following code will reproduce the error:
```python
import torch
from transformers import AutoTokenizer, AutoModel
device = 'cuda' if torch.cuda.is_available() else 'cpu'

class Wrapper(torch.nn.Module):
    """
    Wrapper for the model to be traced
    """
    def __init__(self):
        super().__init__()
        self.model = AutoModel.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True).half().to(device)
        self.tokenizer = AutoTokenizer.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True)

    def forward(self, input_ids):
        self.model.eval()
        input_ids = input_ids.to(device)
        gen_kwargs = {"max_length": 2048, "num_beams": 1, "do_sample": True, "top_p": 0.7,
                      "temperature": 0.95}
        outputs = self.model.generate(input_ids=input_ids, **gen_kwargs)
        return outputs[0, len(input_ids[0]) - 2:]

tokenizer = AutoTokenizer.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True)
query = "hello"
input = tokenizer([query], return_tensors="pt", padding=True)
model = Wrapper()
torch.jit.trace(model, (input.input_ids,)).save("chatglm-6b.pt")
```

_The documentation is not available anymore as the PR was closed or merged._

Interestingly, I don't see `.new()` on pytorch's docs. Good thing we're removing it :D