Use MPS trained model on Windows

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

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

This is the error I’m having:

But on macos it works just fine

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.

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.

1 Like

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