Skip to content

Commit

Permalink
feat(example, ios): use metal by default (disable coreml)
Browse files Browse the repository at this point in the history
  • Loading branch information
jhen0409 committed Nov 11, 2024
1 parent 6229cf5 commit b0408b0
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions example/src/context-opts.ios.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
import { Platform } from 'react-native'

const getCoreMLModelAsset = () =>
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

export default {
useCoreMLIos: true,
// 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,
useGpu: false, // Enable Metal (Will skip Core ML if enabled)
useFlashAttn: false,
useGpu: true, // Enable Metal (Will skip Core ML if enabled)
useFlashAttn: true,

useCoreMLIos: false,
coreMLModelAsset: getCoreMLModelAsset(),
}

0 comments on commit b0408b0

Please sign in to comment.