diff --git a/codes/scripts/audio/preparation/spleeter_dataset.py b/codes/scripts/audio/preparation/spleeter_dataset.py index a0a198fc..c840e4f9 100644 --- a/codes/scripts/audio/preparation/spleeter_dataset.py +++ b/codes/scripts/audio/preparation/spleeter_dataset.py @@ -7,8 +7,10 @@ from data.util import find_audio_files class SpleeterDataset(Dataset): - def __init__(self, src_dir, sample_rate=22050, max_duration=20): + def __init__(self, src_dir, sample_rate=22050, max_duration=20, skip=0): self.files = find_audio_files(src_dir, include_nonwav=True) + if skip > 0: + self.files = self.files[skip:] self.audio_loader = AudioAdapter.default() self.sample_rate = sample_rate self.max_duration = max_duration diff --git a/codes/scripts/audio/preparation/spleeter_split_voice_and_background_2.py b/codes/scripts/audio/preparation/spleeter_split_voice_and_background_2.py index 0166aebd..5edf0b01 100644 --- a/codes/scripts/audio/preparation/spleeter_split_voice_and_background_2.py +++ b/codes/scripts/audio/preparation/spleeter_split_voice_and_background_2.py @@ -17,11 +17,9 @@ def main(): output_sample_rate=22050 batch_size=16 - dl = DataLoader(SpleeterDataset(src_dir, output_sample_rate), batch_size=batch_size, shuffle=False, num_workers=1, pin_memory=True) + dl = DataLoader(SpleeterDataset(src_dir, output_sample_rate, skip=batch_size*33000), batch_size=batch_size, shuffle=False, num_workers=1, pin_memory=True) separator = Separator('pretrained_models/2stems', input_sr=output_sample_rate) - for e, batch in enumerate(tqdm(dl)): - #if e < 406500: - # continue + for batch in tqdm(dl): waves = batch['wave'] paths = batch['path'] durations = batch['duration']