You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
BUG: VS code jupyter notebook kernel crashing when calling feature.sat (specifically, spectral.sat._sat_multitaper) #222
I am running vocalpy (version 0.10.2) in a vocalpy conda environment in a jupyter notebook using VS code. My notebook code is as follows:
from vocalpy import feature
from vocalpy import Sound
import numpy as np
data = np.load("filename.npy")
fs = 125000
n_fft=512
hop_length = 256
features = feature.sat(Sound(data, fs), n_fft=n_fft, hop_length=hop_length)
I went to the _sat.py file and put print statements throughout so I could figure out where the script is crashing. That isolated it to:
power_spectrogram, spectra1, spectra2 = spectral.sat._sat_multitaper(
sound, n_fft, hop_length
)
So I put print statements in sat.py in the _sat_multitaper function, and I think the cause of the crash is:
windows = librosa.util.frame(
audio_pad, frame_length=n_fft, hop_length=hop_length
)
This librosa function runs in my notebook, so I'm not sure exactly why it's crashing inside the vocalpy function.
Thank you!
Error message:
"The Kernel crashed while executing code in the current cell or a previous cell.
Please review the code in the cell(s) to identify a possible cause of the failure.
Click here for more info.
View Jupyter log for further details."
Hi @eintzandt sorry you're running into this issue -- thank you for the detailed error report.
I see you have a relatively high sampling rate, my guess is you are working with rodent data?
Are you by any chance able to share the file that causes the crash?
Either by replying to this and attaching it in a zip, or by sharing via email (nicholdav at gmail).
Would be great if I could "borrow" that little bit of data to reproduce the bug locally.
I think what's going on here is that this code was originally developed for zebra finch calls and song, so it works fine for brief clips sampled at 32kHz, but it hasn't been tested extensively (yet, except by you 😅 ) for other animal sounds.
I think you've already figured this out, but: my guess is you're hitting an out-of-memory error when librosa tries to make an array of sliding windows out of your audio clip. (That's what librosa.util.frame does). And that's when the kernel crashes.
Basically: you have a lot of samples, so you end up with a ton of frames.
If you're able to break the sound up into smaller clips, that might be one way to get it to work?
E.g., using vocalpy.segment.ava or something like that, if you're not already.
I need to check, but I think the older version might "work" by accident, because it's not computing one or two features that are particularly computationally expensive (even for short zebra finch calls), that rely on frame.
Not sure I'll have time to look into this today but I can see if I can get you more details by mid-week.
I don't have a ton of time to re-engineer vocalpy.features.sat right now but maybe we could run on a single window at a time so we don't get the OOM error? That's my first idea but I need to stare at the internals again to see.
Let's see if we can get this to work for your use case too.
Activity
eintzandt commentedon Sep 29, 2025
I downgraded vocalpy to version 0.9.3 and now feature.sat.similarity_features() runs fine in my notebook
NickleDave commentedon Sep 29, 2025
Hi @eintzandt sorry you're running into this issue -- thank you for the detailed error report.
I see you have a relatively high sampling rate, my guess is you are working with rodent data?
Are you by any chance able to share the file that causes the crash?
Either by replying to this and attaching it in a zip, or by sharing via email (nicholdav at gmail).
Would be great if I could "borrow" that little bit of data to reproduce the bug locally.
I think what's going on here is that this code was originally developed for zebra finch calls and song, so it works fine for brief clips sampled at 32kHz, but it hasn't been tested extensively (yet, except by you 😅 ) for other animal sounds.
I think you've already figured this out, but: my guess is you're hitting an out-of-memory error when librosa tries to make an array of sliding windows out of your audio clip. (That's what
librosa.util.framedoes). And that's when the kernel crashes.Basically: you have a lot of samples, so you end up with a ton of frames.
If you're able to break the sound up into smaller clips, that might be one way to get it to work?
E.g., using
vocalpy.segment.avaor something like that, if you're not already.I need to check, but I think the older version might "work" by accident, because it's not computing one or two features that are particularly computationally expensive (even for short zebra finch calls), that rely on
frame.Not sure I'll have time to look into this today but I can see if I can get you more details by mid-week.
I don't have a ton of time to re-engineer
vocalpy.features.satright now but maybe we could run on a single window at a time so we don't get the OOM error? That's my first idea but I need to stare at the internals again to see.Let's see if we can get this to work for your use case too.
NickleDave commentedon Oct 20, 2025
Hi @eintzandt just checking back on this -- any chance you could share the audio file that caused the crash so I can reproduce and fix?
eintzandt commentedon Oct 24, 2025
Here are some example wav files: https://drive.google.com/drive/folders/1NWvAuOVRQPgvk-wg1ccLBkBS4LaB_Ym_?usp=sharing
NickleDave commentedon Oct 25, 2025
Thank you @eintzandt much appreciated! (I'm sure you are busy with other stuff)
Will bump this up the to-do list and see if I can figure out what's causing the crash in the current version