# RuntimeError: Expected all tensors to be on the same device, but found at least two devices

**URL:** <https://discuss.huggingface.co/t/runtimeerror-expected-all-tensors-to-be-on-the-same-device-but-found-at-least-two-devices/128546>\
**Category:** Beginners\
**Created:** [November 30, 2024, 8:29am UTC](https://discuss.huggingface.co/t/runtimeerror-expected-all-tensors-to-be-on-the-same-device-but-found-at-least-two-devices/128546 "2024-11-30T08:29:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![FrancescoPeriti](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/francescoperiti/32/36722_2.png) [@FrancescoPeriti](https://discuss.huggingface.co/u/FrancescoPeriti)\
**Post date:** [November 30, 2024, 8:29am UTC](https://discuss.huggingface.co/t/runtimeerror-expected-all-tensors-to-be-on-the-same-device-but-found-at-least-two-devices/128546/1 "2024-11-30T08:29:26Z")

</div>

I want to use 4 GPUs for training. I load the model with `device_map='auto'`. I also prepare the model with `accelerator.prepare_model(model, device_placement=True)`. What am I doing wrong?
