改用修饰器

This commit is contained in:
XTer 2024-04-06 23:51:47 +08:00
parent 6591e86df3
commit 7f8892d004

View File

@ -569,7 +569,8 @@ class TTS:
'''
self.stop_flag = True
# 使用装饰器
@torch.no_grad()
def run(self, inputs:dict):
"""
Text to speech inference.
@ -600,8 +601,7 @@ class TTS:
# 直接给全体套一个torch.no_grad()
with torch.no_grad():
########## variables initialization ###########
self.stop_flag:bool = False
text:str = inputs.get("text", "")