Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
parler-tts
Commits
1551b7c5
Unverified
Commit
1551b7c5
authored
Aug 07, 2024
by
Yoach Lacombe
Committed by
GitHub
Aug 07, 2024
Browse files
add possibility to have audio_output_lengths (#91)
parent
862f8418
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
parler_tts/modeling_parler_tts.py
parler_tts/modeling_parler_tts.py
+3
-1
No files found.
parler_tts/modeling_parler_tts.py
View file @
1551b7c5
...
...
@@ -3511,6 +3511,7 @@ class ParlerTTSForConditionalGeneration(PreTrainedModel):
output_ids
,
audio_scales
=
audio_scales
,
).
audio_values
.
squeeze
(
1
)
output_lengths
=
[
audio
.
shape
[
0
]
for
audio
in
output_values
]
else
:
output_values
=
[]
for
sample_id
in
range
(
batch_size
):
...
...
@@ -3522,13 +3523,14 @@ class ParlerTTSForConditionalGeneration(PreTrainedModel):
output_values
.
append
(
sample
.
transpose
(
0
,
2
))
else
:
output_values
.
append
(
torch
.
zeros
((
1
,
1
,
1
)).
to
(
self
.
device
))
# TODO: we should keep track of
output
length
as well. Not really straightforward tbh
output
_
length
s
=
[
audio
.
shape
[
0
]
for
audio
in
output_values
]
output_values
=
(
torch
.
nn
.
utils
.
rnn
.
pad_sequence
(
output_values
,
batch_first
=
True
,
padding_value
=
0
)
.
squeeze
(
-
1
)
.
squeeze
(
-
1
)
)
if
generation_config
.
return_dict_in_generate
:
outputs
[
"audios_length"
]
=
output_lengths
outputs
.
sequences
=
output_values
return
outputs
else
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment