'Loads a skip-thoughts model.
Args:
model_config: Object containing parameters for building the model.
vocabulary_file: Path to vocabulary file containing a list of newline-
separated words where the word id is the corresponding 0-based index in
the file.
embedding_matrix_file: Path to a serialized numpy array of shape
[vocab_size, embedding_dim].
checkpoint_path: SkipThoughtsModel checkpoint file or a directory
containing a checkpoint file.'

def load_model(self, model_config, vocabulary_file, embedding_matrix_file, checkpoint_path):

    tf.logging.info('Reading    vocabulary    from    %s', vocabulary_file)
    with tf.gfile.GFile(vocabulary_file, mode='r') as f:
        lines = list(f.readlines())
    reverse_vocab = [line.decode('utf-8').strip() for line in lines]
    tf.logging.info('Loaded    vocabulary    with    %d    words.', len(reverse_vocab))
    tf.logging.info('Loading    embedding    matrix    from    %s', embedding_matrix_file)
    with open(embedding_matrix_file, 'r') as f:
        embedding_matrix = np.load(f)
    tf.logging.info('Loaded    embedding    matrix    with    shape    %s', embedding_matrix.shape)
    word_embeddings = collections.OrderedDict(zip(reverse_vocab, embedding_matrix))
    g = tf.Graph()
    with g.as_default():
        encoder = skip_thoughts_encoder.SkipThoughtsEncoder(word_embeddings)
        restore_model = encoder.build_graph_from_config(model_config, checkpoint_path)
    sess = tf.Session(graph=g)
    restore_model(sess)
    self.encoders.append(encoder)
    self.sessions.append(sess)
