RuntimeError: Placeholder storage has not been allocated on MPS device!

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.

Any help is appreciated!

1 Like

training_args = TrainingArguments(output_dir="test_trainer", use_mps_device=True)

Fixed the problem for me.

5 Likes

I have tried this before, but the model outputs a bunch of errors.

Any help on this?

Thanks! this worked for me as well. I think it has an issue with the pytorch nightly build for apple silicon

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.

Where this goes?

1 Like

I’m having exact same problem but - while running ControlNet via Automatic11111, I wish I knew where to add this line