Commit 276dcd69 authored by Zhaoheng Ni's avatar Zhaoheng Ni Committed by Facebook GitHub Bot
Browse files

Throw RuntimeError if path not found in LibriMix dataset (#2944)

Summary:
The `root` path can be confusing to users without reading the document. The PR adds runtime error for a better understanding.

Pull Request resolved: https://github.com/pytorch/audio/pull/2944

Reviewed By: mthrok

Differential Revision: D42281034

Pulled By: nateanl

fbshipit-source-id: 6e5f4bfb118583d678d6b7a2565ef263fe8e4a5a
parent cc0d1e0b
......@@ -51,6 +51,11 @@ class LibriMix(Dataset):
mode: str = "min",
):
self.root = Path(root) / f"Libri{num_speakers}Mix"
if not os.path.exists(self.root):
raise RuntimeError(
f"The path {self.root} doesn't exist. "
"Please check the ``root`` path and ``num_speakers`` or download the dataset manually."
)
if mode not in ["max", "min"]:
raise ValueError(f'Expect ``mode`` to be one in ["min", "max"]. Found {mode}.')
if sample_rate == 8000:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment