modelscope / FunASR

A Fundamental End-to-End Speech Recognition Toolkit and Open Source SOTA Pretrained Models, Supporting Speech Recognition, Voice Activity Detection, Text Post-processing etc.
https://www.funasr.com
Other
6.77k stars 717 forks source link

memory leak in funasr-runtime-sdk-cpu-0.4.4 #1708

Open FD-Liekkas opened 5 months ago

FD-Liekkas commented 5 months ago

Notice: In order to resolve issues more efficiently, please raise issue following the template. (注意:为了更加高效率解决您遇到的问题,请按照模板提问,补充细节)

🐛 Bug

  1. Use docker Version: registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-cpu-0.4.4
  2. Run /workspace/FunASR/runtime/run_server.sh as referred to https://github.com/alibaba-damo-academy/FunASR/blob/main/runtime/docs/SDK_advanced_guide_offline_zh.md#python-client.
  3. Execute python3.8 funasr_wss_client.py --host 127.0.0.1 --port 10095 --ssl 1 --mode offline --audio_in "xxx.mp4". Here, "xxx.mp4" is a long video, more than 30 minutes in duration. After step 3, the funasr-wss-server process's memory usage increases with each audio recognition. This increase seems to be related to the size of the audio.

To Reproduce

Steps to reproduce the behavior (always include the command you ran):

  1. Run cmd in my macOS terminal

    sudo docker pull registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-cpu-0.4.4
    mkdir -p ./funasr-runtime-resources/models
    sudo docker run -p 10095:10095 -it --privileged=true -v $PWD/funasr-runtime-resources/models:/workspace/models registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-cpu-0.4.4
  2. Enter contanier from terminal

    docker exec -it contanierId sh
  3. Lanuch server

    cd /workspace/FunASR/runtime
    nohup bash run_server.sh > log.txt 2>&1 &
  4. Query by python client. "xxx.mp4" is a long video, more than 30 minutes in duration

    cd /workspace/FunASR/runtime/python/websocket/
    python3.8 funasr_wss_client.py --host 127.0.0.1 --port 10095 --ssl 1 --mode offline --audio_in "xxx.mp4"

The funasr-wss-server process's memory usage increases with each audio recognition. Using the "xxx.wav" audio file for over 30 minutes will result in a similar reault. You can see memory usage with top command.

Code sample

No

Expected behavior

Solving the memory leak issue in the FunASR Offline File Transcription Software Package.

Environment

Additional context

No

hoavt-54 commented 4 months ago

We're having this on GPU as well. Memory keeps increasing after each inference.