Skip to content

Commit

Permalink
Add CoreML support (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
drasticactions authored Jun 3, 2023
1 parent 80345e1 commit 315190b
Show file tree
Hide file tree
Showing 17 changed files with 253 additions and 5 deletions.
93 changes: 92 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
BUILD_TYPE=Release
VERSION=1.4.3
CMAKE_PARAMETERS=-DCMAKE_BUILD_TYPE=$(BUILD_TYPE)
COREML_SUPPORT=$(CMAKE_PARAMETERS) -DWHISPER_COREML=ON -DWHISPER_COREML_ALLOW_FALLBACK=ON
NDK :=
ifeq ($(strip $(NDK_PATH)),)
ifeq ($(shell test -d $(HOME)/Library/Developer/Xamarin/android-sdk-macosx/ndk-bundle && echo yes),yes)
Expand All @@ -17,6 +18,10 @@ nuget:
nuget pack Whisper.net.Runtime.nuspec -Version $(VERSION) -OutputDirectory ./nupkgs
dotnet pack Whisper.net/Whisper.net.csproj -p:Version=$(VERSION) -o ./nupkgs -c $(BUILD_TYPE)

nuget_coreml:
mkdir -p nupkgs
nuget pack Whisper.net.Runtime.CoreML.nuspec -Version $(VERSION) -OutputDirectory ./nupkgs

clean:
rm -rf nupkgs
rm -rf build
Expand All @@ -26,6 +31,8 @@ android: android_x86 android_x64 android_arm64-v8a

apple: macos ios ios_64 maccatalyst_x64 maccatalyst_arm64 ios_simulator_x64 ios_simulator_arm64 tvos_simulator_x64 tvos_simulator_arm64 tvos lipo

apple_coreml: macos_coreml ios_coreml maccatalyst_x64_coreml maccatalyst_arm64_coreml ios_simulator_coreml tvos_simulator_coreml tvos_coreml lipo_coreml

linux: linux_x64 linux_arm64 linux_arm

linux_x64:
Expand Down Expand Up @@ -53,13 +60,29 @@ macos:
mkdir -p runtimes/macos
cp build/macos/whisper.cpp/libwhisper.dylib runtimes/macos/libwhisper.dylib

macos_coreml:
rm -rf build/macos-coreml
cmake $(COREML_SUPPORT) -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -S . -B build/macos-coreml
cmake --build build/macos-coreml
mkdir -p runtimes/macos-coreml
cp build/macos-coreml/whisper.cpp/libwhisper.dylib runtimes/macos-coreml/libwhisper.dylib
cp build/macos-coreml/whisper.cpp/libwhisper.coreml.dylib runtimes/macos-coreml/libwhisper.coreml.dylib

ios:
rm -rf build/ios
cmake $(CMAKE_PARAMETERS) -DCMAKE_TOOLCHAIN_FILE=ios.toolchain.cmake -DPLATFORM=OS -S . -B build/ios
cmake --build build/ios
mkdir -p runtimes/ios
cp build/ios/whisper.cpp/libwhisper.dylib runtimes/ios/libwhisper.dylib

ios_coreml:
rm -rf build/ios-coreml
cmake $(COREML_SUPPORT) -DCMAKE_OSX_ARCHITECTURES="arm64" -DCMAKE_OSX_SYSROOT="iphoneos" -S . -B build/ios-coreml
cmake --build build/ios-coreml
mkdir -p runtimes/ios-coreml
cp build/ios-coreml/whisper.cpp/libwhisper.coreml.dylib runtimes/ios-coreml/libwhisper.coreml.dylib
cp build/ios-coreml/whisper.cpp/libwhisper.dylib runtimes/ios-coreml/libwhisper.dylib

ios_64:
rm -rf build/ios_64
cmake $(CMAKE_PARAMETERS) -DCMAKE_TOOLCHAIN_FILE=ios.toolchain.cmake -DPLATFORM=OS64 -S . -B build/ios_64
Expand All @@ -81,6 +104,30 @@ maccatalyst_arm64:
mkdir -p runtimes/maccatalyst_arm64
cp build/maccatalyst_arm64/whisper.cpp/libwhisper.dylib runtimes/maccatalyst_arm64/libwhisper.dylib

maccatalyst_x64_coreml:
rm -rf build/maccatalyst-x64-coreml
cmake $(COREML_SUPPORT) -DCMAKE_SYSTEM_PROCESSOR=x86_64 -DCMAKE_HOST_SYSTEM_PROCESSOR=x86_64 -DCMAKE_SYSTEM_NAME=Darwin -DCMAKE_OSX_ARCHITECTURES="x86_64" -DCMAKE_CXX_FLAGS="-target x86_64-apple-ios13.1-macabi" -DCMAKE_C_FLAGS="-target x86_64-apple-ios13.1-macabi" -S . -B build/maccatalyst-x64-coreml
cmake --build build/maccatalyst-x64-coreml
mkdir -p runtimes/maccatalyst-x64-coreml
cp build/maccatalyst-x64-coreml/whisper.cpp/libwhisper.coreml.dylib runtimes/maccatalyst-x64-coreml/libwhisper.coreml.dylib
cp build/maccatalyst-x64-coreml/whisper.cpp/libwhisper.dylib runtimes/maccatalyst-x64-coreml/libwhisper.dylib

maccatalyst_arm64_coreml:
rm -rf build/maccatalyst-arm64-coreml
cmake $(COREML_SUPPORT) -DCMAKE_SYSTEM_PROCESSOR=arm -DCMAKE_HOST_SYSTEM_PROCESSOR=arm64 -DCMAKE_SYSTEM_NAME=Darwin -DCMAKE_OSX_ARCHITECTURES="arm64" -DCMAKE_CXX_FLAGS="-target arm64-apple-ios13.1-macabi" -DCMAKE_C_FLAGS="-target arm64-apple-ios13.1-macabi" -S . -B build/maccatalyst-arm64-coreml
cmake --build build/maccatalyst-arm64-coreml
mkdir -p runtimes/maccatalyst-arm64-coreml
cp build/maccatalyst-arm64-coreml/whisper.cpp/libwhisper.coreml.dylib runtimes/maccatalyst-arm64-coreml/libwhisper.coreml.dylib
cp build/maccatalyst-arm64-coreml/whisper.cpp/libwhisper.dylib runtimes/maccatalyst-arm64-coreml/libwhisper.dylib

ios_simulator_coreml:
rm -rf build/ios-simulator-coreml
cmake $(COREML_SUPPORT) -DCMAKE_OSX_SYSROOT="iphonesimulator" -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -S . -B build/ios-simulator-coreml
cmake --build build/ios-simulator-coreml
mkdir -p runtimes/ios-simulator-coreml
cp build/ios-simulator-coreml/whisper.cpp/libwhisper.coreml.dylib runtimes/ios-simulator-coreml/libwhisper.coreml.dylib
cp build/ios-simulator-coreml/whisper.cpp/libwhisper.dylib runtimes/ios-simulator-coreml/libwhisper.dylib

ios_simulator_x64:
rm -rf build/ios_simulator_x64
cmake $(CMAKE_PARAMETERS) -DCMAKE_TOOLCHAIN_FILE=ios.toolchain.cmake -DPLATFORM=SIMULATOR64 -S . -B build/ios_simulator_x64
Expand Down Expand Up @@ -116,6 +163,50 @@ tvos:
mkdir -p runtimes/tvos
cp build/tvos/whisper.cpp/libwhisper.dylib runtimes/tvos/libwhisper.dylib

tvos_coreml:
rm -rf build/tvos-coreml
cmake $(COREML_SUPPORT) -DCMAKE_OSX_SYSROOT="appletvos" -DCMAKE_OSX_ARCHITECTURES="arm64" -S . -B build/tvos-coreml
cmake --build build/tvos-coreml
mkdir -p runtimes/tvos-coreml
cp build/tvos-coreml/whisper.cpp/libwhisper.coreml.dylib runtimes/tvos-coreml/libwhisper.coreml.dylib
cp build/tvos-coreml/whisper.cpp/libwhisper.dylib runtimes/tvos-coreml/libwhisper.dylib

tvos_simulator_coreml:
rm -rf build/tvos-simulator-coreml
cmake $(COREML_SUPPORT) -DCMAKE_OSX_SYSROOT="appletvsimulator" -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -S . -B build/tvos-simulator-coreml
cmake --build build/tvos-simulator-coreml
mkdir -p runtimes/tvos-simulator-coreml
cp build/tvos-simulator-coreml/whisper.cpp/libwhisper.coreml.dylib runtimes/tvos-simulator-coreml/libwhisper.coreml.dylib
cp build/tvos-simulator-coreml/whisper.cpp/libwhisper.dylib runtimes/tvos-simulator-coreml/libwhisper.dylib

lipo_coreml:
mkdir -p Whisper.net.Runtime.CoreML/tvos-simulator
cp runtimes/tvos-simulator-coreml/libwhisper.dylib Whisper.net.Runtime.CoreML/tvos-simulator/libwhisper.dylib
cp runtimes/tvos-simulator-coreml/libwhisper.coreml.dylib Whisper.net.Runtime.CoreML/tvos-simulator/libwhisper.coreml.dylib
install_name_tool -add_rpath "@executable_path/" Whisper.net.Runtime.CoreML/tvos-simulator/libwhisper.dylib
mkdir -p Whisper.net.Runtime.CoreML/tvos-device
cp runtimes/tvos-coreml/libwhisper.dylib Whisper.net.Runtime.CoreML/tvos-device/libwhisper.dylib
cp runtimes/tvos-coreml/libwhisper.coreml.dylib Whisper.net.Runtime.CoreML/tvos-device/libwhisper.coreml.dylib
install_name_tool -add_rpath "@executable_path/" Whisper.net.Runtime.CoreML/tvos-device/libwhisper.dylib
mkdir -p Whisper.net.Runtime.CoreML/ios-simulator
cp runtimes/ios-simulator-coreml/libwhisper.dylib Whisper.net.Runtime.CoreML/ios-simulator/libwhisper.dylib
cp runtimes/ios-simulator-coreml/libwhisper.coreml.dylib Whisper.net.Runtime.CoreML/ios-simulator/libwhisper.coreml.dylib
install_name_tool -add_rpath "@executable_path/" Whisper.net.Runtime.CoreML/ios-simulator/libwhisper.dylib
mkdir -p Whisper.net.Runtime.CoreML/ios-device
cp runtimes/ios-coreml/libwhisper.dylib Whisper.net.Runtime.CoreML/ios-device/libwhisper.dylib
cp runtimes/ios-coreml/libwhisper.coreml.dylib Whisper.net.Runtime.CoreML/ios-device/libwhisper.coreml.dylib
install_name_tool -add_rpath "@executable_path/" Whisper.net.Runtime.CoreML/ios-device/libwhisper.dylib
mkdir -p Whisper.net.Runtime.CoreML/macos
cp runtimes/macos-coreml/libwhisper.dylib Whisper.net.Runtime.CoreML/macos/libwhisper.dylib
cp runtimes/macos-coreml/libwhisper.coreml.dylib Whisper.net.Runtime.CoreML/macos/libwhisper.coreml.dylib
install_name_tool -add_rpath "@executable_path/../MonoBundle" Whisper.net.Runtime.CoreML/macos/libwhisper.dylib
install_name_tool -add_rpath "@executable_path/runtimes/osx-arm64/" Whisper.net.Runtime.CoreML/macos/libwhisper.dylib
install_name_tool -add_rpath "@executable_path/runtimes/osx-x64/" Whisper.net.Runtime.CoreML/macos/libwhisper.dylib
mkdir -p Whisper.net.Runtime.CoreML/maccatalyst
lipo -create runtimes/maccatalyst-x64-coreml/libwhisper.dylib -create runtimes/maccatalyst-arm64-coreml/libwhisper.dylib -output Whisper.net.Runtime.CoreML/maccatalyst/libwhisper.dylib
lipo -create runtimes/maccatalyst-x64-coreml/libwhisper.coreml.dylib -create runtimes/maccatalyst-arm64-coreml/libwhisper.coreml.dylib -output Whisper.net.Runtime.CoreML/maccatalyst/libwhisper.coreml.dylib
install_name_tool -add_rpath "@executable_path/../MonoBundle" Whisper.net.Runtime.CoreML/maccatalyst/libwhisper.dylib

lipo:
mkdir -p Whisper.net.Runtime/tvos-simulator
lipo -create runtimes/tvos_simulator_arm64/libwhisper.dylib -create runtimes/tvos_simulator_x64/libwhisper.dylib -output Whisper.net.Runtime/tvos-simulator/libwhisper.dylib
Expand Down Expand Up @@ -153,4 +244,4 @@ android_x64:

xcframework:
mkdir -p output/lib
xcrun xcodebuild -create-xcframework -library Whisper.net.Runtime/ios-device/libwhisper.dylib -library Whisper.net.Runtime/ios-simulator/libwhisper.dylib -library Whisper.net.Runtime/tvos-device/libwhisper.dylib -library Whisper.net.Runtime/tvos-simulator/libwhisper.dylib -library Whisper.net.Runtime/macos/libwhisper.dylib -library Whisper.net.Runtime/maccatalyst/libwhisper.dylib -output output/lib/whisper.xcframework
xcrun xcodebuild -create-xcframework -library Whisper.net.Runtime/ios-device/libwhisper.dylib -library Whisper.net.Runtime/ios-simulator/libwhisper.dylib -library Whisper.net.Runtime/tvos-device/libwhisper.dylib -library Whisper.net.Runtime/tvos-simulator/libwhisper.dylib -library Whisper.net.Runtime/macos/libwhisper.dylib -library Whisper.net.Runtime/maccatalyst/libwhisper.dylib -output output/lib/whisper.xcframework
5 changes: 3 additions & 2 deletions Whisper.net.Demo/Whisper.net.Demo.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="../Whisper.net.Runtime/Whisper.net.Runtime.targets" />
<Import Condition="'$(EnableCoreML)' != 'true'" Project="../Whisper.net.Runtime/Whisper.net.Runtime.targets" />
<Import Condition="'$(EnableCoreML)' == 'true'" Project="../Whisper.net.Runtime.CoreML/Whisper.net.Runtime.CoreML.targets" />
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net7.0;net472</TargetFrameworks>
Expand All @@ -13,7 +14,7 @@
<ItemGroup>
<ProjectReference Include="..\Whisper.net\Whisper.net.csproj" />
</ItemGroup>

<ItemGroup>
<None Update="kennedy.wav">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
Expand Down
19 changes: 19 additions & 0 deletions Whisper.net.Runtime.CoreML.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0"?>
<package>
<metadata>
<id>Whisper.net.Runtime.CoreML</id>
<title>Whisper.Net.Runtime.CoreML</title>
<version>1.4.3</version>
<authors>Sandro Hanea</authors>
<owners>Sandro Hanea</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<summary>Cross-platform dotnet runtimes for Whisper, built with CoreML support.</summary>
<description>Whisper.net.Runtime.CoreML contains the native, CoreML enabled, runtime libraries to enable Whisper on .NET apps with Whisper.Net.</description>
<tags>whisper;ios;macos;cross-platform</tags>
<projectUrl>https://github.com/sandrohanea/whisper.net</projectUrl>
<license type="expression">MIT</license>
</metadata>
<files>
<file src="Whisper.net.Runtime.CoreML\**" target="build"/>
</files>
</package>
114 changes: 114 additions & 0 deletions Whisper.net.Runtime.CoreML/Whisper.net.Runtime.CoreML.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
<Project ToolsVersion="4.0"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Condition="(('$(Platform)' == 'iPhoneSimulator') OR $(RuntimeIdentifier.StartsWith('iossimulator')))">
<None Visible="false" Include="$(MSBuildThisFileDirectory)ios-simulator\libwhisper.dylib">
<Pack>true</Pack>
<PackageCopyToOutput>true</PackageCopyToOutput>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<TargetPath>libwhisper.dylib</TargetPath>
</None>
<None Visible="false" Include="$(MSBuildThisFileDirectory)ios-simulator\libwhisper.coreml.dylib">
<Pack>true</Pack>
<PackageCopyToOutput>true</PackageCopyToOutput>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<TargetPath>libwhisper.coreml.dylib</TargetPath>
</None>
</ItemGroup>
<ItemGroup Condition="(('$(Platform)' == 'iPhone') OR ('$(RuntimeIdentifier)' == 'ios') OR $(RuntimeIdentifier.StartsWith('ios-')) OR $(RuntimeIdentifier.StartsWith('ios.')))">
<None Visible="false" Include="$(MSBuildThisFileDirectory)ios-device\libwhisper.dylib">
<Pack>true</Pack>
<PackageCopyToOutput>true</PackageCopyToOutput>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<TargetPath>libwhisper.dylib</TargetPath>
</None>
<None Visible="false" Include="$(MSBuildThisFileDirectory)ios-device\libwhisper.coreml.dylib">
<Pack>true</Pack>
<PackageCopyToOutput>true</PackageCopyToOutput>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<TargetPath>libwhisper.coreml.dylib</TargetPath>
</None>
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.Contains('-maccatalyst')) == true ">
<None Visible="false" Include="$(MSBuildThisFileDirectory)maccatalyst\libwhisper.dylib">
<Pack>true</Pack>
<PackageCopyToOutput>true</PackageCopyToOutput>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<TargetPath>runtimes/maccatalyst/libwhisper.dylib</TargetPath>
</None>
<None Visible="false" Include="$(MSBuildThisFileDirectory)maccatalyst\libwhisper.coreml.dylib">
<Pack>true</Pack>
<PackageCopyToOutput>true</PackageCopyToOutput>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<TargetPath>libwhisper.coreml.dylib</TargetPath>
</None>
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.Contains('-macos')) == true ">
<None Visible="false" Include="$(MSBuildThisFileDirectory)macos\libwhisper.dylib">
<Pack>true</Pack>
<PackageCopyToOutput>true</PackageCopyToOutput>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<TargetPath>runtimes/maccatalyst/libwhisper.dylib</TargetPath>
</None>
<None Visible="false" Include="$(MSBuildThisFileDirectory)macos\libwhisper.coreml.dylib">
<Pack>true</Pack>
<PackageCopyToOutput>true</PackageCopyToOutput>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<TargetPath>libwhisper.coreml.dylib</TargetPath>
</None>
</ItemGroup>
<ItemGroup Condition="$(RuntimeIdentifier.StartsWith('tvos-'))">
<None Visible="false" Include="$(MSBuildThisFileDirectory)tvos-device\libwhisper.dylib">
<Pack>true</Pack>
<PackageCopyToOutput>true</PackageCopyToOutput>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<TargetPath>libwhisper.dylib</TargetPath>
</None>
<None Visible="false" Include="$(MSBuildThisFileDirectory)tvos-device\libwhisper.coreml.dylib">
<Pack>true</Pack>
<PackageCopyToOutput>true</PackageCopyToOutput>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<TargetPath>libwhisper.coreml.dylib</TargetPath>
</None>
</ItemGroup>
<ItemGroup Condition="$(RuntimeIdentifier.StartsWith('tvossimulator-'))">
<None Visible="false" Include="$(MSBuildThisFileDirectory)tvos-simulator\libwhisper.dylib">
<Pack>true</Pack>
<PackageCopyToOutput>true</PackageCopyToOutput>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<TargetPath>libwhisper.dylib</TargetPath>
</None>
<None Visible="false" Include="$(MSBuildThisFileDirectory)tvos-simulator\libwhisper.coreml.dylib">
<Pack>true</Pack>
<PackageCopyToOutput>true</PackageCopyToOutput>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<TargetPath>libwhisper.coreml.dylib</TargetPath>
</None>
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.Contains('-')) == false ">
<!-- If using default runtime, include the split macOS libs rather that the lipoed version -->
<None Visible="false" Include="$(MSBuildThisFileDirectory)macos\libwhisper.dylib">
<Pack>true</Pack>
<PackageCopyToOutput>true</PackageCopyToOutput>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<TargetPath>runtimes/osx-x64/whisper.dylib</TargetPath>
</None>
<None Visible="false" Include="$(MSBuildThisFileDirectory)macos\libwhisper.dylib">
<Pack>true</Pack>
<PackageCopyToOutput>true</PackageCopyToOutput>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<TargetPath>runtimes/osx-arm64/whisper.dylib</TargetPath>
</None>
<None Visible="false" Include="$(MSBuildThisFileDirectory)macos\libwhisper.coreml.dylib">
<Pack>true</Pack>
<PackageCopyToOutput>true</PackageCopyToOutput>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<TargetPath>runtimes/osx-arm64/libwhisper.coreml.dylib</TargetPath>
</None>
<None Visible="false" Include="$(MSBuildThisFileDirectory)macos\libwhisper.coreml.dylib">
<Pack>true</Pack>
<PackageCopyToOutput>true</PackageCopyToOutput>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<TargetPath>runtimes/osx-x64/libwhisper.coreml.dylib</TargetPath>
</None>
</ItemGroup>
</Project>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added Whisper.net.Runtime.CoreML/macos/libwhisper.dylib
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
27 changes: 25 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Open-Source Whisper.net

