Serving icon indicating copy to clipboard operation
Serving copied to clipboard

pipeline显存占用问题

Open melon12321 opened this issue 4 years ago • 5 comments

使用pipeline部署多个模型时,无论模型多大,总是会把显存都占满,请问可以调整哪个参数设置初始化显存大小呢

melon12321 avatar Oct 11 '21 03:10 melon12321

Message that will be displayed on users' first issue

github-actions[bot] avatar Oct 11 '21 03:10 github-actions[bot]

您好,pipeline部署占用的显存大小和多个因素相关。 1)和config.yml中每个op的concurrency设置有关系; 2)和模型计算精度相关; 3)计算过程中显存2次分配有关。

另外,您可以按此方法排查: 1.每个模型初始占用的显存(concurrency=1); 2.服务启动后未接收请求,看初始显存占用量; 3.服务接收大量请求课后,显存增量

最终确定显存占满的原因

TeslaZhao avatar Oct 11 '21 06:10 TeslaZhao

你好,感谢您的解答。 我关于您的建议做了如下测试, 1)将concurrency的大小缩小为1,发现显存占用大小不变; 2)服务启动后未接收请求,显存大小为9016MiB / 15109MiB; 3)服务接收请求后,14494MiB / 15109MiB; 我才用大模型或者轻量模型在显存2次分配后,所占都会达到即将满的状态,目前推测可能是跟显存2次分配有关,不知是否有相关参数可以控制?

melon12321 avatar Oct 11 '21 08:10 melon12321

对于模型在推理过程中分配显存是正常现象,要降低显存大小,一般会开启 低精度fp16,或者模型量化int8。同时可支持开启TensorRT。

示例:https://github.com/PaddlePaddle/Serving/blob/v0.6.0/python/examples/pipeline/simple_web_service/config.yml 文档:https://github.com/PaddlePaddle/Serving/blob/v0.6.0/doc/LOW_PRECISION_DEPLOYMENT_CN.md

TeslaZhao avatar Oct 11 '21 09:10 TeslaZhao

您好,我也是issue#767,Serving0.6多次调用接收请求后,显存不释放,13379MiB / 15109MiB,一开始5000M

Juruobudong avatar Aug 13 '22 08:08 Juruobudong