Skip to content

Commit

Permalink
feat(example): move useFlashAttn usage to context-opts
Browse files Browse the repository at this point in the history
  • Loading branch information
jhen0409 committed Nov 7, 2024
1 parent 920826e commit 9842b54
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 15 deletions.
1 change: 0 additions & 1 deletion cpp/rn-whisper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ std::string bench(struct whisper_context * ctx, int n_threads) {
}
}

const int64_t t_end_us = wsp_ggml_time_us();
const struct whisper_timings * timings = whisper_get_timings(ctx);

const int32_t n_encode = std::max(1, timings->n_encode);
Expand Down
10 changes: 9 additions & 1 deletion example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1337,6 +1337,14 @@ PODS:
- React-Codegen
- React-Core
- ReactCommon/turbomodule/core
- whisper-rn/no-require-arc (= 0.4.0-rc.8)
- whisper-rn/no-require-arc (0.4.0-rc.8):
- RCT-Folly
- RCTRequired
- RCTTypeSafety
- React-Codegen
- React-Core
- ReactCommon/turbomodule/core
- Yoga (0.0.0)

DEPENDENCIES:
Expand Down Expand Up @@ -1600,7 +1608,7 @@ SPEC CHECKSUMS:
RNZipArchive: 7bb4c70d6aa2dd235212c0a4a3de0a4e237e2569
SocketRocket: abac6f5de4d4d62d24e11868d7a2f427e0ef940d
SSZipArchive: c69881e8ac5521f0e622291387add5f60f30f3c4
whisper-rn: d8fa919d9e9cffc1ac6e72d7da9a95b9d9344641
whisper-rn: bbc8e83316260f5b4882a3c3f836b574649cc9e3
Yoga: 2655d94606b547901976080f15cdc6408575f699

PODFILE CHECKSUM: b3b0da61591aeebfbbfe372a869068f21e963e16
Expand Down
1 change: 0 additions & 1 deletion example/src/Transcribe.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ export default function App() {
const startTime = Date.now()
const ctx = await initWhisper({
filePath: require('../assets/ggml-base.bin'),
useFlashAttn: true,
...contextOpts,
})
const endTime = Date.now()
Expand Down
25 changes: 13 additions & 12 deletions example/src/context-opts.ios.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import { Platform } from 'react-native'

Check failure on line 1 in example/src/context-opts.ios.ts

View workflow job for this annotation

GitHub Actions / test-android

'Platform' is defined but never used

Check failure on line 1 in example/src/context-opts.ios.ts

View workflow job for this annotation

GitHub Actions / test-android

'Platform' is defined but never used

export default {
useCoreMLIos: true,
useCoreMLIos: false,
// If you don't want to enable Core ML, you can remove this property
coreMLModelAsset:
Platform.OS === 'ios'
? {
filename: 'ggml-base-encoder.mlmodelc',
assets: [
require('../assets/ggml-base-encoder.mlmodelc/weights/weight.bin'),
require('../assets/ggml-base-encoder.mlmodelc/model.mil'),
require('../assets/ggml-base-encoder.mlmodelc/coremldata.bin'),
],
}
: undefined,
// coreMLModelAsset:
// Platform.OS === 'ios'
// ? {
// filename: 'ggml-base-encoder.mlmodelc',
// assets: [
// require('../assets/ggml-base-encoder.mlmodelc/weights/weight.bin'),
// require('../assets/ggml-base-encoder.mlmodelc/model.mil'),
// require('../assets/ggml-base-encoder.mlmodelc/coremldata.bin'),
// ],
// }
// : undefined,
useGpu: false, // Enable Metal (Will skip Core ML if enabled)
useFlashAttn: false,
}

0 comments on commit 9842b54

Please sign in to comment.