ml-stable-diffusion
ml-stable-diffusion copied to clipboard
Package problems running with XCode
I have successfully downloaded 5 mlmodelc files. But I have been struggling to build using the package. The issues range from Bundle.module not available to symbol not found.
I have XCode 14.1 on M2 MacBook Pro.
Here is what I have tried:
- Added Resources folder (holding downloaded compiled models) under this directory
- Changed Package.json like the following:
.target(
name: "StableDiffusion",
dependencies: [],
path: "swift/StableDiffusion",
resources: [.copy("Resources")]),
- Built the package for 'Any iOS Device' (building for simulator gives errors)
- Created client project and imported my package locally using XCode
- I see problem (
'module' is inaccessible
) with the below line:
if let url = Bundle.module.url(forResource: "Unet", withExtension: "mlmodelc")
- I also get the following linking error building the client project (it built fine without
.copy(Resources)
change above):
Undefined symbols for architecture arm64:
"_$s15StableDiffusion0aB8PipelineV11resourcesAt13configuration13disableSafetyAC10Foundation3URLV_So20MLModelConfigurationCSbtKcfC", referenced from:
Some elaboration on client code would be truly a great enabler to make this great work useful, thanks in advance!
Any idea how am I using this incorrectly?
I don't know the details, but comparing it to the procedure I tried might give you something.
- GitHub: https://github.com/ynagatomo/ImgGenSD2
Thank you so much!
I got the project to run. I have also put my models under CoreMLModels
folder.
But it is not working on iOS simulator (iphone 14 Pro max), crashes with fatalError :
"Fatal error: failed to create the Stable-Diffusion-Pipeline."
Is it so that it only succeeds on device? I don't seem to have any from iOS 16.2, for now :(
Never mind the previous issue, I got the missing files and ran it.
It is however super slow (I have M2 with 24 GB RAM), so had to kill it. Waiting for my first prompt image.
Thank you so much, again!
When you don't have any devices, please use the target My Mac (Designed for iPad)
. :)