| | |
| | | |
| | | This document serves as a development guide for the FunASR offline file transcription service. If you wish to quickly experience the offline file transcription service, please refer to the one-click deployment example for the FunASR offline file transcription service ([docs](./SDK_tutorial.md)). |
| | | |
| | | ## Installation of Docker |
| | | | TIME | INFO | IMAGE VERSION | IMAGE ID | |
| | | |------------|-----------------------------------------|---------------------------------|--------------| |
| | | | 2024.01.25 | Optimized the VAD (Voice Activity Detection) data processing method, significantly reducing peak memory usage; memory leak optimization| funasr-runtime-sdk-en-cpu-0.1.3 | de438fbbe304 | |
| | | | 2024.01.03 | fixed known crash issues as well as memory leak problems | funasr-runtime-sdk-en-cpu-0.1.2 | 0cdd9f4a4bb5 | |
| | | | 2023.11.08 | Adaptation to runtime structure changes | funasr-runtime-sdk-en-cpu-0.1.1 | 27017f70f72a | |
| | | | 2023.10.16 | 1.0 released | funasr-runtime-sdk-en-cpu-0.1.0 | e0de03eb0163 | |
| | | |
| | | The following steps are for manually installing Docker and Docker images. If your Docker image has already been launched, you can ignore this step. |
| | | |
| | | ### Installation of Docker environment |
| | | |
| | | ## Quick start |
| | | ### Docker install |
| | | If you have already installed Docker, ignore this step! |
| | | ```shell |
| | | # Ubuntu: |
| | | curl -fsSL https://test.docker.com -o test-docker.sh |
| | | sudo sh test-docker.sh |
| | | # Debian: |
| | | curl -fsSL https://get.docker.com -o get-docker.sh |
| | | sudo sh get-docker.sh |
| | | # CentOS: |
| | | curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun |
| | | # MacOS: |
| | | brew install --cask --appdir=/Applications docker |
| | | curl -O https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/shell/install_docker.sh; |
| | | sudo bash install_docker.sh |
| | | ``` |
| | | |
| | | More details could ref to [docs](https://alibaba-damo-academy.github.io/FunASR/en/installation/docker.html) |
| | | |
| | | ### Starting Docker |
| | | |
| | | ```shell |
| | | sudo systemctl start docker |
| | | ``` |
| | | If you do not have Docker installed, please refer to [Docker Installation](https://alibaba-damo-academy.github.io/FunASR/en/installation/docker.html) |
| | | |
| | | ### Pulling and launching images |
| | | |
| | | Use the following command to pull and launch the Docker image for the FunASR runtime-SDK: |
| | | |
| | | ```shell |
| | | sudo docker pull registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-en-cpu-0.1.1 |
| | | sudo docker pull registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-en-cpu-0.1.3 |
| | | |
| | | sudo docker run -p 10095:10095 -it --privileged=true -v /root:/workspace/models registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-en-cpu-0.1.1 |
| | | sudo docker run -p 10097:10095 -it --privileged=true -v /root:/workspace/models registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-en-cpu-0.1.3 |
| | | ``` |
| | | |
| | | Introduction to command parameters: |
| | | ```text |
| | | -p <host port>:<mapped docker port>: In the example, host machine (ECS) port 10095 is mapped to port 10095 in the Docker container. Make sure that port 10095 is open in the ECS security rules. |
| | | -p <host port>:<mapped docker port>: In the example, host machine (ECS) port 10097 is mapped to port 10095 in the Docker container. Make sure that port 10097 is open in the ECS security rules. |
| | | |
| | | -v <host path>:<mounted Docker path>: In the example, the host machine path /root is mounted to the Docker path /workspace/models. |
| | | |
| | | ``` |
| | | |
| | | |
| | | ## Starting the server |
| | | |
| | | ### Starting the server |
| | | Use the flollowing script to start the server : |
| | | ```shell |
| | | nohup bash run_server.sh \ |
| | | --download-model-dir /workspace/models \ |
| | | --vad-dir damo/speech_fsmn_vad_zh-cn-16k-common-onnx \ |
| | | --model-dir damo/speech_paraformer-large_asr_nat-en-16k-common-vocab10020-onnx \ |
| | | --punc-dir damo/punc_ct-transformer_zh-cn-common-vocab272727-onnx > log.out 2>&1 & |
| | | --punc-dir damo/punc_ct-transformer_cn-en-common-vocab471067-large-onnx > log.out 2>&1 & |
| | | |
| | | # If you want to close ssl,please add:--certfile 0 |
| | | |
| | | ``` |
| | | |
| | | ### More details about the script run_server.sh: |
| | | |
| | | The funasr-wss-server supports downloading models from Modelscope. You can set the model download address (--download-model-dir, default is /workspace/models) and the model ID (--model-dir, --vad-dir, --punc-dir). Here is an example: |
| | | |
| | | ```shell |
| | |
| | | --download-model-dir /workspace/models \ |
| | | --model-dir damo/speech_paraformer-large_asr_nat-en-16k-common-vocab10020-onnx \ |
| | | --vad-dir damo/speech_fsmn_vad_zh-cn-16k-common-onnx \ |
| | | --punc-dir damo/punc_ct-transformer_zh-cn-common-vocab272727-onnx \ |
| | | --decoder-thread-num 32 \ |
| | | --io-thread-num 8 \ |
| | | --port 10095 \ |
| | | --punc-dir damo/punc_ct-transformer_cn-en-common-vocab471067-large-onnx \ |
| | | --certfile ../../../ssl_key/server.crt \ |
| | | --keyfile ../../../ssl_key/server.key > log.out 2>&1 & |
| | | ``` |
| | | |
| | | Introduction to run_server.sh parameters: |
| | | |
| | | ```text |
| | | --download-model-dir: Model download address, download models from Modelscope by setting the model ID. |
| | | --model-dir: Modelscope model ID. |
| | | --quantize: True for quantized ASR model, False for non-quantized ASR model. Default is True. |
| | | --vad-dir: Modelscope model ID. |
| | | --vad-quant: True for quantized VAD model, False for non-quantized VAD model. Default is True. |
| | | --punc-dir: Modelscope model ID. |
| | | --punc-quant: True for quantized PUNC model, False for non-quantized PUNC model. Default is True. |
| | | --itn-dir modelscope model ID |
| | | --model-dir: modelscope model ID or local model path. |
| | | --vad-dir: modelscope model ID or local model path. |
| | | --punc-dir: modelscope model ID or local model path. |
| | | --itn-dir modelscope model ID or local model path. |
| | | --port: Port number that the server listens on. Default is 10095. |
| | | --decoder-thread-num: Number of inference threads that the server starts. Default is 8. |
| | | --io-thread-num: Number of IO threads that the server starts. Default is 1. |
| | | --decoder-thread-num: The number of thread pools on the server side that can handle concurrent requests. |
| | | The script will automatically configure parameters decoder-thread-num and io-thread-num based on the server's thread count. |
| | | --io-thread-num: Number of IO threads that the server starts. |
| | | --model-thread-num: The number of internal threads for each recognition route to control the parallelism of the ONNX model. |
| | | The default value is 1. It is recommended that decoder-thread-num * model-thread-num equals the total number of threads. |
| | | --certfile <string>: SSL certificate file. Default is ../../../ssl_key/server.crt. If you want to close ssl,set 0 |
| | | --keyfile <string>: SSL key file. Default is ../../../ssl_key/server.key. |
| | | ``` |
| | |
| | | After executing the above command, the real-time speech transcription service will be started. If the model is specified as a ModelScope model id, the following models will be automatically downloaded from ModelScope: |
| | | [FSMN-VAD](https://www.modelscope.cn/models/damo/speech_fsmn_vad_zh-cn-16k-common-onnx/summary), |
| | | [Paraformer-lagre](https://www.modelscope.cn/models/damo/speech_paraformer-large_asr_nat-en-16k-common-vocab10020-onnx/summary), |
| | | [CT-Transformer](https://www.modelscope.cn/models/damo/punc_ct-transformer_zh-cn-common-vocab272727-onnx/summary) |
| | | [CT-Transformer](https://www.modelscope.cn/models/damo/punc_ct-transformer_cn-en-common-vocab471067-large-onnx/summary) |
| | | |
| | | If you wish to deploy your fine-tuned model (e.g., 10epoch.pb), you need to manually rename the model to model.pb and replace the original model.pb in ModelScope. Then, specify the path as `model_dir`. |
| | | |