Dotnet bindings for OpenAI Whisper made possible by [whisper.cpp](https://github.com/ggerganov/whisper.cpp)


## Getting started

To install Whisper.net, run the following command in the [Package Manager Console](http://docs.nuget.org/docs/start-here/using-the-package-manager-console):
Expand All @@ -22,6 +22,23 @@ or simply add a package reference in your csproj:

The runtime package, Whisper.net.Runtime, contains the native whisper.cpp library and it is required in order to run Whisper.net.

## CoreML Runtime

Whisper.net.Runtime.CoreML contains the native whisper.cpp library with Apple CoreML support enabled. Using this on Apple hardware (macOS, iOS, etc.) can net performance improvements over the core runtimes. To use it, reference the `Whisper.net.Runtime.CoreML` nuget,

```
<PackageReference Include="Whisper.net" Version="1.4.3" />
<PackageReference Include="Whisper.net.Runtime.CoreML" Version="1.4.3" />
```

Note that only the CoreML built libraries are available in this package and does not contain libraries for other platforms (Linux, Windows, etc). If you are creating a cross-platform application you can use conditional target frameworks to install the correct library package for each version.

Using the ggml whisper models with CoreML requires an additional `mlmodelc` file to be placed alongside your whisper model. You can generate these via the [whisper.cpp scripts](https://github.com/ggerganov/whisper.cpp#core-ml-support). As whisper.cpp uses filepaths to detect this folder, you must load your whisper model with a file path. If successful, the whisper output logs will announce:

`whisper_init_state: loading Core ML model from...`

If not, it will announce an error and use the original core library instead.

## Versioning

Each version of Whisper.net is tied to a specific version of Whisper.cpp. The version of Whisper.net is the same as the version of Whisper it is based on. For example, Whisper.net 1.2.0 is based on Whisper 1.2.0.
Expand Down Expand Up @@ -64,7 +81,7 @@ Also, for easier integration Whisper.net provides a Downloader which is using ht
{
Console.WriteLine($"{result.Start}->{result.End}: {result.Text}");
}
```
```

## Examples

Expand Down Expand Up @@ -96,6 +113,12 @@ or

- Compiling the Apple libraries requires a Mac with Xcode installed.

### Apple CoreML:

`make apple_coreml`

- Compiling the Apple libraries requires a Mac with Xcode installed.

### Linux:

`make linux`
Expand Down

0 comments on commit 315190b

Please sign in to comment.