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
2c07658b
"tutorials/cpu/argo_tutorial.py" did not exist on "9d9e223783865b5f3fba98af921db4509c0d5069"
Unverified
Commit
2c07658b
authored
Oct 13, 2020
by
moto
Committed by
GitHub
Oct 13, 2020
Browse files
Make VCTK_092 return regular type for the consistency (#949)
parent
c92392fc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
8 deletions
+6
-8
torchaudio/datasets/vctk.py
torchaudio/datasets/vctk.py
+6
-8
No files found.
torchaudio/datasets/vctk.py
View file @
2c07658b
import
os
import
os
import
warnings
import
warnings
from
typing
import
Any
,
Tuple
from
typing
import
Any
,
Tuple
from
collections
import
namedtuple
import
torchaudio
import
torchaudio
from
torch
import
Tensor
from
torch
import
Tensor
...
@@ -18,10 +17,6 @@ _CHECKSUMS = {
...
@@ -18,10 +17,6 @@ _CHECKSUMS = {
"https://datashare.is.ed.ac.uk/bitstream/handle/10283/3443/VCTK-Corpus-0.92.zip"
:
"8a6ba2946b36fcbef0212cad601f4bfa"
"https://datashare.is.ed.ac.uk/bitstream/handle/10283/3443/VCTK-Corpus-0.92.zip"
:
"8a6ba2946b36fcbef0212cad601f4bfa"
}
}
Sample
=
namedtuple
(
"Sample"
,
[
"waveform"
,
"sample_rate"
,
"utterance"
,
"speaker_id"
,
"utterance_id"
]
)
def
load_vctk_item
(
fileid
:
str
,
def
load_vctk_item
(
fileid
:
str
,
path
:
str
,
path
:
str
,
...
@@ -163,6 +158,9 @@ class VCTK(Dataset):
...
@@ -163,6 +158,9 @@ class VCTK(Dataset):
return
len
(
self
.
_walker
)
return
len
(
self
.
_walker
)
SampleType
=
Tuple
[
Tensor
,
int
,
str
,
str
,
str
]
class
VCTK_092
(
Dataset
):
class
VCTK_092
(
Dataset
):
"""Create VCTK 0.92 Dataset
"""Create VCTK 0.92 Dataset
...
@@ -253,7 +251,7 @@ class VCTK_092(Dataset):
...
@@ -253,7 +251,7 @@ class VCTK_092(Dataset):
def
_load_audio
(
self
,
file_path
)
->
Tuple
[
Tensor
,
int
]:
def
_load_audio
(
self
,
file_path
)
->
Tuple
[
Tensor
,
int
]:
return
torchaudio
.
load
(
file_path
)
return
torchaudio
.
load
(
file_path
)
def
_load_sample
(
self
,
speaker_id
:
str
,
utterance_id
:
str
,
mic_id
:
str
)
->
Sample
:
def
_load_sample
(
self
,
speaker_id
:
str
,
utterance_id
:
str
,
mic_id
:
str
)
->
Sample
Type
:
utterance_path
=
os
.
path
.
join
(
utterance_path
=
os
.
path
.
join
(
self
.
_txt_dir
,
speaker_id
,
f
"
{
speaker_id
}
_
{
utterance_id
}
.txt"
self
.
_txt_dir
,
speaker_id
,
f
"
{
speaker_id
}
_
{
utterance_id
}
.txt"
)
)
...
@@ -269,9 +267,9 @@ class VCTK_092(Dataset):
...
@@ -269,9 +267,9 @@ class VCTK_092(Dataset):
# Reading FLAC
# Reading FLAC
waveform
,
sample_rate
=
self
.
_load_audio
(
audio_path
)
waveform
,
sample_rate
=
self
.
_load_audio
(
audio_path
)
return
Sample
(
waveform
,
sample_rate
,
utterance
,
speaker_id
,
utterance_id
)
return
(
waveform
,
sample_rate
,
utterance
,
speaker_id
,
utterance_id
)
def
__getitem__
(
self
,
n
:
int
)
->
Sample
:
def
__getitem__
(
self
,
n
:
int
)
->
Sample
Type
:
"""Load the n-th sample from the dataset.
"""Load the n-th sample from the dataset.
Args:
Args:
...
...
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