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

[Wav2vec2 + LM Test] Improve wav2vec2 with lm tests and make torch version dependent for now #18749

Conversation

patrickvonplaten
Copy link
Contributor

Trying to correct potentially flaky test:

tests/models/wav2vec2_with_lm/test_processor_wav2vec2_with_lm.py::Wav2Vec2ProcessorWithLMTest::test_word_time_stamp_integration

The test actually always passed for me locally.

I've now changed list to tensor as list comparison with float numbers seems brittle. @ydshieh - just to better understand, is this test consistently failing or was it flaky?

@ydshieh
Copy link
Collaborator

ydshieh commented Aug 24, 2022

It fails consistently since PT 1.12.

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Aug 24, 2022

The documentation is not available anymore as the PR was closed or merged.

@patrickvonplaten
Copy link
Contributor Author

patrickvonplaten commented Aug 24, 2022

Note after some more debugging the reason seems to be in datasets. E.g. this part of the test:

ds = load_dataset("common_voice", "en", split="train", streaming=True)
ds = ds.cast_column("audio", datasets.Audio(sampling_rate=16_000))
ds_iter = iter(ds)
sample = next(ds_iter)
print(sample["audio"]["array"])

yields different results between torchaudio=0.11.0 and torchaudio=0.12.1. Opening an issue in Datasets.

@patrickvonplaten patrickvonplaten changed the title [Wav2vec2 + LM Test] Improve wav2vec2 with lm tests [WIP][Wav2vec2 + LM Test] Improve wav2vec2 with lm tests Aug 24, 2022
@patrickvonplaten
Copy link
Contributor Author

@ydshieh good for a second review

@patrickvonplaten patrickvonplaten changed the title [WIP][Wav2vec2 + LM Test] Improve wav2vec2 with lm tests [Wav2vec2 + LM Test] Improve wav2vec2 with lm tests and make torch version dependent for now Aug 24, 2022
Copy link
Collaborator

@ydshieh ydshieh left a comment

Choose a reason for hiding this comment

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

Thank you @patrickvonplaten . LGTM, but probably a small change to make it better.


# TODO(Patrick): This if-else version statement should be removed once
# https://github.com/huggingface/datasets/issues/4889 is resolved
if version.parse(torch.__version__) >= version.parse("1.12.0"):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe let's use what has been done in
#18460
?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes definitely - thanks!

@patrickvonplaten patrickvonplaten merged commit 62ceb4d into huggingface:main Aug 26, 2022
@patrickvonplaten patrickvonplaten deleted the improve_wav2vec2_with_lm_tests branch August 26, 2022 12:11
oneraghavan pushed a commit to oneraghavan/transformers that referenced this pull request Sep 26, 2022
…rsion dependent for now (huggingface#18749)

* add first generation tutorial

* remove generation

* make version dependent expected values

* Apply suggestions from code review

* Update tests/models/wav2vec2_with_lm/test_processor_wav2vec2_with_lm.py

* fix typo
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.

3 participants