' DMN type is not currently implemented') if args.babi_task_id is not None: config.babi_id = args.babi_task_id config.strong_supervision = False config.train_mode = False print('Testing DMN ' + dmn_type + ' on babi task', config.babi_id) # create model with tf.variable_scope('DMN') as scope: if dmn_type == "original": from dmn_original import DMN model = DMN(config) elif dmn_type == "plus": from dmn_plus import DMN_PLUS model = DMN_PLUS(config) print('==> initializing variables') init = tf.global_variables_initializer() saver = tf.train.Saver() with tf.Session() as session: session.run(init) print('==> restoring weights') saver.restore(session, 'weights/task' + str(model.config.babi_id) + '.weights') print('==> running DMN')
config.babi_id = args.babi_task_id config.babi_id = args.babi_task_id if args.babi_task_id is not None else str(1) config.l2 = args.l2_loss if args.l2_loss is not None else 0.001 config.strong_supervision = args.strong_supervision if args.strong_supervision is not None else False num_runs = args.num_runs if args.num_runs is not None else 1 print 'Training DMN ' + dmn_type + ' on babi task', config.babi_id best_overall_val_loss = float('inf') # create model with tf.variable_scope('DMN') as scope: if dmn_type == "original": from dmn_original import DMN model = DMN(config) elif dmn_type == "plus": from dmn_plus import DMN_PLUS model = DMN_PLUS(config) for run in range(num_runs): print 'Starting run', run print '==> initializing variables' init = tf.initialize_all_variables() saver = tf.train.Saver() with tf.Session() as session: sum_dir = 'summaries/train/' + time.strftime("%Y-%m-%d %H %M")
raise NotImplementedError(dmn_type + ' DMN type is not currently implemented') if args.babi_task_id is not None: config.babi_id = args.babi_task_id config.strong_supervision = False config.train_mode = False print( 'Testing DMN ' + dmn_type + ' on babi task', config.babi_id) # create model with tf.variable_scope('DMN') as scope: if dmn_type == "original": from dmn_original import DMN model = DMN(config) elif dmn_type == "plus": from dmn_plus import DMN_PLUS model = DMN_PLUS(config) print('==> initializing variables') init = tf.global_variables_initializer() saver = tf.train.Saver() with tf.Session() as session: session.run(init) print('==> restoring weights') saver.restore(session, 'weights/task' + str(model.config.babi_id) + '.weights') print('==> running DMN')
config.babi_id = args.babi_task_id config.babi_id = args.babi_task_id if args.babi_task_id is not None else str(1) config.l2 = args.l2_loss if args.l2_loss is not None else 0.001 config.strong_supervision = args.strong_supervision if args.strong_supervision is not None else False num_runs = args.num_runs if args.num_runs is not None else 1 print('Training DMN ' + dmn_type + ' on babi task', config.babi_id) best_overall_val_loss = float('inf') # create model with tf.variable_scope('DMN') as scope: if dmn_type == "original": from dmn_original import DMN model = DMN(config) elif dmn_type == "plus": from dmn_plus import DMN_PLUS model = DMN_PLUS(config) for run in range(num_runs): print('Starting run', run) print('==> initializing variables') init = tf.global_variables_initializer() saver = tf.train.Saver() with tf.Session() as session: sum_dir = 'summaries/train/' + time.strftime("%Y-%m-%d %H %M")
# for i in range(0,2): # inp = input("Input :") # inp = u"%s"%inp # f.write(inp) # f.write("\n") # inp = input("Q :") # f.write(inp) # f.write("\n") # f.close() # asd # create model with tf.variable_scope('DMN') as scope: if dmn_type == "original": from dmn_original import DMN model = DMN(config) elif dmn_type == "plus": from dmn_self_plus import DMN_PLUS model = DMN_PLUS(config) print('==> initializing variables') init = tf.global_variables_initializer() saver = tf.train.Saver() with tf.Session() as session: session.run(init) print('==> restoring weights') saver.restore(session, 'weights/task' + str(model.config.babi_id) + '.weights') print('==> running DMN') # test_loss, test_accuracy = model.run_epoch(session, model.test)