# Issue with scVI model device

**URL:** <https://discourse.scverse.org/t/issue-with-scvi-model-device/3520>\
**Category:** scvi-tools\
**Tags:** scvi\
**Created:** [February 28, 2025, 6:45am UTC](https://discourse.scverse.org/t/issue-with-scvi-model-device/3520 "2025-02-28T06:45:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Xicici-Yan](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.scverse.org/xicici-yan/32/1066_2.png) [@Xicici-Yan](https://discourse.scverse.org/u/Xicici-Yan)\
**Post date:** [February 28, 2025, 6:45am UTC](https://discourse.scverse.org/t/issue-with-scvi-model-device/3520/1 "2025-02-28T06:45:42Z")

</div>

Hi, all  
When training scVI models, I wanted to change the device used. So, I set vae.to\_device(‘cuda:1’) to use another gpu. However, it didn’t work as the warning info showed LOCALRNAK:0. How could I use other divices for training?

---

<div class="post-metadata">

**Author:** ![ori-kron-wis](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.scverse.org/ori-kron-wis/32/1099_2.png) [@ori-kron-wis](https://discourse.scverse.org/u/ori-kron-wis)\
**Post date:** [March 2, 2025, 2:02pm UTC](https://discourse.scverse.org/t/issue-with-scvi-model-device/3520/2 "2025-03-02T14:02:01Z")

</div>

Hi,

In the train function, you can specify the device id you wish to train the model on. For example:

```auto
model.train(
    max_epochs=100,
    train_size=0.5,
    check_val_every_n_epoch=1,
    accelerator="gpu",
    devices=[1],
    #strategy="ddp_find_unused_parameters_true", #for multiGPU
)

```

Will run it on gpu #1.

Regardless, in scvi-tools v1.3.0 we now have the option to train models in multiGPU (just use the strategy parameter like in the comment above, but then remove the devices), if that is relevant for you ,give it a try!

---

<div class="post-metadata">

**Author:** ![Xicici-Yan](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.scverse.org/xicici-yan/32/1066_2.png) [@Xicici-Yan](https://discourse.scverse.org/u/Xicici-Yan)\
**Post date:** [March 3, 2025, 5:18am UTC](https://discourse.scverse.org/t/issue-with-scvi-model-device/3520/3 "2025-03-03T05:18:05Z")

</div>

Thanks, it does work!
