From 4c2ca8c82723161932fde85344bba9c579a947de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20S=C5=82uszniak?= Date: Mon, 31 Aug 2026 12:30:47 +0200 Subject: [PATCH] feat(speech): add Vulkan whisper-tiny variants Registers the fp16 and int8 Vulkan exports of multilingual whisper-tiny and lets the speech demo pick them on Android. The Vulkan encode needs the ExecuTorch 1.4.1 runtime from v0.10.0-libs-1.4.1: earlier Vulkan libs lack the gelu tanh clamp, the reduce-shader barrier fix and the Adreno local-work-group fix. --- apps/speech/app/audio-file-transcription/index.tsx | 10 ++++++++++ apps/speech/app/microphone-transcription/index.tsx | 10 ++++++++++ .../scripts/download-libs.js | 4 ++-- packages/react-native-executorch/src/models.ts | 14 ++++++++++++++ 4 files changed, 36 insertions(+), 2 deletions(-) diff --git a/apps/speech/app/audio-file-transcription/index.tsx b/apps/speech/app/audio-file-transcription/index.tsx index 1b58375c40..f6935f02b1 100644 --- a/apps/speech/app/audio-file-transcription/index.tsx +++ b/apps/speech/app/audio-file-transcription/index.tsx @@ -73,6 +73,16 @@ const MODELS = [ config: models.speechToText.WHISPER.TINY.MLX_BF16, disabled: Platform.OS !== 'ios', }, + { + name: 'Tiny Multilingual (Vulkan fp16)', + config: models.speechToText.WHISPER.TINY.VULKAN_FP16, + disabled: Platform.OS !== 'android', + }, + { + name: 'Tiny Multilingual (Vulkan int8)', + config: models.speechToText.WHISPER.TINY.VULKAN_INT8, + disabled: Platform.OS !== 'android', + }, { name: 'Base Multilingual (CPU)', config: models.speechToText.WHISPER.BASE.XNNPACK_FP32, diff --git a/apps/speech/app/microphone-transcription/index.tsx b/apps/speech/app/microphone-transcription/index.tsx index 1355e5991a..70ee8606de 100644 --- a/apps/speech/app/microphone-transcription/index.tsx +++ b/apps/speech/app/microphone-transcription/index.tsx @@ -66,6 +66,16 @@ const MODELS = [ config: models.speechToText.WHISPER.TINY.MLX_BF16, disabled: Platform.OS !== 'ios', }, + { + name: 'Tiny Multilingual (Vulkan fp16)', + config: models.speechToText.WHISPER.TINY.VULKAN_FP16, + disabled: Platform.OS !== 'android', + }, + { + name: 'Tiny Multilingual (Vulkan int8)', + config: models.speechToText.WHISPER.TINY.VULKAN_INT8, + disabled: Platform.OS !== 'android', + }, { name: 'Base Multilingual (CPU)', config: models.speechToText.WHISPER.BASE.XNNPACK_FP32, diff --git a/packages/react-native-executorch/scripts/download-libs.js b/packages/react-native-executorch/scripts/download-libs.js index 459cdcfba9..718a1dc64b 100644 --- a/packages/react-native-executorch/scripts/download-libs.js +++ b/packages/react-native-executorch/scripts/download-libs.js @@ -124,8 +124,8 @@ const FEATURE_MAP = { multimodalLLM: { backends: ['xnnpack', 'mlx', 'vulkan'], libs: ['opencv'] }, // Privacy filter classifiers ship xnnpack + an MLX iOS export. privacyFilter: { backends: ['xnnpack', 'mlx'], libs: [] }, - // Whisper ships xnnpack + coreml. - speechToText: { backends: ['xnnpack', 'coreml'], libs: [] }, + // Whisper ships xnnpack + coreml + a Vulkan Android export. + speechToText: { backends: ['xnnpack', 'coreml', 'vulkan'], libs: [] }, // Kokoro ships xnnpack only. textToSpeech: { backends: ['xnnpack'], libs: ['phonemis'] }, // FSMN VAD — xnnpack only. diff --git a/packages/react-native-executorch/src/models.ts b/packages/react-native-executorch/src/models.ts index 1985444133..69784a8c97 100644 --- a/packages/react-native-executorch/src/models.ts +++ b/packages/react-native-executorch/src/models.ts @@ -750,6 +750,18 @@ const WHISPER_TINY_MLX_INT8: WhisperSttModel = { supportedLanguages: WHISPER_LANGUAGES, vadModel: FSMN_VAD_XNNPACK_FP32, }; +const WHISPER_TINY_VULKAN_FP16: WhisperSttModel = { + modelPath: `${BASE_URL}-whisper-tiny/${NEXT_VERSION_TAG}/vulkan/whisper_tiny_vulkan_fp16.pte`, + tokenizerPath: `${BASE_URL}-whisper-tiny/${NEXT_VERSION_TAG}/tokenizer.json`, + supportedLanguages: WHISPER_LANGUAGES, + vadModel: FSMN_VAD_XNNPACK_FP32, +}; +const WHISPER_TINY_VULKAN_INT8: WhisperSttModel = { + modelPath: `${BASE_URL}-whisper-tiny/${NEXT_VERSION_TAG}/vulkan/whisper_tiny_vulkan_int8.pte`, + tokenizerPath: `${BASE_URL}-whisper-tiny/${NEXT_VERSION_TAG}/tokenizer.json`, + supportedLanguages: WHISPER_LANGUAGES, + vadModel: FSMN_VAD_XNNPACK_FP32, +}; const WHISPER_BASE_EN_XNNPACK_FP32: WhisperSttModel<'en'> = { modelPath: `${BASE_URL}-whisper-base.en/${NEXT_VERSION_TAG}/xnnpack/whisper_base_en_xnnpack_fp32.pte`, @@ -1862,6 +1874,8 @@ export const models = { COREML_FP16: WHISPER_TINY_COREML_FP16, MLX_BF16: WHISPER_TINY_MLX_BF16, MLX_INT8: WHISPER_TINY_MLX_INT8, + VULKAN_FP16: WHISPER_TINY_VULKAN_FP16, + VULKAN_INT8: WHISPER_TINY_VULKAN_INT8, }, /** * Multilingual Whisper Base model. Higher accuracy across supported