# \[TRL\] Disable MPS Backend for testing

**URL:** <https://discuss.huggingface.co/t/trl-disable-mps-backend-for-testing/95681>\
**Category:** Intermediate\
**Created:** [July 5, 2024, 9:48am UTC](https://discuss.huggingface.co/t/trl-disable-mps-backend-for-testing/95681 "2024-07-05T09:48:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Agnellino](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/agnellino/32/29000_2.png) [@Agnellino](https://discuss.huggingface.co/u/Agnellino)\
**Post date:** [July 5, 2024, 9:48am UTC](https://discuss.huggingface.co/t/trl-disable-mps-backend-for-testing/95681/1 "2024-07-05T09:48:44Z")

</div>

Hello dears,

I’d like to contribute to [TRL](https://github.com/huggingface/trl) , and to do it properly I need to run the test pyramid.

I encounter the following problem in the tests:

- The models are instantiated on CPU
- The dataset batches are located on MPS

This is explained as the default behaviour of DataLoader is to reach for CUDA or MPS devices, and my MacBook has the latter one available.

Therefore, **I need to find a way, to disable globally the use of MPS for the time of the tests.**

I know that for CUDA I could play with the variable CUDA\_VISIBLE\_DEVICES, but I could not find such trick for MPS.

Any idea ? I saw that there was an issue closely related to that, but that is at stale for quite some time: [Input\_ids not automatically convert to device · Issue #502 · huggingface/trl · GitHub](https://github.com/huggingface/trl/issues/502)

Kind regards,

Tristan
