PaddlePaddle / PaddleOCR

Awesome multilingual OCR toolkits based on PaddlePaddle (practical ultra lightweight OCR system, support 80+ languages recognition, provide data annotation and synthesis tools, support training and deployment among server, mobile, embedded and IoT devices)
https://paddlepaddle.github.io/PaddleOCR/
Apache License 2.0
43.53k stars 7.77k forks source link

GPU无法释放 #3673

Closed yuxx0218 closed 2 years ago

yuxx0218 commented 3 years ago

PaddleOCR-2.1分支。 显存无法释放。 inference完了之后,用time.sleep睡个几分钟,就会发现,显存在这期间根本无法释放。只有sleep结束,进程关掉,显存才会释放。 换句话说,copy_from_cpu的tensor,可能一直存在predicter的内部,只要程序不停止,predicter一直在,拷贝到gpu的tensor就一直不会释放。 而实际项目部署的时候,不可能每访问一次ocr,就重新创建一个predicter的,所以这个一个非常重大的bug。

yuxx0218 commented 3 years ago

predictor.try_shrink_memory() predictor.clear_intermediate_tensor() 都是不好使的。 @MissPenguin

yuxx0218 commented 3 years ago

测试发现,内存也有同样的问题,安卓内存也是。实际工程项目就完全无法使用了。有解决办法吗?如果没有,下一个版本会优化吗?

yuxx0218 commented 3 years ago

@MissPenguin 目前有办法吗?这个后面会修复吗?

MissPenguin commented 3 years ago

您好,Paddle目前的机制就是这样的哈,进程结束才会释放显存,这个是框架特性,PaddleOCR这边不会在这方面做优化呢。。

paddle-bot-old[bot] commented 2 years ago

Since you haven\'t replied for more than 3 months, we have closed this issue/pr. If the problem is not solved or there is a follow-up one, please reopen it at any time and we will continue to follow up. It is recommended to pull and try the latest code first. 由于您超过三个月未回复,我们将关闭这个issue/pr。 若问题未解决或有后续问题,请随时重新打开(建议先拉取最新代码进行尝试),我们会继续跟进。