From f909185eac5788583adeb44dd3ab1edb8e9aaf88 Mon Sep 17 00:00:00 2001 From: Beingpax Date: Thu, 14 Aug 2025 10:47:28 +0545 Subject: [PATCH] Add flash attention --- VoiceInk/Whisper/LibWhisper.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/VoiceInk/Whisper/LibWhisper.swift b/VoiceInk/Whisper/LibWhisper.swift index 1436145..07132ea 100644 --- a/VoiceInk/Whisper/LibWhisper.swift +++ b/VoiceInk/Whisper/LibWhisper.swift @@ -126,6 +126,10 @@ actor WhisperContext { var params = whisper_context_default_params() #if targetEnvironment(simulator) params.use_gpu = false + logger.info("Running on the simulator, using CPU") + #else + params.flash_attn = true // Enable flash attention for Metal + logger.info("Flash attention enabled for Metal") #endif let context = whisper_init_from_file_with_params(path, params)