def load_model(self):
    print('Loading model ...')
    assert os.path.exists(self.model_folder), 'model_fold is not found: {}'.format(self.model_folder)
    assert (self.weights_fname is not None), 'Argument required: --weights-file'
    checkExistence(self.weights_fname)
    model_graph = '{}/graph-arch.yaml'.format(self.model_folder)
    model_train_vars = '{}/other_vars.npz'.format(self.model_folder)
    checkExistence(model_graph)
    checkExistence(model_train_vars)
    from keras.models import model_from_yaml
    with open(model_graph, 'r') as fgraph:
        self.model = model_from_yaml(fgraph.read())
        self.model.load_weights(self.weights_fname)
    npzfile = np.load(model_train_vars)
    self.maxlen_userUtter = np.int32(npzfile['maxlen_userUtter'][()])
    self.word_vocab_size = np.int32(npzfile['word_vocab_size'][()])
    self.userTag_vocab_size = np.int32(npzfile['userTag_vocab_size'][()])
    self.userIntent_vocab_size = np.int32(npzfile['userIntent_vocab_size'][()])
    self.id2userTag = npzfile['id2userTag'][()]
    self.id2word = npzfile['id2word'][()]
    self.id2userIntent = npzfile['id2userIntent'][()]
    self.userTag2id = npzfile['userTag2id'][()]
def load_model(self):
    print('Loading model ...')
    assert os.path.exists(self.model_folder), 'model_fold is not found: {}'.format(self.model_folder)
    assert (self.weights_fname is not None), 'Argument required: --weights-file'
    checkExistence(self.weights_fname)
    model_graph = '{}/graph-arch.yaml'.format(self.model_folder)
    model_train_vars = '{}/other_vars.npz'.format(self.model_folder)
    checkExistence(model_graph)
    checkExistence(model_train_vars)
    from keras.models import model_from_yaml
    with open(model_graph, 'r') as fgraph:
        self.model = model_from_yaml(fgraph.read())
        self.model.load_weights(self.weights_fname)
    npzfile = np.load(model_train_vars)
    self.maxlen_userUtter = np.int32(npzfile['maxlen_userUtter'][()])
    self.word_vocab_size = np.int32(npzfile['word_vocab_size'][()])
    self.userTag_vocab_size = np.int32(npzfile['userTag_vocab_size'][()])
    self.userIntent_vocab_size = np.int32(npzfile['userIntent_vocab_size'][()])
    self.id2userTag = npzfile['id2userTag'][()]
    self.id2word = npzfile['id2word'][()]
    self.id2userIntent = npzfile['id2userIntent'][()]
    self.userTag2id = npzfile['userTag2id'][()]