GiviMAD / whisper-jni

A JNI wrapper for using whisper.cpp, allows to transcribe speech to text in Java.
Apache License 2.0
81 stars 12 forks source link

Beam Search Issue #1

Closed etozhealexis closed 1 year ago

etozhealexis commented 1 year ago

I tried to use your wrapper with greedy search and I wasn't satisfied with the results (had tested in Docker with this model https://ggml.ggerganov.com/ggml-model-whisper-base.bin)

So I tried to use the Beam Search instead, and there is an issue (my docker container had stopped after sending some voice):

terminate called after throwing an instance of 'std::length_error'
2023-06-19T12:45:16.710450306Z   what():  vector::reserve
2023-06-19T12:45:16.710460535Z #
2023-06-19T12:45:16.710471971Z # A fatal error has been detected by the Java Runtime Environment:
2023-06-19T12:45:16.710473666Z #
2023-06-19T12:45:16.710475073Z #  SIGSEGV (0xb) at pc=0x00007f6d48d87602, pid=1, tid=53
2023-06-19T12:45:16.710476359Z #
2023-06-19T12:45:16.710477512Z # JRE version: OpenJDK Runtime Environment (17.0.2+8) (build 17.0.2+8-86)
2023-06-19T12:45:16.710478821Z # Java VM: OpenJDK 64-Bit Server VM (17.0.2+8-86, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
2023-06-19T12:45:16.710480187Z # Problematic frame:
2023-06-19T12:45:16.710501896Z # C  [libc.so.6+0x22602]  abort+0x1ee
2023-06-19T12:45:16.710510238Z #
2023-06-19T12:45:16.710512158Z # No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
2023-06-19T12:45:16.710522318Z #
2023-06-19T12:45:16.710527034Z # An error report file with more information is saved as:
2023-06-19T12:45:16.710528901Z # //hs_err_pid1.log
2023-06-19T12:45:16.718218482Z #
2023-06-19T12:45:16.718241661Z # If you would like to submit a bug report, please visit:
2023-06-19T12:45:16.718244315Z #   https://bugreport.java.com/bugreport/crash.jsp
2023-06-19T12:45:16.718246068Z # The crash happened outside the Java Virtual Machine in native code.
2023-06-19T12:45:16.718247712Z # See problematic frame for where to report the bug.
2023-06-19T12:45:16.718249635Z #

Do you have any ideas why is this happening?

GiviMAD commented 1 year ago

My mistake, seems like the default value in class WhisperFullParams for beamSearchBeamSize is incorrectly set to -1 but should be 2.

Thank you for raising the issue.