Skip to content

Commit d837ae3

Browse files
Platform-specific defaults for concurrentWorkerCount (#321)
- Also updates regression tests to use default
1 parent 0a9bc42 commit d837ae3

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

Sources/WhisperKit/Core/Configurations.swift

+8-2
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ public struct DecodingOptions: Codable {
178178
logProbThreshold: Float? = -1.0,
179179
firstTokenLogProbThreshold: Float? = -1.5,
180180
noSpeechThreshold: Float? = 0.6,
181-
concurrentWorkerCount: Int = 16,
181+
concurrentWorkerCount: Int? = nil,
182182
chunkingStrategy: ChunkingStrategy? = nil
183183
) {
184184
self.verbose = verbose
@@ -205,7 +205,13 @@ public struct DecodingOptions: Codable {
205205
self.logProbThreshold = logProbThreshold
206206
self.firstTokenLogProbThreshold = firstTokenLogProbThreshold
207207
self.noSpeechThreshold = noSpeechThreshold
208-
self.concurrentWorkerCount = concurrentWorkerCount
208+
// Set platform-specific default worker count if not explicitly provided
209+
// Non-macOS devices have shown regressions with >4 workers, default to 4 for safety
210+
#if os(macOS)
211+
self.concurrentWorkerCount = concurrentWorkerCount ?? 16
212+
#else
213+
self.concurrentWorkerCount = concurrentWorkerCount ?? 4
214+
#endif
209215
self.chunkingStrategy = chunkingStrategy
210216
}
211217
}

Tests/WhisperKitTests/RegressionTests.swift

-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ class RegressionTests: XCTestCase {
5151
let vadDecodingOptions = DecodingOptions(
5252
verbose: true,
5353
task: .transcribe,
54-
concurrentWorkerCount: 16,
5554
chunkingStrategy: .vad
5655
)
5756

0 commit comments

Comments
 (0)