diff --git a/audio.py b/audio.py index 1c5c083..32b20c4 100644 --- a/audio.py +++ b/audio.py @@ -1,7 +1,7 @@ import librosa import librosa.filters import numpy as np -import tensorflow as tf +# import tensorflow as tf from scipy import signal from scipy.io import wavfile from hparams import hparams as hp diff --git a/hparams.py b/hparams.py index cc2a0d3..1c01904 100644 --- a/hparams.py +++ b/hparams.py @@ -1,4 +1,3 @@ -from tensorflow.contrib.training import HParams from glob import glob import os @@ -13,6 +12,22 @@ def get_image_list(data_root, split): return filelist +class HParams: + def __init__(self, **kwargs): + self.data = {} + + for key, value in kwargs.items(): + self.data[key] = value + + def __getattr__(self, key): + if key not in self.data: + raise AttributeError("'HParams' object has no attribute %s" % key) + return self.data[key] + + def set_hparam(self, key, value): + self.data[key] = value + + # Default hyperparameters hparams = HParams( num_mels=80, # Number of mel-spectrogram channels and local conditioning dimensionality