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
1d0cc015
Commit
1d0cc015
authored
May 15, 2024
by
choihk
Browse files
[fix] Add fixed sampling rate to feature extractor
parent
bdb03638
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
training/data.py
training/data.py
+6
-1
No files found.
training/data.py
View file @
1d0cc015
...
...
@@ -31,7 +31,12 @@ class DataCollatorEncodecWithPadding:
audios
=
[
feature
[
self
.
audio_column_name
][
"array"
]
for
feature
in
features
]
len_audio
=
[
len
(
audio
)
for
audio
in
audios
]
batch
=
self
.
feature_extractor
(
audios
,
return_tensors
=
"pt"
,
padding
=
self
.
padding
,
max_length
=
self
.
max_length
)
# since resampling has already been performed in the 'load_multiple_datasets' function,
# a fixed sampling_rate(44100hz) is passed to the feature_extractor.
sampling_rate
=
self
.
feature_extractor
.
sampling_rate
batch
=
self
.
feature_extractor
(
audios
,
sampling_rate
=
sampling_rate
,
return_tensors
=
"pt"
,
padding
=
self
.
padding
,
max_length
=
self
.
max_length
)
batch
[
"len_audio"
]
=
torch
.
tensor
(
len_audio
).
unsqueeze
(
1
)
return
batch
...
...
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