Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On MAC : MPS Backend out of Memory problem #1489

Open
Noxnoxgelida opened this issue Dec 15, 2024 · 3 comments
Open

On MAC : MPS Backend out of Memory problem #1489

Noxnoxgelida opened this issue Dec 15, 2024 · 3 comments

Comments

@Noxnoxgelida
Copy link

Noxnoxgelida commented Dec 15, 2024

Hi !
I have this problem when trying to render an image:
IMG_7089

I previously read that I had to write this codes: export PYTORCH_MPS_WATERMARK_RATIO=0.0
unset PYTORCH_MPS_WATERMARK_RATIO

I did it, but nothing changes. I know I must be in a wrong folder maybe....

By the way, the images I am generating are being made simultaneously on a Mac mini M4 pro 24 GB Ram and with a PC Nvidia 1660. The PC goes brilliant... So I think the Mac is a little more powerful... Thaks :)

@LeF0URBE
Copy link

i never used a MAC but to me reading "MPS backend out of memory..." is the same as reading "CUDA out of memory ...".
basically you are asking a task that consume too much system memory. so you have to look at the memory that your system use before you run a generation.
make sure to free up your memory for Stable diffusion and krita. (close any 3D software/games/web browser software)

about export PYTORCH_MPS_WATERMARK_RATIO=0.0 mentionned here (https://openprompt.co/conversations/4378)
i wouldn't try that first !
"that it may cause system instability or crashes if the system runs out of memory completely"
and from the PC experience and your error THAT will happen.

@Noxnoxgelida
Copy link
Author

@LeF0URBE
Exactly, I think it's a similar problem. Macs use a single shared memory for both the system and VRam, I have 24 GB and I've seen that the system with Krita running only takes up around 8GB and 16 GB are free. When I run the render, it takes up the whole memory.

Now, I have my old PC next to it that only has the 1660 Nvidia with 6GB of VRam, both make the same image and the Mac has this error and the PC manages to do it.

That's what I don't understand :(

@Acly
Copy link
Owner

Acly commented Dec 16, 2024

Don't know anything about Mac either, but I don't think it's too surprising:

  • Nvidia (CUDA) is by far the best optimized way to run it, so it usually requires less RAM
  • 24 GB shared RAM is not actually a lot
  • 6 GB VRAM 1660 is certainly at the limit, but may barely fit by swapping things into RAM (which is usually much bigger)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants