Skip to content

Commit

Permalink
Fix progress for vad (#223)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZachNagengast authored Oct 15, 2024
1 parent ad26716 commit 3ebfa14
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Sources/WhisperKit/Core/WhisperKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,8 @@ open class WhisperKit {
decodeOptions: decodeOptions
)

progress.totalUnitCount = max(progress.totalUnitCount, Int64(audioChunks.count))

// Reset the seek times since we've already chunked the audio
var chunkedOptions = decodeOptions
chunkedOptions?.clipTimestamps = []
Expand Down Expand Up @@ -844,7 +846,8 @@ open class WhisperKit {
try Task.checkCancellation()

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

let transcribeTask = TranscribeTask(
Expand Down

0 comments on commit 3ebfa14

Please sign in to comment.