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

Disabled TQDM is still on #58

Open
Borda opened this issue Feb 18, 2022 · 5 comments
Open

Disabled TQDM is still on #58

Borda opened this issue Feb 18, 2022 · 5 comments

Comments

@Borda
Copy link

Borda commented Feb 18, 2022

Hello, I have suspicion that the TQDM disabling does not work properly when another tqdm progress bar is already in use

image

and the used function is:

import torchaudio
import noisereduce as nr

def create_spectrogram(fname, reduce_noise: bool = False):
    waveform, sample_rate = torchaudio.load(fname, normalize=True)
    waveform = waveform[0]
    if reduce_noise:
        waveform = torch.tensor(nr.reduce_noise(y=waveform, sr=sample_rate, win_length=256, use_tqdm=False, n_jobs=-1))
    transform = torchaudio.transforms.Spectrogram(n_fft=3600, win_length=256)
    spectrogram = transform(waveform)
    return torch.log(spectrogram).numpy()
@timsainb
Copy link
Owner

Hm, I just tried to reproduce your error and don't get the same error with just another progress bar in use:
https://colab.research.google.com/drive/1J_cu_bmow2j-x6LEnrRfHbaC7UqxoAU9?usp=sharing

Maybe it's some interaction between torchaudio and tqdm? Can you try embedding some non-noisereduce tqdm bar in your function and see if the error persists?

@Borda
Copy link
Author

Borda commented Feb 18, 2022

I am running it in this notebook https://www.kaggle.com/jirkaborovec/birdclef-convert-spectrograms-noise-reduce
and I see the multiple bars only with reduce_noise=True

@timsainb
Copy link
Owner

Yes, I'm trying to figure out where your error is coming from.

In noisereduce, I call tqdm here:
tqdm(pos_list, disable=self.use_tqdm)

So I am suggesting you try adding a tqdm(range(10), disable=True) in the line above nr.reduce noise in your function. If you find that that tqdm bar also shows, you'll know if the error is unrelated to noisereduce.

@Borda
Copy link
Author

Borda commented Feb 18, 2022

So I am suggesting you try adding a tqdm(range(10), disable=True) in the line above nr.reduce noise in your function. If you find that that tqdm bar also shows, you'll know if the error is unrelated to noisereduce.

tried and do not see the 10-step progress bar

@timsainb
Copy link
Owner

Ok, well I can't reproduce your error, so I'll just leave this open. tqdm is referenced once in the package (https://github.com/timsainb/noisereduce/blob/master/noisereduce/noisereduce.py#L224), and the disable flag is set to use_tqdm. So I can't see where the error would arise.

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