Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

funasr-runtime-sdk-online-cpu-0.1.10软件包内存一直缓慢涨,不下降 #1770

Open
MyWestCity opened this issue May 30, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@MyWestCity
Copy link

拉取官方镜像funasr-runtime-sdk-online-cpu-0.1.10
运行run_server_2pass.sh

download_model_dir="/workspace/models"
model_dir="damo/speech_paraformer-large-vad-punc_asr_nat-zh-cn-16k-common-vocab8404-onnx"
online_model_dir="damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-online-onnx"
vad_dir="damo/speech_fsmn_vad_zh-cn-16k-common-onnx"
punc_dir="damo/punc_ct-transformer_zh-cn-common-vad_realtime-vocab272727-onnx"
itn_dir="thuduj12/fst_itn_zh"
lm_dir="none"
#lm_dir="damo/speech_ngram_lm_zh-cn-ai-wesp-fst"
port=10029
certfile="0" # "$(pwd)/ssl_key/server.crt"
keyfile="0" # "$(pwd)/ssl_key/server.key"
hotword="$(pwd)/websocket/hotwords.txt"
# set decoder_thread_num
decoder_thread_num=$(cat /proc/cpuinfo | grep "processor"|wc -l) || { echo "Get cpuinfo failed. Set decoder_thread_num = 32"; decoder_thread_num=32; }
multiple_io=16
io_thread_num=$(( (decoder_thread_num + multiple_io - 1) / multiple_io ))
model_thread_num=1
cmd_path=/workspace/FunASR/runtime/websocket/build/bin
cmd=funasr-wss-server-2pass

. ./tools/utils/parse_options.sh || exit 1;

if [ -z "$certfile" ] || [ "$certfile" = "0" ]; then
  certfile=""
  keyfile=""
fi

cd $cmd_path
$cmd_path/${cmd}  \
  --download-model-dir "${download_model_dir}" \
  --model-dir "${model_dir}" \
  --online-model-dir "${online_model_dir}" \
  --vad-dir "${vad_dir}" \
  --punc-dir "${punc_dir}" \
  --itn-dir "${itn_dir}" \
  --lm-dir "${lm_dir}" \
  --decoder-thread-num ${decoder_thread_num} \
  --model-thread-num ${model_thread_num} \
  --io-thread-num  ${io_thread_num} \
  --port ${port} \
  --certfile  "${certfile}" \
  --keyfile "${keyfile}" \

启动的时候,内存如下
image1
进行语音识别,过了一分钟,内存就涨了100M,如下
image2
然后我用Valgrind检测内存泄漏,也没有检测到内存泄漏,请问涨的内存是在哪,是泄漏还是缓存呢?

  • OS (e.g., Linux):
  • Docker version (funasr-runtime-sdk-online-cpu-0.1.10)
@MyWestCity MyWestCity added the bug Something isn't working label May 30, 2024
@lyblsgo
Copy link
Collaborator

lyblsgo commented Jun 4, 2024

我们发布前Valgrind检测没有内存泄漏,可以多线程进行一下压测,观察下内存是否一直增长没有释放,目前不清楚是否是onnxruntime的缓存引起的

@MyWestCity
Copy link
Author

我们发布前Valgrind检测没有内存泄漏,可以多线程进行一下压测,观察下内存是否一直增长没有释放,目前不清楚是否是onnxruntime的缓存引起的

内存是一直在增长,但是速度不定,有时涨的多,有时又基本不涨,但是没有释放过。
我屏蔽掉runtime推理的API之后,
image
内存就基本不涨了,所以应该不是其他代码内存的问题。
同时我尝试了下屏蔽初始化模型时的设置代码
image
这样启动的时候内存会多占一些,但是后续推理的时候相对于之前涨的会慢得多

@lyblsgo
Copy link
Collaborator

lyblsgo commented Jun 4, 2024

我们发布前Valgrind检测没有内存泄漏,可以多线程进行一下压测,观察下内存是否一直增长没有释放,目前不清楚是否是onnxruntime的缓存引起的

内存是一直在增长,但是速度不定,有时涨的多,有时又基本不涨,但是没有释放过。 我屏蔽掉runtime推理的API之后, image 内存就基本不涨了,所以应该不是其他代码内存的问题。 同时我尝试了下屏蔽初始化模型时的设置代码 image 这样启动的时候内存会多占一些,但是后续推理的时候相对于之前涨的会慢得多

内存没有释放过不太可能,我观察过离线文件转写的内存是会释放的;
disablecpumemarena是禁止使用onnx内部内存管理

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants