# STARTING SESSION AND RESTORING MODEL session = tf.InteractiveSession() saver = tf.train.import_meta_graph('./model-many2one.meta') saver.restore(session, tf.train.latest_checkpoint('./')) graph = tf.get_default_graph() tf_input = graph.get_tensor_by_name("tf_input:0") op_predictions = graph.get_tensor_by_name("op_predictions:0") # CREATING CLASSES dataset_manager = CoNLLManager(file_name='../data/many2many.txt', sentence_break='end', evaluation_set_percentage=20) tokenization_manager = TokenizationManager(tokenizer='none') vectorization_manager = VectorizationManager( vector_size=input_size, binary_file=True, embeddings_file='../embeddings/wiki.en.bin') labels_manager = LabelsManager( ["ACTION-B", "ACTION-I", "OBJECT-B", "OBJECT-I", "NONE"]) # PREDICTION print('', flush=True) print('==============', flush=True) print('= PREDICTION =', flush=True) print('==============', flush=True) results = []
# RUNNING SESSION session.run( tf.group(tf.global_variables_initializer(), tf.local_variables_initializer())) # CREATING CLASSES dataset_manager = DatasetManager(file_name='../data/many2multilabel.csv', file_format='csv', text_position=2, labels_first_position=0, labels_last_position=1, evaluation_set_percentage=20) tokenization_manager = TokenizationManager(tokenizer='gensim') vectorization_manager = VectorizationManager( vector_size=input_size, embeddings_file='../embeddings/wiki.en.bin', binary_file=True) labels_manager = LabelsManager(["turn_on_light", "set_alarm"]) # TRAINING print('', flush=True) print('============', flush=True) print('= TRAINING =', flush=True) print('============', flush=True) for epoch in range(num_epochs): print('', flush=True)