Skip to content

Conversation

@vincentqb
Copy link
Contributor

@vincentqb vincentqb commented Nov 5, 2019

Since this is what has been most used in domains, we keep tuples as the item to return for now.

for CommonVoice:

    # dictionary with keys:
    # client_id, path, sentence, up_votes, down_votes, age, gender, accent
    return waveform, sample_rate, dictionary

for LibriSpeech:

    return (
        waveform,
        sample_rate,
        utterance,
        int(speaker_id),
        int(chapter_id),
        int(utterance_id),
    )

for VCTK:

    return waveform, sample_rate, utterance, speaker_id, utterance_id

for YesNo:

    # labels = [int(c), ...]
    return waveform, sample_rate, labels

CC #303

"waveform": waveform,
"sample_rate": sample_rate,
}
with open(file_text) as ft:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding this as part of this PR to make sure that the file is closed.

utterance,
int(speaker_id),
int(chapter_id),
int(utterance_id),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also converting to int though they come from file names.

def load_yesno_item(fileid, path, ext_audio):
# Read label
label = fileid.split("_")
labels = [int(c) for c in fileid.split("_")]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also converting to int though they come from file names.

@vincentqb
Copy link
Contributor Author

Just modified CommonVoice to return a tuple (waveform, sample_rate, dictionary), where the dictionary contains the data and header from the tsv. This is closer to how the data is provided by CommonVoice. The only assumption on the tsv is that the second column is the name of the audio file to retrieve.

The previous iteration was:

    # waveform, sample_rate, client_id, path, sentence, up_votes, down_votes, age, gender, accent
    return(waveform, sample_rate, *line)

P.S. The notation with *line is not compatible with python 2.

@vincentqb vincentqb merged commit 38d1a9b into pytorch:master Nov 6, 2019
@vincentqb vincentqb deleted the notnamedtuple branch November 6, 2019 23:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants