Exemplo n.º 1
0
    rnOutput = modelBuilder.buildRN_II(objects, question)
elif modelToUse == 3:
    print("Using model III")
    rnOutput = modelBuilder.buildRN_III(objects, question)
elif modelToUse == 4:
    print("Using model IV")
    rnOutput = modelBuilder.buildRN_IV(objects, question)
elif modelToUse == 5:
    print("Using model V")
    rnOutput = modelBuilder.buildRN_V(objects, question)
elif modelToUse == 6:
    print("Using model VI")
    rnOutput = modelBuilder.buildRN_VI(objects, question)
elif modelToUse == 7:
    print("Using model VII")
    rnOutput = modelBuilder.buildRN_VII_jl(objects, question)
elif modelToUse == 8 and layerCount >= 0:
    print("Using model VIII with " + str(layerCount) + " layers")
    rnOutput = modelBuilder.buildRN_VIII_jl(objects, question, layerCount)
else:
    print("Invalid model number specified: " + str(modelToUse))
    sys.exit(0)

#(answer, answerGates, answerForCorrectness) = modelBuilder.buildAnswerModel(rnOutput)
(answer, answerForCorrectness) = modelBuilder.buildAnswerModel(rnOutput)

(inputAnswer, loss, accum_ops, zero_ops, train_step, global_step_tensor,
 gradientsNorm,
 learningRate) = modelBuilder.buildOptimizer(answer,
                                             args.optimizer)  #, answerGates)
Exemplo n.º 2
0
    (rnOutput, isTraining) = modelBuilder.buildRN_II(objects, question)
elif modelToUse == 3:
    print("Using model III")
    (rnOutput, isTraining) = modelBuilder.buildRN_III(objects, question)
elif modelToUse == 4:
    print("Using model IV")
    (rnOutput, isTraining) = modelBuilder.buildRN_IV(objects, question)
elif modelToUse == 5:
    print("Using model V")
    (rnOutput, isTraining) = modelBuilder.buildRN_V(objects, question)
elif modelToUse == 6:
    print("Using model VI")
    (rnOutput, isTraining) = modelBuilder.buildRN_VI(objects, question)
elif modelToUse == 7:
    print("Using model VII")
    (rnOutput, isTraining) = modelBuilder.buildRN_VII_jl(objects, question)
elif modelToUse == 8 and layerCount >= 0:
    print("Using model VIII with " + str(layerCount) + " layers")
    (rnOutput, isTraining) = modelBuilder.buildRN_VIII_jl(objects, inputContextLengths, question, layerCount)
else:
    print("Invalid model number specified: " + str(modelToUse))
    sys.exit(0)

#(answer, answerGates, answerForCorrectness) = modelBuilder.buildAnswerModel(rnOutput)
(answer, answerForCorrectness) = modelBuilder.buildAnswerModel(rnOutput)

#(inputAnswer, loss, optimizer_op, global_step_tensor, gradientsNorm, learningRate) = modelBuilder.buildOptimizer(answer, args.optimizer)#, answerGates)
(inputAnswer, loss, accum_ops, zero_ops, train_step, global_step_tensor, gradientsNorm, learningRate) = modelBuilder.buildOptimizer(answer, args.optimizer)#, answerGates)

with tf.name_scope('validation'):
    #correct = tf.reduce_min(tf.cast(tf.equal(inputAnswer, tf.round(answer)), dtype=tf.float32), axis=1)#bad results since the max entries often don't achieve 0.5 so rounding doesnt work