Spaces:
Running
on
A10G
Running
on
A10G
lengyue233
commited on
Commit
•
45eadd5
1
Parent(s):
9bd8a0b
Update app.py
Browse files
app.py
CHANGED
@@ -119,41 +119,19 @@ def build_html_error_message(error):
|
|
119 |
@GPU_DECORATOR
|
120 |
@torch.inference_mode()
|
121 |
def inference(req: ServeTTSRequest):
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
|
|
129 |
)
|
|
|
|
|
|
|
130 |
|
131 |
-
prompt_tokens = [
|
132 |
-
encode_reference(
|
133 |
-
decoder_model=decoder_model,
|
134 |
-
reference_audio=audio_to_bytes(str(ref_audio)),
|
135 |
-
enable_reference_audio=True,
|
136 |
-
)
|
137 |
-
for ref_audio in ref_audios
|
138 |
-
]
|
139 |
-
prompt_texts = [
|
140 |
-
read_ref_text(str(ref_audio.with_suffix(".lab")))
|
141 |
-
for ref_audio in ref_audios
|
142 |
-
]
|
143 |
-
|
144 |
-
else:
|
145 |
-
# Parse reference audio aka prompt
|
146 |
-
refs = req.references
|
147 |
-
|
148 |
-
prompt_tokens = [
|
149 |
-
encode_reference(
|
150 |
-
decoder_model=decoder_model,
|
151 |
-
reference_audio=ref.audio,
|
152 |
-
enable_reference_audio=True,
|
153 |
-
)
|
154 |
-
for ref in refs
|
155 |
-
]
|
156 |
-
prompt_texts = [ref.text for ref in refs]
|
157 |
if req.seed is not None:
|
158 |
set_seed(req.seed)
|
159 |
logger.warning(f"set seed: {req.seed}")
|
@@ -411,11 +389,27 @@ def build_app():
|
|
411 |
seed,
|
412 |
use_memory_cache,
|
413 |
):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
414 |
references = []
|
415 |
if reference_audio:
|
416 |
# 将文件路径转换为字节
|
417 |
with open(reference_audio, 'rb') as audio_file:
|
418 |
audio_bytes = audio_file.read()
|
|
|
419 |
references = [
|
420 |
ServeReferenceAudio(audio=audio_bytes, text=reference_text)
|
421 |
]
|
|
|
119 |
@GPU_DECORATOR
|
120 |
@torch.inference_mode()
|
121 |
def inference(req: ServeTTSRequest):
|
122 |
+
# Parse reference audio aka prompt
|
123 |
+
refs = req.references
|
124 |
+
|
125 |
+
prompt_tokens = [
|
126 |
+
encode_reference(
|
127 |
+
decoder_model=decoder_model,
|
128 |
+
reference_audio=ref.audio,
|
129 |
+
enable_reference_audio=True,
|
130 |
)
|
131 |
+
for ref in refs
|
132 |
+
]
|
133 |
+
prompt_texts = [ref.text for ref in refs]
|
134 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
if req.seed is not None:
|
136 |
set_seed(req.seed)
|
137 |
logger.warning(f"set seed: {req.seed}")
|
|
|
389 |
seed,
|
390 |
use_memory_cache,
|
391 |
):
|
392 |
+
print(
|
393 |
+
"call inference wrapper",
|
394 |
+
text,
|
395 |
+
normalize,
|
396 |
+
reference_audio,
|
397 |
+
reference_text,
|
398 |
+
max_new_tokens,
|
399 |
+
chunk_length,
|
400 |
+
top_p,
|
401 |
+
repetition_penalty,
|
402 |
+
temperature,
|
403 |
+
seed,
|
404 |
+
use_memory_cache
|
405 |
+
)
|
406 |
+
|
407 |
references = []
|
408 |
if reference_audio:
|
409 |
# 将文件路径转换为字节
|
410 |
with open(reference_audio, 'rb') as audio_file:
|
411 |
audio_bytes = audio_file.read()
|
412 |
+
|
413 |
references = [
|
414 |
ServeReferenceAudio(audio=audio_bytes, text=reference_text)
|
415 |
]
|