# Use MPS trained model on Windows

**URL:** <https://discuss.pytorch.org/t/use-mps-trained-model-on-windows/189840>\
**Category:** mps\
**Created:** [October 12, 2023, 4:48pm UTC](https://discuss.pytorch.org/t/use-mps-trained-model-on-windows/189840 "2023-10-12T16:48:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![MidKnightXI](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/midknightxi/32/64567_2.png) [@MidKnightXI](https://discuss.pytorch.org/u/MidKnightXI)\
**Post date:** [October 12, 2023, 4:48pm UTC](https://discuss.pytorch.org/t/use-mps-trained-model-on-windows/189840/1 "2023-10-12T16:48:28Z")

</div>

Hello I trained a model with MPS on my M1 Pro but I cannot use it on Windows or Linux machines using x64 processors.

I was wondering if that was possible in general to do that, because I need to distribute it to these types of machines and my macbook is the most powerful machine I have currently and training it on the CPU is taking me way too much time to make it worth doing it.

I am a beginner in AI and don’t know really much about pytorch, sorry about my ignorance.

For more informations about my project, here is the link to the code I’m using to train the model: [https://github.com/MidKnightXI/BlurWarp/blob/main/trainer.py](https://github.com/MidKnightXI/BlurWarp/blob/main/trainer.py)

---

<div class="post-metadata">

**Author:** ![ptrblck](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ptrblck/32/1823_2.png) [@ptrblck](https://discuss.pytorch.org/u/ptrblck)\
**Post date:** [October 12, 2023, 7:57pm UTC](https://discuss.pytorch.org/t/use-mps-trained-model-on-windows/189840/2 "2023-10-12T19:57:45Z")

</div>

Why can’t you use the `state_dict` on other systems? Do you see any specific error messages?

---

<div class="post-metadata">

**Author:** ![MidKnightXI](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/midknightxi/32/64567_2.png) [@MidKnightXI](https://discuss.pytorch.org/u/MidKnightXI)\
**Post date:** [October 14, 2023, 10:17am UTC](https://discuss.pytorch.org/t/use-mps-trained-model-on-windows/189840/4 "2023-10-14T10:17:27Z")

</div>

This is the error I’m having:

 ![image](https://discuss.pytorch.org/uploads/default/original/3X/a/3/a36cc4fb4f561efeff1f60555aaf79c3ff3a56fd.png)

But on macos it works just fine

---

<div class="post-metadata">

**Author:** ![KMT62](https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/k/e9bcb4/32.png) [@KMT62](https://discuss.pytorch.org/u/KMT62)\
**Post date:** [October 19, 2023, 8:51pm UTC](https://discuss.pytorch.org/t/use-mps-trained-model-on-windows/189840/5 "2023-10-19T20:51:17Z")

</div>

device=“mps” is Apple-only (metal). You’ll need to change your device to whatever you have on your PC, e.g. “cuda”, “xmp”, etc.

---

<div class="post-metadata">

**Author:** ![ptrblck](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ptrblck/32/1823_2.png) [@ptrblck](https://discuss.pytorch.org/u/ptrblck)\
**Post date:** [October 20, 2023, 2:23am UTC](https://discuss.pytorch.org/t/use-mps-trained-model-on-windows/189840/6 "2023-10-20T02:23:43Z")

</div>

As @KMT62 pointed out it seems the device is stored in the actual data. Try to use `map_location="cpu"` in the `torch.load` operation or move your model to the CPU before saving its `state_dict`.

---

<div class="post-metadata">

**Author:** ![MidKnightXI](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/midknightxi/32/64567_2.png) [@MidKnightXI](https://discuss.pytorch.org/u/MidKnightXI)\
**Post date:** [October 28, 2023, 10:49am UTC](https://discuss.pytorch.org/t/use-mps-trained-model-on-windows/189840/7 "2023-10-28T10:49:03Z")

</div>

Sorry if I wasn’t clear but I already know that, I just want to know if it is possible to train via the metal API and then make it compatible with other devices when saving the model
