k2-fsa / sherpa-onnx

Speech-to-text, text-to-speech, speaker diarization, and VAD using next-gen Kaldi with onnxruntime without Internet connection. Support embedded systems, Android, iOS, Raspberry Pi, RISC-V, x86_64 servers, websocket server/client, C/C++, Python, Kotlin, C#, Go, NodeJS, Java, Swift, Dart, JavaScript, Flutter, Object Pascal, Lazarus, Rust
https://k2-fsa.github.io/sherpa/onnx/index.html
Apache License 2.0
3.53k stars 414 forks source link

java windwos run is error #1441

Closed YeyuchenBa closed 3 weeks ago

YeyuchenBa commented 3 weeks ago

F:\JAVAAI\audio\sherpa-onnx\sherpa-onnx\jni\online-recognizer.cc:Java_com_k2fsa_sherpa_onnx_OnlineRecognizer_newFromFile:289 config: OnlineRecognizerConfig(feat_config=FeatureExtractorConfig(sampling_rate=16000, feature_dim=80, low_freq=20, high_freq=-400, dither=0), model_config=OnlineModelConfig(transducer=OnlineTransducerModelConfig(encoder="F:\JAVAAI\audio\sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20\encoder-epoch-99-avg-1.int8.onnx", decoder="F:\JAVAAI\audio\sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20\decoder-epoch-99-avg-1.onnx", joiner="F:\JAVAAI\audio\sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20\joiner-epoch-99-avg-1.onnx"), paraformer=OnlineParaformerModelConfig(encoder="", decoder=""), wenet_ctc=OnlineWenetCtcModelConfig(model="", chunk_size=16, num_left_chunks=4), zipformer2_ctc=OnlineZipformer2CtcModelConfig(model=""), nemo_ctc=OnlineNeMoCtcModelConfig(model=""), provider_config=ProviderConfig(device=0, provider="cpu", cuda_config=CudaConfig(cudnn_conv_algo_search=1), trt_config=TensorrtConfig(trt_max_workspace_size=2147483647, trt_max_partition_iterations=10, trt_min_subgraph_size=5, trt_fp16_enable="True", trt_detailed_build_log="False", trt_engine_cache_enable="True", trt_engine_cache_path=".", trt_timing_cache_enable="True", trt_timing_cache_path=".",trt_dump_subgraphs="False" )), tokens="tokens.txt", num_threads=1, warm_up=0, debug=True, model_type="", modeling_unit="cjkchar", bpe_vocab=""), lm_config=OnlineLMConfig(model="", scale=1, shallow_fusion=True), endpoint_config=EndpointConfig(rule1=EndpointRule(must_contain_nonsilence=False, min_trailing_silence=2.4, min_utterance_length=0), rule2=EndpointRule(must_contain_nonsilence=True, min_trailing_silence=1.4, min_utterance_length=0), rule3=EndpointRule(must_contain_nonsilence=False, min_trailing_silence=0, min_utterance_length=20)), ctc_fst_decoder_config=OnlineCtcFstDecoderConfig(graph="", max_active=3000), enable_endpoint=True, max_active_paths=4, hotwords_score=1.5, hotwords_file="", decoding_method="greedy_search", blank_penalty=0, temperature_scale=2, rule_fsts="", rule_fars="") F:\JAVAAI\audio\sherpa-onnx\sherpa-onnx\csrc\online-model-config.cc:Validate:71 tokens: 'tokens.txt' does not exist, you should provide either a tokens buffer or a tokens file F:\JAVAAI\audio\sherpa-onnx\sherpa-onnx\jni\online-recognizer.cc:Java_com_k2fsa_sherpa_onnx_OnlineRecognizer_newFromFile:292 Errors found in config! #

A fatal error has been detected by the Java Runtime Environment:

#

EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffe8c27cb82, pid=42672, tid=0x00000000000099ac

#

JRE version: Java(TM) SE Runtime Environment (8.0_361) (build 1.8.0_361-b09)

Java VM: Java HotSpot(TM) 64-Bit Server VM (25.361-b09 mixed mode windows-amd64 compressed oops)

Problematic frame:

C [sherpa-onnx-jni.dll+0xcb82]

#

Failed to write core dump. Minidumps are not enabled by default on client versions of Windows

#

An error report file with more information is saved as:

E:\JAVAHOME\JAVA_AI\hs_err_pid42672.log

#

If you would like to submit a bug report, please visit:

http://bugreport.java.com/bugreport/crash.jsp

The crash happened outside the Java Virtual Machine in native code.

See problematic frame for where to report the bug.

#

YeyuchenBa commented 3 weeks ago

image

csukuangfj commented 3 weeks ago

Please read the error logs by yourself

F:\JAVAAI\audio\sherpa-onnx\sherpa-onnx\csrc\online-model-config.cc:Validate:71 tokens: 'tokens.txt' does not exist, you should provide either a tokens buffer or a tokens file
F:\JAVAAI\audio\sherpa-onnx\sherpa-onnx\jni\online-recognizer.cc:Java_com_k2fsa_sherpa_onnx_OnlineRecognizer_newFromFile:292 Errors found in config!

The solution is in the log.

You can use absolute path to tokens.txt if you don't know what is relative path.

csukuangfj commented 3 weeks ago

Hint:

encoder="F:\JAVAAI\audio\sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20\encoder-epoch-99-avg-1.int8.onnx", decoder="F:\JAVAAI\audio\sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20\decoder-epoch-99-avg-1.onnx", joiner="F:\JAVAAI\audio\sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20\joiner-epoch-99-avg-1.onnx"

 tokens="tokens.txt", 

You now how to use absolute paths for encoder, decoder, and joiner, but somehow you use relative path for tokens.txt.