mirror of
https://github.com/RVC-Boss/GPT-SoVITS.git
synced 2025-04-06 03:57:44 +08:00
parent
afbcf4007a
commit
8dd7cfab93
@ -1,6 +1,6 @@
|
|||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
import math
|
import math
|
||||||
import os, sys
|
import os, sys, gc
|
||||||
import random
|
import random
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
@ -870,6 +870,7 @@ class TTS:
|
|||||||
|
|
||||||
def empty_cache(self):
|
def empty_cache(self):
|
||||||
try:
|
try:
|
||||||
|
gc.collect() # 触发gc的垃圾回收。避免内存一直增长。
|
||||||
if "cuda" in str(self.configs.device):
|
if "cuda" in str(self.configs.device):
|
||||||
torch.cuda.empty_cache()
|
torch.cuda.empty_cache()
|
||||||
elif str(self.configs.device) == "mps":
|
elif str(self.configs.device) == "mps":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user