-
-
Notifications
You must be signed in to change notification settings - Fork 90
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
CoreML not working on Mac #137
Comments
Hello @jettoblack , I tested it on my mac (but it is intel-based). Also, ensured that build for arm64 is correctly executed. Best way to test it with the setup that you described is to run: go to whisper.net/examples/CoreML directory.
Please, let me know if the issue persists. |
@sandrohanea I tried both 1.4.7 and 1.5.0 on both arm Macs I have, and ran the CoreML example exactly as specified above, but I'm still getting the same error. I can run whisper.cpp in CoreML mode and it works on both of these Macs. I also got the Cublas example working on Windows. The CPU-only version is pretty fast as it is and I just read that CoreML isn't really working great with medium/large models yet, so maybe this is a moot point and I should stick to the CPU runtime, but thanks for looking into it if you have a chance. |
Whisper.net.Runtime is now using Metal on ARM-based Macs, this is why it is fast already without CoreML :) Can you, please, run Also, can you, please, check if something relevant is displayed in the Console.app when you're trying to run the CoreML example? (search by CoreML in the upper right search box, for fewer results) |
I'm running into the problem that the native library can't be found when invoking transcription (.NET System.Exception thrown on the line). Perhaps a packaging issue again? I ran the ➜ otool -L ./libwhisper.dylib
./libwhisper.dylib:
@rpath/libwhisper.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.0.0)
/System/Library/Frameworks/Accelerate.framework/Versions/A/Accelerate (compatibility version 1.0.0, current version 4.0.0)
/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1953.255.0)
/System/Library/Frameworks/Metal.framework/Versions/A/Metal (compatibility version 1.0.0, current version 306.3.4)
/System/Library/Frameworks/MetalKit.framework/Versions/A/MetalKit (compatibility version 1.0.0, current version 154.0.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1300.36.0)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1953.255.0)
/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0) |
Similar problem, after executing
Unhandled Exception. System Exception: Failed to load native whisper library. |
I double-checked the package, and I don't see any issue with it :( Maybe someone can try to build a new runtime with the command:
ensure that cmake + build tools (xcode) are installed. then, copy the dylib manually from: This way we can check if there is some issue with the build script or with the build artifact. Also, it would be great if someone can confirm if they manage to execute it. |
It errors out for me with:
The Xamarin Android SDK is missing or something? Edit: there's no |
In the latest whisper.net main, that should be just a warning: https://github.com/sandrohanea/whisper.net/blob/4308888d4a202265dcc5d0f40bc4cce7dfdae255/Makefile#L10C9-L10C109 Please, make sure you pull the latest changes and also sync the whisper.cpp submodule:
|
Removing the condition in the makefile and running I got the following output regarding a missing
|
Nevermind, found the metal file in the whisper.cpp directory. Added it to the zip file: libwhisper.coreml.macos_coreml.arm64_with_metal.zip This works as expected now |
Nice, just to confirm, you synched latest changed from whisper.net and whisper.cpp? |
Good call. It was still behind, I thought I had it but didn't! Here's a working version from the latest main branch. |
So latest main still worked without any additional change? That's at least strange, as same build was done from github actions (but using an intel-based mac agent). ARM-based macos is not yet available free of charge for open source: https://github.com/orgs/community/discussions/69211 |
That's correct, no additional changes needed. We have the same issue with our project (https://github.com/tryphotino/photino.Native), I have to compile our native libraries for macOS ARM64 manually and upload it for the build process to copy it into the resulting NuGet package. I hope we'll get build machines for that soon 👍 |
@sandrohanea I did some testing and ran into the following issue where it seems to load the model twice (?) To test I recompiled everything again. And there was an update to whisper.cpp (see attachment). It works with those updates, but it still has that same error:
I also experienced that the new |
I'm trying to run the CoreML example project with no changes in VS Code. I have 2 ARM Macbook Pros: M1 Pro running latest macOS Sonoma 14.1.1, and a M2 Max running Ventura 13.6. Both machines can run the Simple example just fine, but both fail to load the native library for the CoreML example:
Unhandled exception. System.Exception: Failed to load native whisper library. Error: Unknown error at Whisper.net.WhisperFactory..ctor(IWhisperProcessorModelLoader loader, Boolean delayInit, String libraryPath, Boolean bypassLoading) at Whisper.net.WhisperFactory.FromPath(String path, Boolean delayInitialization, String libraryPath, Boolean bypassLoading) at Program.Main(String[] args) in /Users/jasonl/Downloads/whisper.net/examples/CoreML/Program.cs:line 35 at Program.<Main>(String[] args)
In ./bin/Debug/net6.0/runtimes/osx-arm64 I have:
libwhisper.coreml.dylib
whisper.dylib
I see both ggml-base.bin and ggml-base-encoder.mlmodelc downloaded and unpacked successfully. I tried copying these files to the bin or the runtimes/osx-arm64 folders so they are in the same place as the DLLs, but that didn't change anything.
I tried updating the projects to .net7, updating my build tools, etc. and nothing helped.
Is there any additional information I can provide that would be helpful for debugging? Thanks!
The text was updated successfully, but these errors were encountered: