I am trying to run the basic fine-tuning a pretrained model code from the huggingface page (Fine-tune a pretrained model) and am getting a runtime error:
RuntimeError: Placeholder storage has not been allocated on MPS device!
I know this is something to do with the device Pytorch is running on but I have no idea how to solve it.
This worked for me, too. I was finishing the tutorial series to work out the development environment for tomorrow’s work and hit that MPS issue. @pmoraes solution solved it.
Context:
Apple M1 MBP
PyTorch in a conda (MiniForge3) environment
It took nearly 9 minutes over three epochs, and I used the small training and test datasets. The eval loss dropped each epoch, and accuracy increased. It worked.