From 90295972c30e01ed085f6ae2abd312ac43318925 Mon Sep 17 00:00:00 2001 From: sibange Date: Tue, 4 Jun 2024 11:12:01 +0200 Subject: [PATCH 1/2] Adaption to new numpy version --- sms_wsj/database/write_files.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sms_wsj/database/write_files.py b/sms_wsj/database/write_files.py index b3e1f4f..51b7570 100644 --- a/sms_wsj/database/write_files.py +++ b/sms_wsj/database/write_files.py @@ -63,7 +63,7 @@ def audio_read(example): with soundfile.SoundFile(wav_file, mode='r') as f: audio_data.append(f.read().T) - example['audio_data'][audio_key] = np.array(audio_data) + example['audio_data'][audio_key] = np.array(audio_data, dtype="object") return example From ec1a44cdbaad24ec50412f60165f92ec37b5e166 Mon Sep 17 00:00:00 2001 From: sibange Date: Fri, 7 Jun 2024 15:39:40 +0200 Subject: [PATCH 2/2] Addition of try except block around previous change --- sms_wsj/database/write_files.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sms_wsj/database/write_files.py b/sms_wsj/database/write_files.py index 51b7570..2afb4d1 100644 --- a/sms_wsj/database/write_files.py +++ b/sms_wsj/database/write_files.py @@ -63,7 +63,11 @@ def audio_read(example): with soundfile.SoundFile(wav_file, mode='r') as f: audio_data.append(f.read().T) - example['audio_data'][audio_key] = np.array(audio_data, dtype="object") + try: + example['audio_data'][audio_key] = np.array(audio_data) + except ValueError: + example['audio_data'][audio_key] = np.array(audio_data, dtype="object") + return example