args.f_layers, args.f_inner_layers, args.g_layers, args.h_layers, args.appendPosVec) (inputContext, inputContextLengths, inputContextSentenceLengths, inputQuestion, inputQuestionLengths, objects, question) = modelBuilder.buildWordProcessorLSTMs() if modelToUse == 1: print("Using model I") rnOutput = modelBuilder.buildRN_I(objects, question) elif modelToUse == 2: print("Using model II") 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)
yield contextInput, contextLengths, contextSentenceLengths, questionInput, questionLengths, answerInput #build the whole model and run it modelBuilder = ModelBuilder(batch_size, macro_batch_size, question_dim, obj_dim, dictSize, args.questionAwareContext, args.f_layers, args.f_inner_layers, args.g_layers, args.h_layers, args.appendPosVec, args.batchNorm, args.layerNorm, args.weightPenalty) (inputContext, inputContextLengths, inputContextSentenceLengths, inputQuestion, inputQuestionLengths, objects, question) = modelBuilder.buildWordProcessorLSTMs() if modelToUse == 1: print("Using model I") (rnOutput, isTraining) = modelBuilder.buildRN_I(objects, question) elif modelToUse == 2: print("Using model II") (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)