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 subclass in model test classes #727

Merged
merged 3 commits into from Jun 23, 2020
Merged

Conversation

jimchen90
Copy link
Contributor

@jimchen90 jimchen90 commented Jun 18, 2020

Add subclass common_utils.TorchaudioTestCase in model test classes.
Related to #705

Copy link
Contributor

@vincentqb vincentqb left a comment

Choose a reason for hiding this comment

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

As mentioned here, unittest.TestCase is enough to run internal tests. LGTM.

@vincentqb
Copy link
Contributor

oops, should have waited "ready for review" :)

@jimchen90 jimchen90 marked this pull request as ready for review June 18, 2020 15:45
import torch
from torchaudio.models import Wav2Letter, _MelResNet


class TestWav2Letter:
class TestWav2Letter(unittest.TestCase):
Copy link
Collaborator

@mthrok mthrok Jun 18, 2020

Choose a reason for hiding this comment

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

To stick with the latest guideline, instead of unittest.TestCase, can you use TorchaudioTestCase from common_utils?
It's available in the latest master.

@@ -49,3 +51,6 @@ def test_waveform(self):
out = model(x)

assert out.size() == (batch_size, output_dims, num_features - pad * 2)

if __name__ == '__main__':
unittest.main()
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit/very subjective: although it does not hurt but I personally find adding unittest.main redundant and unnecessary.

Copy link
Contributor

Choose a reason for hiding this comment

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

:) since the other tests have it, let's keep that line in for consistency with the other files and other domains (e.g. here), but feel free to open a pull request to discuss removing them all

Copy link
Collaborator

Choose a reason for hiding this comment

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

FYI: It was added to the other files without review or approval in #509, and it is not used by any official automated jobs. So it is not very convincing to keep this for the sake of consistency.

Copy link
Contributor

@vincentqb vincentqb Jun 19, 2020

Choose a reason for hiding this comment

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

since we don't want to block this PR on this, feel free to open a separate PR to change this everywhere :)

Copy link
Contributor

Choose a reason for hiding this comment

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

@jimchen90 -- can you move this change to a separate pull request? thanks!

Copy link
Contributor Author

@jimchen90 jimchen90 Jun 21, 2020

Choose a reason for hiding this comment

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

Yes. Thanks
Related to #744

@jimchen90 jimchen90 merged commit b8ddeb3 into pytorch:master Jun 23, 2020
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

3 participants