run_server.sh 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. download_model_dir="/workspace/models"
  2. model_dir="damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-onnx"
  3. vad_dir="damo/speech_fsmn_vad_zh-cn-16k-common-onnx"
  4. punc_dir="damo/punc_ct-transformer_cn-en-common-vocab471067-large-onnx"
  5. itn_dir="thuduj12/fst_itn_zh"
  6. lm_dir="damo/speech_ngram_lm_zh-cn-ai-wesp-fst"
  7. port=10095
  8. certfile="../../../ssl_key/server.crt"
  9. keyfile="../../../ssl_key/server.key"
  10. hotword="../../hotwords.txt"
  11. # set decoder_thread_num
  12. decoder_thread_num=$(cat /proc/cpuinfo | grep "processor"|wc -l) || { echo "Get cpuinfo failed. Set decoder_thread_num = 32"; decoder_thread_num=32; }
  13. multiple_io=16
  14. io_thread_num=$(( (decoder_thread_num + multiple_io - 1) / multiple_io ))
  15. model_thread_num=1
  16. . ../egs/aishell/transformer/utils/parse_options.sh || exit 1;
  17. if [ -z "$certfile" ] || [ "$certfile" = "0" ]; then
  18. certfile=""
  19. keyfile=""
  20. fi
  21. cd /workspace/FunASR/runtime/websocket/build/bin
  22. ./funasr-wss-server \
  23. --download-model-dir "${download_model_dir}" \
  24. --model-dir "${model_dir}" \
  25. --vad-dir "${vad_dir}" \
  26. --punc-dir "${punc_dir}" \
  27. --itn-dir "${itn_dir}" \
  28. --lm-dir "${lm_dir}" \
  29. --decoder-thread-num ${decoder_thread_num} \
  30. --model-thread-num ${model_thread_num} \
  31. --io-thread-num ${io_thread_num} \
  32. --port ${port} \
  33. --certfile "${certfile}" \
  34. --keyfile "${keyfile}" \
  35. --hotword "${hotword}"