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

显存爆了!!! #20

Closed
zwl995 opened this issue Mar 10, 2023 · 1 comment
Closed

显存爆了!!! #20

zwl995 opened this issue Mar 10, 2023 · 1 comment

Comments

@zwl995
Copy link

zwl995 commented Mar 10, 2023

博主,你好,我想请教一下,我使用libtorch cuda版本进行推理时,显存一直在增加直到爆内存,这是什么原因?下面时我调用的方法,,每次来一张图像就会调用这个函数进行推理,模型和数据都放到cuda了,推理完把数据放cpu,使用c10::cuda::CUDACachingAllocator::emptyCache()好像没有用
image

@AllentDan
Copy link
Owner

可能存在的问题哈,你这个函数如果频繁调用的话,会每次将模型从 cpu 到 gpu 再到 cpu,pytorch 模型从 gpu 到cpu 的话,显存好像不会完全释放。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants