Skip to content

Commit

Permalink
Fixed bug
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianLoef committed Sep 1, 2023
1 parent bb66956 commit 237af33
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/data/nsynth.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def __init__(
self.sample_rate = sample_rate
data_folder = os.path.join(root, "processed", "nsynth", f"nsynth-{self.subset}")
if not os.path.exists(data_folder):
self.download()
self.download(root)
self.file_paths, self.labels = self.load_data(data_folder)

@property
Expand Down Expand Up @@ -59,11 +59,11 @@ def load_data(self, data_folder: str) -> dict:
labels.append(data[key][self._label])
return file_paths, labels

def download(self):
if not os.path.exists(self.root):
os.makedirs(self.root)
def download(self, root):
if not os.path.exists(root):
os.makedirs(root)
url = f"http://download.magenta.tensorflow.org/datasets/nsynth/nsynth-{self.subset}.jsonwav.tar.gz"
download_and_extract(url, self.root, "nsynth")
download_and_extract(url, root, "nsynth")

def __len__(self):
return len(self.file_paths)
Expand Down

0 comments on commit 237af33

Please sign in to comment.