Skip to content

Commit 967f6ba

Browse files
committed
Apply Ruff formatting to audio path changes
Signed-off-by: Dongji Gao <dongjig@nvidia.com>
1 parent f5900a3 commit 967f6ba

3 files changed

Lines changed: 9 additions & 12 deletions

File tree

nemo_skills/dataset/librispeech-pc/prepare.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,9 @@ def main():
227227
download_manifests(data_dir)
228228

229229
splits = ["test-clean", "test-other"] if args.split == "all" else [args.split]
230-
total = sum(process_split(split, data_dir, audio_dir, not args.no_audio, audio_root=audio_root) for split in splits)
230+
total = sum(
231+
process_split(split, data_dir, audio_dir, not args.no_audio, audio_root=audio_root) for split in splits
232+
)
231233

232234
print(f"\n✓ Complete: {total} samples")
233235

nemo_skills/dataset/numb3rs/prepare.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,9 @@ def save_audio_and_format_entry(
123123
audio_file_path = audio_dir / audio_filename
124124
sf.write(str(audio_file_path), audio_array, sampling_rate)
125125

126-
audio_filepath = build_container_audio_path("numb3rs", "Numb3rs", category, audio_filename, audio_prefix=audio_root)
126+
audio_filepath = build_container_audio_path(
127+
"numb3rs", "Numb3rs", category, audio_filename, audio_prefix=audio_root
128+
)
127129

128130
# Build audio metadata (to be embedded in messages later)
129131
audio_metadata = {
@@ -288,9 +290,7 @@ def main():
288290
# Process each category
289291
total_samples = 0
290292
for category in categories_to_prepare:
291-
total_samples += prepare_category(
292-
category, dataset, output_dir, with_audio=with_audio, audio_root=audio_root
293-
)
293+
total_samples += prepare_category(category, dataset, output_dir, with_audio=with_audio, audio_root=audio_root)
294294

295295
# Combine all category variant files into test variant files
296296
print("\nCreating combined test files for each variant...")

tests/test_audio_path_prefix.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,7 @@ def test_asr_leaderboard_audio_prefix(monkeypatch, tmp_path):
110110
audio_root="/data",
111111
)
112112

113-
assert (
114-
formatted["messages"][1]["audio"]["path"]
115-
== "/data/asr-leaderboard/data/librispeech_clean/sample_001.flac"
116-
)
113+
assert formatted["messages"][1]["audio"]["path"] == "/data/asr-leaderboard/data/librispeech_clean/sample_001.flac"
117114
_assert_clean_audio_paths(formatted, "/data/asr-leaderboard/")
118115

119116

@@ -136,9 +133,7 @@ def test_asr_leaderboard_end_to_end(monkeypatch, tmp_path):
136133
]
137134
monkeypatch.setattr(prepare, "load_dataset", lambda *args, **kwargs: fake_dataset)
138135

139-
count = prepare.prepare_dataset(
140-
"librispeech_clean", tmp_path, with_audio=False, audio_root="/data"
141-
)
136+
count = prepare.prepare_dataset("librispeech_clean", tmp_path, with_audio=False, audio_root="/data")
142137

143138
assert count == 2
144139
_assert_clean_audio_paths(tmp_path / "librispeech_clean.jsonl", "/data/asr-leaderboard/")

0 commit comments

Comments
 (0)