Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test for LibriSpeech dataset #825

Merged
merged 3 commits into from Jul 27, 2020
Merged

Conversation

edwardhdlu
Copy link
Contributor

LibriSpeech test using emulated data as part of #821.

pytest test/datasets/datasets_test.py

@codecov
Copy link

codecov bot commented Jul 24, 2020

Codecov Report

Merging #825 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #825   +/-   ##
=======================================
  Coverage   89.99%   89.99%           
=======================================
  Files          35       35           
  Lines        2719     2719           
=======================================
  Hits         2447     2447           
  Misses        272      272           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 45761f0...a97c508. Read the comment docs.

Copy link
Collaborator

@mthrok mthrok left a comment

Choose a reason for hiding this comment

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

Looks good. Left some comments for further improvement

f.write('\n'.join(trans_content))

def test_librispeech(self):
dataset = librispeech.LIBRISPEECH(self.root_dir, ext_audio='.wav')
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of making ext_audio argument, you can simply add the instance attribute like, which shadows the corresponding class attribute

dataset = librispeech.LIBRISPEECH(self.root_dir)
dataset._ext_audio = 'flac'

this way, LIBRISPEECH class can stay as is.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried this originally but _ext_audio is used by the walker in __init__, so it appears that it looks for the files before the extension can be updated

Copy link
Collaborator

Choose a reason for hiding this comment

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

You are right. In that case you can temporarily override the class attribute like librispeech.LIBRISPEECH._ext_audio = 'wav' before instantiating it. Do this in setUp method, then revert it in tearDown method so that test failure would not leave the default extension changed.


utterance = ' '.join(
[NUMBERS[int(x)] for x in list(
str(speaker_id) + str(chapter_id) + str(utterance_id)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of converting the integers to a list of characters them back to integers, you can simply do NUMBERS[x] for x in [speaker_id, chapter_id, uyterance_id]

Copy link
Collaborator

@mthrok mthrok left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks!

@mthrok mthrok merged commit 577796b into pytorch:master Jul 27, 2020
mthrok pushed a commit to mthrok/audio that referenced this pull request Dec 13, 2022
Co-authored-by: Holly Sweeney <77758406+holly1238@users.noreply.github.com>
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.

None yet

2 participants