From b0408b0fdece84894f7b6171e20cb8eb3d32cfc2 Mon Sep 17 00:00:00 2001 From: Jhen-Jie Hong Date: Mon, 11 Nov 2024 11:48:11 +0800 Subject: [PATCH] feat(example, ios): use metal by default (disable coreml) --- example/src/context-opts.ios.ts | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/example/src/context-opts.ios.ts b/example/src/context-opts.ios.ts index eb5d14a..a46cb3c 100644 --- a/example/src/context-opts.ios.ts +++ b/example/src/context-opts.ios.ts @@ -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(), }