forked from mrq/DL-Art-School
Fixes
This commit is contained in:
parent
4334a67924
commit
9a9c90660f
|
@ -16,7 +16,7 @@ from utils.util import opt_get
|
||||||
|
|
||||||
|
|
||||||
def load_audio(audiopath, sampling_rate):
|
def load_audio(audiopath, sampling_rate):
|
||||||
if audiopath[:-4] == '.wav':
|
if audiopath[-4:] == '.wav':
|
||||||
audio, lsr = load_wav_to_torch(audiopath)
|
audio, lsr = load_wav_to_torch(audiopath)
|
||||||
else:
|
else:
|
||||||
audio, lsr = open_audio(audiopath)
|
audio, lsr = open_audio(audiopath)
|
||||||
|
@ -83,6 +83,9 @@ class UnsupervisedAudioDataset(torch.utils.data.Dataset):
|
||||||
related_files = find_files_of_type('img', os.path.dirname(audiopath), qualifier=is_audio_file)[0]
|
related_files = find_files_of_type('img', os.path.dirname(audiopath), qualifier=is_audio_file)[0]
|
||||||
assert audiopath in related_files
|
assert audiopath in related_files
|
||||||
assert len(related_files) < 50000 # Sanity check to ensure we aren't loading "related files" that aren't actually related.
|
assert len(related_files) < 50000 # Sanity check to ensure we aren't loading "related files" that aren't actually related.
|
||||||
|
if len(related_files) == 0:
|
||||||
|
j = 0
|
||||||
|
print(f"No related files for {audiopath}")
|
||||||
related_files.remove(audiopath)
|
related_files.remove(audiopath)
|
||||||
related_clips = []
|
related_clips = []
|
||||||
random.shuffle(related_clips)
|
random.shuffle(related_clips)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user