Skip to content

Update audio preprocessing tutorial #797

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

Merged
merged 2 commits into from
Jan 16, 2020
Merged

Update audio preprocessing tutorial #797

merged 2 commits into from
Jan 16, 2020

Conversation

CamiWilliams
Copy link
Contributor

@CamiWilliams CamiWilliams commented Dec 20, 2019

Updating the audio tutorial for the Jan 7 release

In a following update of the tutorial, we will want:

Lower priority items:

@netlify
Copy link

netlify bot commented Dec 20, 2019

Deploy preview for pytorch-tutorials-preview ready!

Built with commit e08a480

https://deploy-preview-797--pytorch-tutorials-preview.netlify.com

@vincentqb
Copy link
Contributor

Here's the existing tutorial, the source code, added in this PR derived from this notebook using this script.

@vincentqb
Copy link
Contributor

vincentqb commented Dec 20, 2019

Here are the notes I wrote from our chats :)

When the binaries are released on Jan 7, we want to showcase in the tutorial:

In a following update of the tutorial, we will want:

Lower priority items:

@vincentqb
Copy link
Contributor

FYI #600 is an open issue about generated plots and white space around them

@CamiWilliams
Copy link
Contributor Author

I need some help with the example for augmentations. I tried to replicate what the PR example had in my collab, but I am missing some pieces:

num_freqs, hop_length = 400, 512
model = torch.nn.Sequential(torch.stft(waveform, frame_length=hop_length, fft_size=(num_freqs - 1) * 2),
                           torchaudio.transforms.TimeStretch(freq=num_freqs, hop_length=hop_length, fixed_rate=1.3),
                           torchaudio.transforms.ComplexNorm(power=2.0),
                           torchaudio.transforms.FrequencyMasking(freq_mask_param=60, iid_masks=False),
                           torchaudio.transforms.TimeMasking(time_mask_param=30, iid_masks=False),
                           torchaudio.transforms.AmplitudeToDB() )
out = model(waveform)
plot_heatmap(out)
  • I am constructing torch.stft incorrectly, how would i use this on my current waveform?
  • Where can I find implementations of model and plot_heatmap?
  • Are the augmentations going to live in torchaudio.augmentations or torchaudio.transforms? Found code for both.

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.

Thanks for working on this!

@vincentqb
Copy link
Contributor

I need some help with the example for augmentations. I tried to replicate what the PR example had in my collab, but I am missing some pieces:

num_freqs, hop_length = 400, 512
model = torch.nn.Sequential(torch.stft(waveform, frame_length=hop_length, fft_size=(num_freqs - 1) * 2),
                           torchaudio.transforms.TimeStretch(freq=num_freqs, hop_length=hop_length, fixed_rate=1.3),
                           torchaudio.transforms.ComplexNorm(power=2.0),
                           torchaudio.transforms.FrequencyMasking(freq_mask_param=60, iid_masks=False),
                           torchaudio.transforms.TimeMasking(time_mask_param=30, iid_masks=False),
                           torchaudio.transforms.AmplitudeToDB() )
out = model(waveform)
plot_heatmap(out)
  • I am constructing torch.stft incorrectly, how would i use this on my current waveform?

torchaudio.transforms.spectrogram with power=None does that.

  • Where can I find implementations of model and plot_heatmap?

You are constructing model yourself in the example when you do:

model = torch.nn.Sequential(...)

Is that what you mean?

plot_heatmap is a custom function made by some user. How about looking into matplotlib with imshow or other ones we already use in the tutorial?

  • Are the augmentations going to live in torchaudio.augmentations or torchaudio.transforms? Found code for both.

They are in torchaudio.transforms, see code for v0.4.0.

@CamiWilliams CamiWilliams changed the title [WIP] Update audio preprocessing tutorial Update audio preprocessing tutorial Jan 7, 2020
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.

Thanks for the update!

The release was pushed to Jan 14, so we have a few more days :)

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.

I gave some feedback on dataset section, but otherwise LGTM!

  • We need to rebase/merge master, since the branch is out-of-date.
  • We'll take a look at the preview once it is regenerated
  • We need to test locally, since CI will fail until torchaudio is released.
  • We can merge this PR once torchaudio is released :)

@brianjo
Copy link
Contributor

brianjo commented Jan 13, 2020

@CamiWilliams @vincentqb Could you all look at the build logs for this and flag what the build issue would be: https://app.circleci.com/jobs/github/pytorch/tutorials/21752 Assuming it might need 1.4 or an updated torchaudio version? Thanks! FYI @jlin27

@vincentqb
Copy link
Contributor

@CamiWilliams @vincentqb Could you all look at the build logs for this and flag what the build issue would be: https://app.circleci.com/jobs/github/pytorch/tutorials/21752 Assuming it might need 1.4 or an updated torchaudio version? Thanks! FYI @jlin27

Jan 13 16:54:55 AttributeError: module 'torchaudio.functional' has no attribute 'compute_deltas'

This requires torchaudio 0.4.0 that isn't released yet.

@brianjo
Copy link
Contributor

brianjo commented Jan 13, 2020 via email

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.

Thanks, LGTM! As mentioned before, once torchaudio 0.4.0 is released, we should rebase, rerun the build, and merge.

@vincentqb
Copy link
Contributor

vincentqb commented Jan 16, 2020

Binaries for torchaudio are now available :)

Reference: pytorch/audio#410

@vincentqb
Copy link
Contributor

vincentqb commented Jan 16, 2020

The error below is due to sox, see pytorch/audio#171.

Jan 16 00:31:36 Unexpected failing examples:
Jan 16 00:31:36 /var/lib/jenkins/workspace/beginner_source/audio_preprocessing_tutorial.py failed leaving traceback:
Jan 16 00:31:36 Traceback (most recent call last):
Jan 16 00:31:36   File "/opt/conda/lib/python3.6/site-packages/sphinx_gallery/gen_rst.py", line 394, in _memory_usage
Jan 16 00:31:36     out = func()
Jan 16 00:31:36   File "/opt/conda/lib/python3.6/site-packages/sphinx_gallery/gen_rst.py", line 382, in __call__
Jan 16 00:31:36     exec(self.code, self.globals)
Jan 16 00:31:36   File "/var/lib/jenkins/workspace/beginner_source/audio_preprocessing_tutorial.py", line 21, in <module>
Jan 16 00:31:36     import torchaudio
Jan 16 00:31:36   File "/opt/conda/lib/python3.6/site-packages/torchaudio/__init__.py", line 5, in <module>
Jan 16 00:31:36     import _torch_sox
Jan 16 00:31:36 ImportError: /opt/conda/lib/python3.6/site-packages/_torch_sox.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZN6caffe26detail37_typeMetaDataInstance_preallocated_29E

@CamiWilliams -- Can you trigger a rerun of the tests to see if the error persists? I can't reproduce offline. Let's wait until we know what happens before merging.

@vincentqb
Copy link
Contributor

vincentqb commented Jan 16, 2020

Yay! Checks are all green now. Ready to merge!

@CamiWilliams CamiWilliams merged commit 0dc37b5 into pytorch:master Jan 16, 2020
@brianjo
Copy link
Contributor

brianjo commented Jan 16, 2020

Nice job @CamiWilliams. Output looks good. :)

@CamiWilliams CamiWilliams deleted the audiotutorial branch January 16, 2020 22:30
rodrigo-techera pushed a commit to Experience-Monks/tutorials that referenced this pull request Nov 29, 2021
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