Spaces:
Sleeping
Sleeping
zhzluke96
commited on
Commit
•
43c9aae
1
Parent(s):
563fae6
update
Browse files- modules/models.py +0 -4
modules/models.py
CHANGED
@@ -14,13 +14,11 @@ chat_tts = None
|
|
14 |
# huggingface Error:
|
15 |
# RuntimeError: CUDA must not be initialized in the main process on Spaces with Stateless GPU environment.
|
16 |
# You can look at this Stacktrace to find out which part of your code triggered a CUDA init
|
17 |
-
load_event = threading.Event()
|
18 |
|
19 |
|
20 |
def load_chat_tts_in_thread():
|
21 |
global chat_tts
|
22 |
if chat_tts:
|
23 |
-
load_event.set()
|
24 |
return
|
25 |
|
26 |
logger.info("Loading ChatTTS models")
|
@@ -38,7 +36,6 @@ def load_chat_tts_in_thread():
|
|
38 |
)
|
39 |
|
40 |
devices.torch_gc()
|
41 |
-
load_event.set()
|
42 |
logger.info("ChatTTS models loaded")
|
43 |
|
44 |
|
@@ -51,7 +48,6 @@ def initialize_chat_tts():
|
|
51 |
def load_chat_tts():
|
52 |
if chat_tts is None:
|
53 |
initialize_chat_tts().join()
|
54 |
-
load_event.wait()
|
55 |
if chat_tts is None:
|
56 |
raise Exception("Failed to load ChatTTS models")
|
57 |
return chat_tts
|
|
|
14 |
# huggingface Error:
|
15 |
# RuntimeError: CUDA must not be initialized in the main process on Spaces with Stateless GPU environment.
|
16 |
# You can look at this Stacktrace to find out which part of your code triggered a CUDA init
|
|
|
17 |
|
18 |
|
19 |
def load_chat_tts_in_thread():
|
20 |
global chat_tts
|
21 |
if chat_tts:
|
|
|
22 |
return
|
23 |
|
24 |
logger.info("Loading ChatTTS models")
|
|
|
36 |
)
|
37 |
|
38 |
devices.torch_gc()
|
|
|
39 |
logger.info("ChatTTS models loaded")
|
40 |
|
41 |
|
|
|
48 |
def load_chat_tts():
|
49 |
if chat_tts is None:
|
50 |
initialize_chat_tts().join()
|
|
|
51 |
if chat_tts is None:
|
52 |
raise Exception("Failed to load ChatTTS models")
|
53 |
return chat_tts
|