WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit fef36f6

Browse files
committed
add error handling for setting model context language
1 parent f45c3e7 commit fef36f6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pkg/whisper.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,11 @@ func Process(model whisper.Model, input []byte, subsWriter io.Writer) error {
5757
context.SetTokenSumThreshold(configuration.Cfg.WhisperConf.TokenThreshold)
5858
}
5959

60-
context.SetLanguage(configuration.Cfg.TargetLang)
60+
err = context.SetLanguage(configuration.Cfg.TargetLang)
61+
if err != nil {
62+
log.WithError(err).Error("Failed to set language. Is your model compatible with the target language?")
63+
return err
64+
}
6165
context.SetSpeedup(configuration.Cfg.WhisperConf.WhisperSpeedup)
6266

6367
data := internal.ConvertPCMBytes(input)

0 commit comments

Comments
 (0)