Skip to content

Commit

Permalink
Fix an undefined variable corner-case.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 553265728
  • Loading branch information
sdenton4 authored and copybara-github committed Aug 2, 2023
1 parent 7b69438 commit 5ab4fbd
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions chirp/data/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def get_dataset(
The placeholder dataset.
Raises:
ValueError: If no initialized Pipeline is passed.
RuntimeError: If no datasets are loaded.
"""
if isinstance(dataset_directory, str):
dataset_directory = [dataset_directory]
Expand All @@ -72,6 +73,7 @@ def get_dataset(
read_config = tfds.ReadConfig(add_tfds_id=True)

datasets = []
dataset_info = None
for dataset_dir in dataset_directory:
if tfds_data_dir:
tfds.core.add_data_dir(tfds_data_dir)
Expand Down Expand Up @@ -106,6 +108,8 @@ def get_dataset(
)
)
ds = ds.prefetch(2)
if dataset_info is None:
raise RuntimeError('No datasets loaded.')
return ds, dataset_info


Expand Down

0 comments on commit 5ab4fbd

Please sign in to comment.