run_server.sh 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. download_model_dir="/workspace/models"
  2. model_dir="damo/speech_paraformer-large-vad-punc_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="$(pwd)/ssl_key/server.crt"
  9. keyfile="$(pwd)/ssl_key/server.key"
  10. hotword="$(pwd)/websocket/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. cmd_path=/workspace/FunASR/runtime/websocket/build/bin
  17. cmd=funasr-wss-server
  18. . ./tools/utils/parse_options.sh || exit 1;
  19. if [ -z "$certfile" ] || [ "$certfile" = "0" ]; then
  20. certfile=""
  21. keyfile=""
  22. fi
  23. cd $cmd_path
  24. $cmd_path/${cmd} \
  25. --download-model-dir "${download_model_dir}" \
  26. --model-dir "${model_dir}" \
  27. --vad-dir "${vad_dir}" \
  28. --punc-dir "${punc_dir}" \
  29. --itn-dir "${itn_dir}" \
  30. --lm-dir "${lm_dir}" \
  31. --decoder-thread-num ${decoder_thread_num} \
  32. --model-thread-num ${model_thread_num} \
  33. --io-thread-num ${io_thread_num} \
  34. --port ${port} \
  35. --certfile "${certfile}" \
  36. --keyfile "${keyfile}" \
  37. --hotword "${hotword}" &