1
0
mirror of https://github.com/fumiama/Retrieval-based-Voice-Conversion-WebUI.git synced 2026-06-06 09:40:24 +08:00

Fix memory doesn't unload on mps device (#2035)

* Solving the cache not being cleared in mps

* Fix protect not to be dict
This commit is contained in:
Ftps
2024-05-05 15:22:37 +09:00
committed by GitHub
parent fb16ba36b9
commit d255818097
3 changed files with 13 additions and 10 deletions

View File

@@ -62,6 +62,8 @@ class VC:
) = None
if torch.cuda.is_available():
torch.cuda.empty_cache()
elif torch.backends.mps.is_available():
torch.mps.empty_cache()
###楼下不这么折腾清理不干净
self.if_f0 = self.cpt.get("f0", 1)
self.version = self.cpt.get("version", "v1")
@@ -82,18 +84,12 @@ class VC:
del self.net_g, self.cpt
if torch.cuda.is_available():
torch.cuda.empty_cache()
elif torch.backends.mps.is_available():
torch.mps.empty_cache()
return (
{"visible": False, "__type__": "update"},
{
"visible": True,
"value": to_return_protect0,
"__type__": "update",
},
{
"visible": True,
"value": to_return_protect1,
"__type__": "update",
},
to_return_protect0,
to_return_protect1,
"",
"",
)