Fix decoder state cleanup blocking transcription start with Parakeet model

This commit is contained in:
Beingpax 2025-08-25 13:50:07 +05:45
parent d1f603b5e6
commit 9e29b34db1
2 changed files with 3 additions and 4 deletions

View File

@ -71,9 +71,6 @@ class ParakeetTranscriptionService: TranscriptionService {
throw ASRError.notInitialized
}
// Reset the decoder state before each transcription to ensure no state leaks from previous runs
try await asrManager.resetDecoderState(for: .microphone)
let audioSamples = try readAudioSamples(from: audioURL)
// Validate audio data before transcription
@ -84,7 +81,9 @@ class ParakeetTranscriptionService: TranscriptionService {
let result = try await asrManager.transcribe(audioSamples)
// Reset decoder state and cleanup after transcription to avoid blocking the transcription start
Task {
try? await asrManager.resetDecoderState(for: .microphone)
asrManager.cleanup()
isModelLoaded = false
logger.notice("🦜 Parakeet ASR models cleaned up from memory")

View File

@ -51,7 +51,7 @@ struct MetricsContent: View {
color: .green
)
MetricCard(
title: "WPM",
title: "Average Words/Minute",
value: String(format: "%.1f", averageWordsPerMinute),
icon: "speedometer",
color: .orange