-
Notifications
You must be signed in to change notification settings - Fork 47
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
Adding some audio transforms and augmentations to tonic #273
Conversation
@MinaKh I think you should add |
Thanks, just did! |
It seems that the tests now are running using CUDA. Maybe it is better to run them with everything on CPU? Or we could modify the |
@fabrizio-ottati No, I can set them to run on cpu. Also there are other tests that I passed on my machine but fail on CI. I need to fix without need to install extra packages. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most transforms are encapsulated enough so that I can add them, but some stuff that uses QUTNoise things I won't be able to merge like that, unless it is made a bit more general. For example, maybe Tonic has a AddNoise class, but then in your user code at SynSense you call it with AddNoise(QUTNoise), after the principle of dependency injection
tonic/audio_augmentations.py
Outdated
import torch | ||
import torchaudio | ||
import torchaudio.functional as F | ||
from qut_noise import QUTNoise |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a dependency that I won't be able to add to this library like that.
tonic/audio_augmentations.py
Outdated
|
||
|
||
@dataclass | ||
class AddHomeNoise: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is very specific, is there a way how you can abstract it to noise from different datasets?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@biphasic I have removed all noise related augmentations from this PR.
tonic/audio_augmentations.py
Outdated
|
||
def __call__(self, audio): | ||
SAMPLE_RIR = download_asset( | ||
"tutorial-assets/Lab41-SRI-VOiCES-rm1-impulse-mc01-stu-clo-8000hz.wav" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this sort of hardcoded things I cannot merge into a public library
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this sort of hardcoded things I cannot merge into a public library
I removed this hard coded audio path. Instead the room impulse audio needs to be passed by user. The corresponding test is also updated.
The Github Actions test suite doens't have a GPU installed, therefore there's no point in installing any CUDA dependencies. Tests should always run on CPU please. Thank you |
Thanks @biphasic, As far as I checked my tests are not running on GPU. The error might be caused by general imports of torch and torchaudio, or by the difference in my local version and the installed one on the server. So I included the versions in the requirements. |
requirements.txt
Outdated
torch==1.12.0+cu113 | ||
torchaudio==0.12.0+cu113 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cu113 means CUDA 11.3, so this is installing a fixed version of pytorch with CUDA backend
@MinaKh are the tests passing on your local machine? |
Also I just relaxed the Github actions approval to the minimum level possible, I hope it now works without my manual approval! |
@MinaKh I need to sit and do it properly. I will update you this afternoon |
Okay, it seems I convinced it @MinaKh :) |
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## develop #273 +/- ##
===========================================
+ Coverage 76.84% 77.72% +0.88%
===========================================
Files 53 55 +2
Lines 3001 3174 +173
===========================================
+ Hits 2306 2467 +161
- Misses 695 707 +12 ☔ View full report in Codecov by Sentry. |
Thanks @fabrizio-ottati |
@biphasic all the tests are passing now. I have created a separate Now the code is ready to be reviewed and CI should be safe. |
@biphasic I removed those classes (noise augmentations) from this branch. currently it is very specific and I will prepare another PR later for that. |
What's the status on this PR? :) |
It is ready for final review... |
This branch includes following updates in tonic/develop:
Three transforms are added to
audio_transforms.py
:SwapAxes
,AmplitudeScale
androbustAmplitudeScale
A new script is added:
audio_augmentations.py
containing wrapper classes for following audio augmentations:RandomAmplitudeScale
RandomPitchShift
RandomTimeStreatch
RIR
: adding room impulse response (echo effect)AddWhiteNoise
corresponding tests added:
test_audio_trnasform.py
A new script added for testing audio augmentations --->
test_audio_augmentations.py
A tutorial notebook is added in
docs/tutorials/