-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
35 changed files
with
820 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// swift-tools-version:5.5 | ||
|
||
import PackageDescription | ||
|
||
let package = Package( | ||
name: "bark", | ||
platforms: [ | ||
.macOS(.v12), | ||
.iOS(.v14), | ||
.watchOS(.v4), | ||
.tvOS(.v14) | ||
], | ||
products: [ | ||
.library(name: "bark", targets: ["bark"]), | ||
], | ||
targets: [ | ||
.target( | ||
name: "bark", | ||
path: ".", | ||
sources: [ | ||
"bark.cpp", | ||
"encodec.cpp", | ||
"ggml-alloc.c", | ||
"ggml-backend.c", | ||
"ggml.c", | ||
], | ||
publicHeadersPath: "include", | ||
cSettings: [ | ||
.unsafeFlags(["-Wno-shorten-64-to-32", "-O3", "-DNDEBUG"]), | ||
.define("GGML_USE_ACCELERATE"), | ||
.unsafeFlags(["-fno-objc-arc"]), | ||
// NOTE: NEW_LAPACK will required iOS version 16.4+ | ||
// We should consider add this in the future when we drop support for iOS 14 | ||
// (ref: ref: https://developer.apple.com/documentation/accelerate/1513264-cblas_sgemm?language=objc) | ||
// .define("ACCELERATE_NEW_LAPACK"), | ||
// .define("ACCELERATE_LAPACK_ILP64") | ||
], | ||
linkerSettings: [ | ||
.linkedFramework("Accelerate") | ||
] | ||
) | ||
], | ||
cxxLanguageStandard: .cxx11 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -219,4 +219,4 @@ extern "C" { | |
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
xcuserdata | ||
xcshareddata | ||
|
||
!Models | ||
!bark-swiftui-Info.plist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
A sample SwiftUI app using [bark.cpp](https://github.com/PABannier/bark.cpp/) to do audio generation locally. | ||
|
||
**Usage**: | ||
|
||
1. Select a model from the [bark.cpp repository](https://github.com/PABannier/bark.cpp/tree/master/models).[^1] | ||
2. Add the model to `bark.swiftui/` **via Xcode**. If you drag and drop the model in the Xcode project outside of Xcode, the model weights won't be automatically added to the target. | ||
3. Select the "Release" [^2] build configuration under "Run", then deploy and run to your device. | ||
|
||
**Note:** Pay attention to the folder path: `whisper.swiftui.demo/Resources/models` is the appropriate directory to place resources whilst `whisper.swiftui.demo/Models` is related to actual code. | ||
|
||
[^1]: I recommend the Bark small model for running on an iOS device. | ||
|
||
[^2]: The `Release` build can boost performance of audio generation. In this project, it also added `-O3 -DNDEBUG` to `Other C Flags`, but adding flags to app proj is not ideal in real world (applies to all C/C++ files), consider splitting xcodeproj in workspace in your own project. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict/> | ||
</plist> |
Oops, something went wrong.