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
OpenDAS
Torchaudio
Commits
70fd2f3d
"fs/git@developer.sourcefind.cn:OpenDAS/ollama.git" did not exist on "903b1fc97f37fda25fd233ed853355acfc0f63cf"
Unverified
Commit
70fd2f3d
authored
Dec 30, 2020
by
Aziz
Committed by
GitHub
Dec 30, 2020
Browse files
Refactor vctk unittest (#1134)
parent
93c3025f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
42 deletions
+50
-42
test/torchaudio_unittest/datasets/vctk_test.py
test/torchaudio_unittest/datasets/vctk_test.py
+50
-42
No files found.
test/torchaudio_unittest/datasets/vctk_test.py
View file @
70fd2f3d
...
@@ -12,7 +12,7 @@ from torchaudio_unittest.common_utils import (
...
@@ -12,7 +12,7 @@ from torchaudio_unittest.common_utils import (
)
)
# Used to generate a unique utterance for each dummy audio file
# Used to generate a unique utterance for each dummy audio file
UTTERANCE
=
[
_
UTTERANCE
=
[
'Please call Stella'
,
'Please call Stella'
,
'Ask her to bring these things'
,
'Ask her to bring these things'
,
'with her from the store'
,
'with her from the store'
,
...
@@ -27,16 +27,12 @@ UTTERANCE = [
...
@@ -27,16 +27,12 @@ UTTERANCE = [
]
]
class
TestVCTK
(
TempDirMixin
,
TorchaudioTestCase
):
def
get_mock_dataset
(
root_dir
):
backend
=
'default'
"""
root_dir: root directory of the mocked data
root_dir
=
None
"""
samples
=
[]
mocked_samples
=
[]
dataset_dir
=
os
.
path
.
join
(
root_dir
,
'VCTK-Corpus-0.92'
)
@
classmethod
def
setUpClass
(
cls
):
cls
.
root_dir
=
cls
.
get_base_temp_dir
()
dataset_dir
=
os
.
path
.
join
(
cls
.
root_dir
,
'VCTK-Corpus-0.92'
)
os
.
makedirs
(
dataset_dir
,
exist_ok
=
True
)
os
.
makedirs
(
dataset_dir
,
exist_ok
=
True
)
sample_rate
=
48000
sample_rate
=
48000
seed
=
0
seed
=
0
...
@@ -63,7 +59,7 @@ class TestVCTK(TempDirMixin, TorchaudioTestCase):
...
@@ -63,7 +59,7 @@ class TestVCTK(TempDirMixin, TorchaudioTestCase):
save_wav
(
audio_file_path
,
data
,
sample_rate
)
save_wav
(
audio_file_path
,
data
,
sample_rate
)
txt_file_path
=
os
.
path
.
join
(
file_dir
,
filename
[:
-
5
]
+
'.txt'
)
txt_file_path
=
os
.
path
.
join
(
file_dir
,
filename
[:
-
5
]
+
'.txt'
)
utterance
=
UTTERANCE
[
utterance_id
-
1
]
utterance
=
_
UTTERANCE
[
utterance_id
-
1
]
with
open
(
txt_file_path
,
'w'
)
as
f
:
with
open
(
txt_file_path
,
'w'
)
as
f
:
f
.
write
(
utterance
)
f
.
write
(
utterance
)
...
@@ -74,9 +70,21 @@ class TestVCTK(TempDirMixin, TorchaudioTestCase):
...
@@ -74,9 +70,21 @@ class TestVCTK(TempDirMixin, TorchaudioTestCase):
speaker_id
,
speaker_id
,
utterance_id
utterance_id
)
)
cls
.
samples
.
append
(
sample
)
mocked_samples
.
append
(
sample
)
seed
+=
1
seed
+=
1
return
mocked_samples
class
TestVCTK
(
TempDirMixin
,
TorchaudioTestCase
):
backend
=
'default'
root_dir
=
None
samples
=
[]
@
classmethod
def
setUpClass
(
cls
):
cls
.
root_dir
=
cls
.
get_base_temp_dir
()
cls
.
samples
=
get_mock_dataset
(
cls
.
root_dir
)
def
_test_vctk
(
self
,
dataset
):
def
_test_vctk
(
self
,
dataset
):
num_samples
=
0
num_samples
=
0
...
...
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