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.

6 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

Would also really love some help resolving the same issue

using :

Automatic 1111 + ControlNet v1.1.410 + Lineart feature.

I have some understanding of editing code but not a programmer ( so please tell us where to paste the code a) which file - which directory etc - or is it a command via terminal?


The error appears when trying to generate an image from lineart __ ( ControlNet ) on a pertained model -

Mac: RuntimeError: Placeholder storage has not been allocated on MPS device __

Please explain in lamen terms - what piece of code needs to be replaced and where. I’ve seen other posts but they all relate to M1 Macs. If this issue has been resolved elsewhere for an Intel based Mac please share the link.

Thanks in Advance

1 Like

try edit COMMANDLINE_ARGS=“–skip-torch-cuda-test --no-half --use-cpu all” to COMMANDLINE_ARGS=“–skip-torch-cuda-test --no-half”

fixed it with: device=“mps”

Can someone please do a YouTube video on this? I’m using Pinokio controllnet is saying the same thing. “placeholder storage has not been allocated on mps device!”