From 1168fa07b094869dcef9f60417c242ddaddbf2cc Mon Sep 17 00:00:00 2001 From: Kevin Du Date: Mon, 5 Aug 2024 02:14:29 +0200 Subject: [PATCH] Validate that inputdir is a filtered raw subdir --- pseudolabeling/v2d_to_metadata.py | 3 +++ pseudolabeling/v2d_to_transcript.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/pseudolabeling/v2d_to_metadata.py b/pseudolabeling/v2d_to_metadata.py index e821a85..16764fe 100644 --- a/pseudolabeling/v2d_to_metadata.py +++ b/pseudolabeling/v2d_to_metadata.py @@ -94,6 +94,9 @@ def process_json_file(json_file_path, output_dir, dataset): def main(args): + if "filtered_raw" not in args.input_dir: + raise ValueError(f"Expected input dir to be a subdir of `filtered_raw/`, instead received {args.input_dir}.") + output_dir = ( args.output_dir if args.output_dir is not None diff --git a/pseudolabeling/v2d_to_transcript.py b/pseudolabeling/v2d_to_transcript.py index cccde55..f24d53b 100644 --- a/pseudolabeling/v2d_to_transcript.py +++ b/pseudolabeling/v2d_to_transcript.py @@ -103,6 +103,9 @@ def process_json_file(json_file_path, output_dir): def main(args): + if "filtered_raw" not in args.input_dir: + raise ValueError(f"Expected input dir to be a subdir of `filtered_raw/`, instead received {args.input_dir}.") + current_folder = os.path.join(args.input_dir, args.whisper_dir) output_dir = ( args.output_dir