ml-stable-diffusion
ml-stable-diffusion copied to clipboard
Terminated due to memory issue (when deploying on iOS)
I was able to get StableDiffusion
up and running in an app for macOS. Thanks for your incredible work, CoreML team!
However the same setup does not work on my iPhone 14
with iOS 16.2 (20C5058d)
(no Simulator involved, tried it on a physical device).
Execution seems to struggle at line:
let pipeline = try StableDiffusionPipeline(resourcesAt: resourceURL)
...after a short freeze the app crashes and I’m getting an error from Xcode saying Terminated due to memory issue
.
As recommended I’ve added the Increased Memory Limit
capability to my project but without luck.
I also did use --chunk-unet
, resulting in two unet chunks of about 850 MB each.
I am working with Xcode 14.1 (14B47)
on a MBP 16 M1 Pro
, 16 GB
, macOS 13.0.1 Ventura
.
What am I missing?
In case it’s helpful, here’s the error log → errorlog.txt
And here’s how it looks in Instruments.
Terminated due to memory on an M1 iPad Pro too.
I don't see any way to set the image size to be generated which seems odd. Am I missing something?
Ugh the model has a fixed output shape.
I just built it with "--latent-w" and "--latent-h" set to 384 and still terminated do to memory.
I'm thinking it still uses the same amount of RAM since it looks like the Unet uses 64x64 regardless of the latent shape.
Has anyone successfully run it on an iOS device? I found out not working properly , macOS 13.1
iPhone 14 simultor
iOS 16.1
I believe it is a requirement to use iOS 16.2, but only iPad with M2 works for me, iPhone 13 Mini crashes as well :(
I have this problem too, tested on an iPhone 13 pm
Same here, iPhone 12. Looks like it doesn't have enough RAM
I can run it on iPad Pro 12.9" M2 iOS 16.2. It fails on iPhone Mini 13 iOS 16.2 (compute units was set to cpuAndNL). And my primary iPhone 14 Pro is not updated yet to 16.2 (and it crashes on 16.1).
I had it running on M1 iPad 16.2 Beta just fine, but crashed due to memory limit once updated to Today's 16.2 RC