# Expected all tensors to be on the same device

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fexpected-all-tensors-to-be-on-the-same-device%2F17225%3E%5C
**Category:** Beginners\
**Created:** [April 26, 2022, 5:40pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fexpected-all-tensors-to-be-on-the-same-device%2F17225 "2022-04-26T17:40:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bkh6722](https://avatars.discourse-cdn.com/v4/letter/b/a6a055/32.png) [@bkh6722](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fbkh6722)%5C
**Post date:** [April 26, 2022, 5:40pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fexpected-all-tensors-to-be-on-the-same-device%2F17225%2F1 "2022-04-26T17:40:43Z")

</div>

I am using hugging face library in order to fine tune recogniton for a local dialect. Before it was working very well, but since yesterday I am becoming error:

`RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cpu and cuda:0! (when checking argument for argument weight in method wrapper___slow_conv2d_forward)`

The model is downloaded from hugging face hub and I made sure, that all input data is on cuda:

 ![image](https://us1.discourse-cdn.com/hellohellohello/original/2X/7/710227e987329b01110486c4165464c273e5628e.jpeg)

From the screenshots above you may see, that all possible values are on cuda.

As a standard I also moved whole model to the cuda too:

```auto
from transformers import Wav2Vec2ForCTC

model_name = "jonatasgrosman/wav2vec2-large-xlsr-53-german"

model = Wav2Vec2ForCTC.from_pretrained(model_name).cuda()

```

In case of my runtime error I’d like to know what exactly is still on cpu and how possibly could I solve that problem 🥺

---

<div class="post-metadata">

**Author:** ![cog](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@cog](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fcog)%5C
**Post date:** [April 27, 2022, 8:45am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fexpected-all-tensors-to-be-on-the-same-device%2F17225%2F2 "2022-04-27T08:45:31Z")

</div>

Check {}.is.cuda return True or False.

---

<div class="post-metadata">

**Author:** ![BramVanroy](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/bramvanroy/32/47360_2.png) [@BramVanroy](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FBramVanroy)%5C
**Post date:** [April 27, 2022, 10:19am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fexpected-all-tensors-to-be-on-the-same-device%2F17225%2F3 "2022-04-27T10:19:04Z")

</div>

Is the model itself on GPU?

If you use the Trainer, you do not have to do any of these `.cuda` or `.to` classes manually: it does that for you.

---

<div class="post-metadata">

**Author:** ![marshmellow77](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/marshmellow77/32/3279_2.png) [@marshmellow77](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fmarshmellow77)%5C
**Post date:** [April 30, 2022, 4:18am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fexpected-all-tensors-to-be-on-the-same-device%2F17225%2F4 "2022-04-30T04:18:06Z")

</div>

Hi Bogdan

This is being addressed in this Github issue: [When running the Trainer cell, it found two devices (cuda:0 and CPU) · Issue #31 · nlp-with-transformers/notebooks · GitHub](https://github.com/nlp-with-transformers/notebooks/issues/31)

There is a propsed workaround in the thread, hope that helps.

Cheers  
Heiko
