[`SAM`] Fix sam slow test
# What does this PR do?

Fixes SAM slow test, link to failing job: https://github.com/huggingface/transformers/actions/runs/5206799863

* Why this fix is relevant? 

Before the PR, it seems I was initalizing the pipeline in the wrong way. Passing a string to `device` argument of pipeline leads to an error. To reproduce:
```python
from transformers import pipeline

pipe = pipeline("text-generation", device="cuda")
pipe("Hello")
>>> ValueError: Expected a torch.device with a specified index or an integer, but got:cuda
```
That is yield here: https://github.com/huggingface/transformers/blob/847b47c0eed4e6ab904f584fb415e3d3a397867f/src/transformers/pipelines/base.py#L905 

Whereas the typehint of pipeline says: https://github.com/huggingface/transformers/blob/847b47c0eed4e6ab904f584fb415e3d3a397867f/src/transformers/pipelines/base.py#L763

The fix seems to be to pass an int for the device if cuda is available and -1 if not

cc @ydshieh 
_The documentation is not available anymore as the PR was closed or merged._<|||||>@younesbelkada Could you update the type hint for the pipeline too? 

nb: from pytorch it seems [we shouldn't use torch.cude.set_device()](https://pytorch.org/docs/stable/generated/torch.cuda.set_device.html) cc @Narsil <|||||>Sure yes just updated it, we probably need also to address a proper fix for that in a separate PR, not sure though <|||||>Code is from 3 years ago (and I'm pretty sure I just moved it from somewhere else).

Happy to refactor to something more up-to-date. Accepting `strings` as device should be supported imo.<|||||>@Narsil I also agree we should support str for pipeline, let me know if you want me to work on this, I am happy to have a look and ping you once something is ready