From a897f6ac51958744ff49aa5e28d4bf1265b71da4 Mon Sep 17 00:00:00 2001 From: Yangyangii Date: Thu, 7 Jun 2018 15:55:58 +0830 Subject: [PATCH] Modified data_load.py for considering python version --- data_load.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/data_load.py b/data_load.py index 745ef98..0a04fdd 100644 --- a/data_load.py +++ b/data_load.py @@ -13,7 +13,7 @@ from utils import * import codecs import re -import os +import os, sys import unicodedata def load_vocab(): @@ -104,8 +104,12 @@ def get_batch(): if hp.prepro: def _load_spectrograms(fpath): fname = os.path.basename(fpath) - mel = "mels/{}".format(fname.replace("wav", "npy")) - mag = "mags/{}".format(fname.replace("wav", "npy")) + if sys.version_info[0] == 3: + mel = "mels/{}".format(fname.decode().replace("wav", "npy")) + mag = "mags/{}".format(fname.decode().replace("wav", "npy")) + else: + mel = "mels/{}".format(fname.replace("wav", "npy")) + mag = "mags/{}".format(fname.replace("wav", "npy")) return fname, np.load(mel), np.load(mag) fname, mel, mag = tf.py_func(_load_spectrograms, [fpath], [tf.string, tf.float32, tf.float32])