File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change 5
5
import os
6
6
import sys
7
7
8
+ import codecs
8
9
import numpy as np
9
10
import torch
10
11
from scipy .io .wavfile import read
@@ -251,13 +252,11 @@ def load_wav_to_torch(full_path):
251
252
252
253
def load_filepaths_and_text (filename , split = "|" ):
253
254
try :
254
- with open (filename , encoding = "utf-8" ) as f :
255
- filepaths_and_text = [line .strip ().split (split ) for line in f ]
256
- except UnicodeDecodeError :
257
- with open (filename ) as f :
258
- filepaths_and_text = [line .strip ().split (split ) for line in f ]
255
+ return [line .strip ().split (split ) for line in codecs .open (filename , encoding = "utf-8" )]
256
+ except UnicodeDecodeError as e :
257
+ logger .error ("Error loading file %s: %s" , filename , e )
259
258
260
- return filepaths_and_text
259
+ return []
261
260
262
261
263
262
def get_hparams (init = True ):
You can’t perform that action at this time.
0 commit comments