Skip to content

内存泄露问题 #1218

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

Open
LonelyTaker opened this issue Jun 21, 2024 · 7 comments
Open

内存泄露问题 #1218

LonelyTaker opened this issue Jun 21, 2024 · 7 comments

Comments

@LonelyTaker
Copy link

_batch_audio_fragment = (self.vits_model.decode( all_pred_semantic, _batch_phones, refer_audio_spec ).detach()[0, 0, :])

目前定位到这条语句存在明显的内存泄露现象。想请问下是什么原因导致?

@ChasonJiang
Copy link
Contributor

@LonelyTaker 正常推理之后没有释放显存吗?

@LonelyTaker
Copy link
Author

@LonelyTaker 正常推理之后没有释放显存吗?

不是显存,内存未被释放

@LonelyTaker
Copy link
Author

@LonelyTaker 正常推理之后没有释放显存吗?

随着推理请求的增多,占用内存会不断增加,即使释放模型,也无法释放掉占用的内存

@ChasonJiang
Copy link
Contributor

随着推理请求的增多,占用内存会不断增加,即使释放模型,也无法释放掉占用的内存

了解了

CyberWon added a commit to CyberWon/GPT-SoVITS that referenced this issue Jun 23, 2024
在推理完成之后,使用gc控制器对内存进行回收。
RVC-Boss#1218
RVC-Boss pushed a commit that referenced this issue Jun 26, 2024
在推理完成之后,使用gc控制器对内存进行回收。
#1218
@ysujiang
Copy link

ysujiang commented Aug 5, 2024

@LonelyTaker 正常推理之后没有释放显存吗?

随着推理请求的增多,占用内存会不断增加,即使释放模型,也无法释放掉占用的内存

请问这个问题有解决吗

@LonelyTaker
Copy link
Author

@LonelyTaker 正常推理之后没有释放显存吗?

随着推理请求的增多,占用内存会不断增加,即使释放模型,也无法释放掉占用的内存

请问这个问题有解决吗

@fubuki
Copy link

fubuki commented Dec 17, 2024

@LonelyTaker 可以試試設定 TORCH_CUDNN_V8_API_DISABLED=1,我自己測試加上該環境變數後就沒有出現記憶體增長的現象 。

我自己做開發時發現在 torch 2.2.1 的版本下,在做 Conv1d 時會有 memory leak 的現象,查閱相關文章後發現可能是 torch 會對卷積層的計算結果做 cache。

然後該 cache 機制是在 CUDNN V8 版本才有的,可以透過上述環境變數停用該機制。

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

4 participants