noisereduce
noisereduce copied to clipboard
Disabled TQDM is still on
Hello, I have suspicion that the TQDM disabling does not work properly when another tqdm progress bar is already in use

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()
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?
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
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.
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
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.