-
Notifications
You must be signed in to change notification settings - Fork 18
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
Memory footprint in Google Colab #2
Comments
Hi MaxC2, thanks for the feedback. , but you don't have to manually split and merge audio sub-process.
It automatically splits the given track into several sub-audio (each sub-audio has the same number of samples, and the last sub-audio is zero-padded), separates source for each sub-audio, and merges all the separated outputs to make a final audio file. Below is the code for this. def separate_track(self, input_signal, target) -> torch.Tensor:
import numpy as np
self.eval()
with torch.no_grad():
db = SingleTrackSet(input_signal, self.hop_length, self.num_frame)
assert target in db.source_names
separated = []
input_condition = np.array(db.source_names.index(target))
input_condition = torch.tensor(input_condition, dtype=torch.long, device=self.device).view(1)
for item in db:
separated.append(self.separate(item.unsqueeze(0).to(self.device), input_condition)[0]
[self.trim_length:-self.trim_length].detach().cpu().numpy())
separated = np.concatenate(separated, axis=0)
import soundfile
soundfile.write('temp.wav', separated, 44100)
return soundfile.read('temp.wav')[0] The pytorch dataset API After iterating every sub-audio file, Thank you. |
Yes, it's maybe because i've attempt to use to load 96KHz audio with librosa ( |
OK, I've done some test. The problem come from the use of embedded audio player To do the trick, the idea is not to use the embbed audio preview and directly call the In a draft form, for using my audio stored in Google Drive, i've write two new cells. The first one is the common Google Drive mount:
The second load any audio file, resample (best filter quality) and convert to stereo if needed. Each processed temp.wav are renamed and writed in a destination subfolder in Google Drive (
I need to add a fallback to audio format:
But for the moment this process work great on my audio files (>10mn, 96kbits 24 bits) without offline preprocessing. Maybe the idea will be to add a extra method in the python code that do not write the That can help some potential users that do not have a Google Drive account. For me, it's OK and fine. Thank you very much. |
Thank you for sharing your experience. |
Thank you so much for this great model ! Wondeful job ! I have just a little question about the memory required for the separation. The model seem use a lot of memory and require to split the audio of a full song (> 1min / 1min30) in Google Colab (free version because no pro version for european users) and resample the audio to from hires (96000Hz) to lowres (44100Hz).
The current jupiter notebook show only process on very short samples (youtube video), I've slightly modify the code to allow using audio from Google Drive but seem to be limited to low resolution / short duration audio file without using splitting/merging audio subprocess. The same limitation of RAM footprint was resolved with Spleeter (Deezer) by a similar method but with some constraints (zero padding to remove in audio) (issue here : deezer/spleeter#391 (comment)).
Is someone already do the job?
The text was updated successfully, but these errors were encountered: