@@ -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":
|
||||||
|
|||||||
Reference in New Issue
Block a user