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

Could you please claim those augmentations that are differentiable? #152

Closed
xinghua-qu opened this issue Jul 11, 2022 · 10 comments
Closed

Comments

@xinghua-qu
Copy link

Hi, thanks for providing this package for audio augmentation.

Currently, I am trying to introduce these augmentations into a forward function of torch model. However, some of them are not differentiable.
Could you please mark out those differentiable ones and those not?

Many thanks from Singapore!

@iver56
Copy link
Collaborator

iver56 commented Jul 11, 2022

Hi :) There is a .py-file for differentiability tests in the tests folder. You can see there that some transforms are intentionally skipped because they are not differentiable. I am on vacation right now, so I cannot do much more than this right now.

Also note that you can make parts of your nn.Module "not differentiable" so it doesn't try to differentiate things that do not need it

@xinghua-qu
Copy link
Author

Hi :) There is a .py-file for differentiability tests in the tests folder. You can see there that some transforms are intentionally skipped because they are not differentiable. I am on vacation right now, so I cannot do much more than this right now.

Also note that you can make parts of your nn.Module "not differentiable" so it doesn't try to differentiate things that do not need it

Hi :)

Many thanks for the quick reply. The test-differentiable.py did tell which augmentation is differentiable.

However, I do meet another issue, i.e., the ApplyImpulseResponse() function makes the training extremely slow. Any idea on such issue?

Thanks in advance and wish you a wonderful vacation:)

@iver56
Copy link
Collaborator

iver56 commented Jul 11, 2022

ApplyImpulseResponse()

Check if your impulse response files and your audio inputs have the same sample rate. If not, you may see a slowdown.

Also, it is recommended to load the files from SSD, as HDD may become a bottleneck.

The convolution itself should be pretty fast, especially if it gets run on a decent GPU and with batched compute

@xinghua-qu
Copy link
Author

ApplyImpulseResponse()

Check if your impulse response files and your audio inputs have the same sample rate. If not, you may see a slowdown.

Also, it is recommended to load the files from SSD, as HDD may become a bottleneck.

The convolution itself should be pretty fast, especially if it gets run on a decent GPU and with batched compute

That's great!!! Many thanks for the help:)

@xinghua-qu
Copy link
Author

xinghua-qu commented Jul 11, 2022

ApplyImpulseResponse()

Check if your impulse response files and your audio inputs have the same sample rate. If not, you may see a slowdown.

Also, it is recommended to load the files from SSD, as HDD may become a bottleneck.

The convolution itself should be pretty fast, especially if it gets run on a decent GPU and with batched compute

ApplyImpulseResponse()

Check if your impulse response files and your audio inputs have the same sample rate. If not, you may see a slowdown.

Also, it is recommended to load the files from SSD, as HDD may become a bottleneck.

The convolution itself should be pretty fast, especially if it gets run on a decent GPU and with batched compute

Hi Iver,

One more question for adding background noise AddBackgroundNoise('./background_noise/environment/0.wav', 30, p=1.0).
For adding background noise, using the path of a wav file, e.g., ./background_noise/environment/0.wav causes the error below.

TypeError: Invalid file: PosixPath('/xxxxx/background_noise/environment/0.wav')

Any idea on the reason for such issue

@iver56
Copy link
Collaborator

iver56 commented Jul 11, 2022

Hmm what if you give it a directory instead of a file? And what version of torch-audiomentations are you using?

@xinghua-qu
Copy link
Author

Hmm what if you give it a directory instead of a file? And what version of torch-audiomentations are you using?

torch-audiomentations 0.11.0

I tried to only give a directory following the setting in.utils, but it still raise the same error.

@iver56
Copy link
Collaborator

iver56 commented Jul 11, 2022

Then I don't know. Can you try step-debugging it?

@xinghua-qu
Copy link
Author

Then I don't know. Can you try step-debugging it?

Sure. Thanks.

@xinghua-qu
Copy link
Author

For any people else who may also meet the same issue of TypeError: Invalid file: PosixPath('/xxxxx/background_noise/environment/0.wav').

The follow command can help.
torchaudio.set_audio_backend("sox_io")

Solution is inspired by Improving I/O for correct and consistent experience #903

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

No branches or pull requests

2 participants