Allow building of whispercpp with COREML support #31
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Addresses #12 and maybe #20
Rather than copying much of
whisper.cpp
's CMakeLists.txt, just link the built libraries againstmain.cpp
.To enable CoreML support on macs per https://github.com/ggerganov/whisper.cpp?tab=readme-ov-file#core-ml-support , we will still need to first download and convert the appropriate model using the original whisper.cpp repository, producing a
<model>.mlmodelc
directory.To build and install,
export CMAKE_ARGS="-DWHISPER_COREML=1"
python -m build --wheel
in this repository to build the wheel. Assumes you have installedbuild
withpip install build
pip install dist/<generated>.whl
To invoke,
model = Model('<model_path>/ggml-base.en.bin', n_threads=6)
, assuming the convertedmlmodelc
directory is also in<model_path>
If successful, you will see something like:
You can also verify if
whisper.cpp
has been built successfully by doingprint(Model.system_info())
, and you should seeCOREML = 1