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

Feature needed to prevent user error when sample rates or channels vary #12

Open
rbracco opened this issue Jan 15, 2020 · 2 comments
Open
Labels
enhancement New feature or request

Comments

@rbracco
Copy link
Collaborator

rbracco commented Jan 15, 2020

This is a very common error when making a batch:
RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 0. Got 1 and 2 in dimension 1

and is a result of doing one of the following 4 things.

  1. mixing mono and stereo or...
  2. different sample rates or...
  3. you forgot to crop to same width or...
  4. you cropped to same width but did a transform after that altered width somehow

It would be very nice if we added warnings to alert users to presence of multiple sample rates (Resample required) or varying # of channels (downmix required), or neither (crop required).

@scart97 scart97 added the enhancement New feature or request label Feb 5, 2020
@PranY
Copy link
Contributor

PranY commented Mar 27, 2020

I recently faced 1 and 2 and eventually solved 1 by writing a custom method and 2 by using a custom sox hack. I didn't know about DownminToMono and Resample before.

I think the way I traced the error is a good fix to the above situation. I can write a method verify_pipeline() that takes the pipeline of transformations or tfms in-general, loop through transform and tells where exactly the problem lies.

If this approach makes sense to you then please give me a thumbs-up and I'll write, test and send a PR.

@mogwai
Copy link
Member

mogwai commented Apr 2, 2020

That could be interesting, I was thinking of writing a verify pipeline for another features that we're still missing from the previous version. I think that this may be useful so please feel free to open PR and we can continue the discussion there. Thanks again for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants