Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Early stopping checks for CLI #91

Open
ZachNagengast opened this issue Mar 25, 2024 · 1 comment
Open

Early stopping checks for CLI #91

ZachNagengast opened this issue Mar 25, 2024 · 1 comment
Labels
enhancement Improves existing code good first issue Good for newcomers

Comments

@ZachNagengast
Copy link
Contributor

Similar to the example app, we should bring over the options for early stopping and add CLI arguments for setting them.

// Early stopping checks
let decodingCallback: ((TranscriptionProgress) -> Bool?) = { progress in
DispatchQueue.main.async {
let fallbacks = Int(progress.timings.totalDecodingFallbacks)
if progress.text.count < currentText.count {
if fallbacks == self.currentFallbacks {
self.unconfirmedText.append(currentText)
} else {
print("Fallback occured: \(fallbacks)")
}
}
self.currentText = progress.text
self.currentFallbacks = fallbacks
}
// Check early stopping
let currentTokens = progress.tokens
let checkWindow = Int(compressionCheckWindow)
if currentTokens.count > checkWindow {
let checkTokens: [Int] = currentTokens.suffix(checkWindow)
let compressionRatio = compressionRatio(of: checkTokens)
if compressionRatio > options.compressionRatioThreshold! {
return false
}
}
if progress.avgLogprob! < options.logProbThreshold! {
return false
}
return nil
}

@ZachNagengast ZachNagengast added enhancement Improves existing code good first issue Good for newcomers labels Mar 25, 2024
@atiorh
Copy link
Contributor

atiorh commented Mar 25, 2024

Indeed, we will aim for parity between the WhisperAX sample app and the CLI before the stable release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improves existing code good first issue Good for newcomers
Projects
Status: TODO
Development

No branches or pull requests

2 participants