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

SwiftUI Demo APP and CoreML -> increases app file size #2160

Open
sahmed53 opened this issue May 16, 2024 · 2 comments
Open

SwiftUI Demo APP and CoreML -> increases app file size #2160

sahmed53 opened this issue May 16, 2024 · 2 comments

Comments

@sahmed53
Copy link

sahmed53 commented May 16, 2024

This is a strange behaviour i have noticed and wondered if anyone else who has been using whisper.cpp and coreml on iOS has experienced it.

The Swift UI app works flawlessly and no issues with it in it standard format where it uses Metal. I added in the coreML files and a coreML model to the app, it loads up the model and runs fine (although CPU and memory usage is higher than when using metal).
Now for the odd issue -> the app size dramatically seems to increase each time i load up the app - i am seeing the overall app size increase in iphone settings, general, iphone storage.

The app size i.e. the bundle stays consistent at around 256.9mb, but the Documents and Data starts to jump up incrementing with each opening of the demo app. I have downloaded the app container from xcode -> windows -> devices, and this container size if only 10mb (although it increases with each load - there are files being added to the cache).

So i was wondering if anyone else has experienced this or if they are using an iphone can you check to see if your app size/documents and data is increasing too? I have looked everywhere to figure out what these "documents and data" are but no luck.

Clearing the caches etc doesnt seem to make a difference to the storage value in the settings of the iphone. At one point my overall app size increased to over 4gb when playing around with the small model.

btw this doesnt seem to happen if using metal, only with coreml, and i am testing on a real device iphone 13pro and iphone xr

Any help will be appreciated!

@ggerganov
Copy link
Owner

I don't know the details, but my guess is that CoreML creates some cache of the model. This might be the reason that the first time it runs on a device it is slow

@sahmed53
Copy link
Author

Thanks @ggerganov for the reply, yes you are right coreml is making a cache when loading up, however i am deleting the cache on app closure, which should clear it. The container of the app looks normal with all caches deleted, but that value in the "settings -> general -> app storage" still shows many mb (or gbs if used a lot). So i think this must be a bug in the OS file system. If you have time can you quickly load up your app, and then check the size in the iphone settings?

I will ask Apple directly about it and maybe file a bug.

Amazing work btw, everytime i use this in my app it i am amazed at what you have achieved on an iphone!

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

2 participants