From 8d19d29345b0fc92391699607f3ab5ddf270edaf Mon Sep 17 00:00:00 2001 From: Tom Denton Date: Wed, 2 Aug 2023 14:58:53 -0700 Subject: [PATCH] Fix an undefined variable corner-case. PiperOrigin-RevId: 553265728 --- chirp/data/utils.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/chirp/data/utils.py b/chirp/data/utils.py index ebbcee7b..cabd5f52 100644 --- a/chirp/data/utils.py +++ b/chirp/data/utils.py @@ -72,6 +72,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) @@ -106,6 +107,8 @@ def get_dataset( ) ) ds = ds.prefetch(2) + if dataset_info is None: + raise RuntimeError('No datasets loaded.') return ds, dataset_info