Skip to content

Commit 3ebfa14

Browse files
Fix progress for vad (#223)
1 parent ad26716 commit 3ebfa14

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Sources/WhisperKit/Core/WhisperKit.swift

+4-1
Original file line numberDiff line numberDiff line change
@@ -784,6 +784,8 @@ open class WhisperKit {
784784
decodeOptions: decodeOptions
785785
)
786786

787+
progress.totalUnitCount = max(progress.totalUnitCount, Int64(audioChunks.count))
788+
787789
// Reset the seek times since we've already chunked the audio
788790
var chunkedOptions = decodeOptions
789791
chunkedOptions?.clipTimestamps = []
@@ -844,7 +846,8 @@ open class WhisperKit {
844846
try Task.checkCancellation()
845847

846848
let childProgress = Progress()
847-
progress.totalUnitCount += 1
849+
// Total can be set elsewhere, here ensures it is at least 1
850+
progress.totalUnitCount = max(1, progress.totalUnitCount)
848851
progress.addChild(childProgress, withPendingUnitCount: 1)
849852

850853
let transcribeTask = TranscribeTask(

0 commit comments

Comments
 (0)