]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/commitdiff
Fix EOT token handling
authorGeorgi Gerganov <redacted>
Mon, 17 Oct 2022 21:53:06 +0000 (00:53 +0300)
committerGeorgi Gerganov <redacted>
Mon, 17 Oct 2022 21:53:06 +0000 (00:53 +0300)
If it is the end of the audio, pick all sampled tokens.
Otherwise, print error message.

whisper.cpp

index 988527811c3cda0c253fc28908f95db7159f8f0e..ab22988754958d3aabc18fdd709a40cc0f96eaa1 100644 (file)
@@ -2445,9 +2445,12 @@ int whisper_full(
                 // end of text token
                 if (id == whisper_token_eot(ctx)) {
                     if (result_len == 0) {
-                        // TODO: figure out how to resolve this
-                        fprintf(stderr, "\n%s: failed to generate timestamp token - this should not happen\n\n", __func__);
-                        //result_len = i + 1;
+                        if (seek + seek_delta + 100 >= whisper_n_len(ctx)) {
+                            result_len = i + 1;
+                        } else {
+                            // TODO: figure out how to resolve this
+                            fprintf(stderr, "\n%s: failed to generate timestamp token - this should not happen\n\n", __func__);
+                        }
                     }
                     break;
                 }