def train(model_name, p1_train_data, p1_dev_data, p2_train_data, p2_dev_data):

    ### PHASE 1 ###    

    training_data = np.load(p1_train_data)
    validation_data = np.load(p1_dev_data)

    assert training_data["batch_size"] == validation_data["batch_size"]
    assert training_data["vocabulary"] == validation_data["vocabulary"]
    assert training_data["punctuations"] == validation_data["punctuations"]

    print "1st phase data loaded..."

    print "Vocabulary size is %d" % utils.get_vocabulary_size(validation_data["vocabulary"])
    print "Training set size is %d" % training_data["total_size"]
    print "Validation set size is %d" % validation_data["total_size"]

    net = models.T_LSTM()
    net.initialize(hidden_size=conf.PHASE1["HIDDEN_SIZE"],
                   projection_size=conf.PHASE1["PROJECTION_SIZE"],
                   in_vocabulary=training_data["vocabulary"],
                   out_vocabulary=training_data["punctuations"],
                   batch_size=training_data["batch_size"],
                   hidden_activation=conf.PHASE1["HIDDEN_ACTIVATION"],
                   bptt_steps=conf.PHASE1["BPTT_STEPS"],
                   use_pauses=False)

    _train(net, training_data, validation_data, model_name, conf.PHASE1["LEARNING_RATE"], conf.PHASE1["MAX_EPOCHS"], conf.PHASE1["MIN_IMPROVEMENT"])

    ### PHASE 2 ###

    if not os.path.isfile(p2_train_data) or not os.path.isfile(p2_train_data):
        print "No second phase data."
        return

    training_data = np.load(p2_train_data)
    validation_data = np.load(p2_dev_data)

    assert training_data["batch_size"] == validation_data["batch_size"] == net.batch_size
    assert training_data["vocabulary"] == validation_data["vocabulary"] == net.in_vocabulary
    assert training_data["punctuations"] == validation_data["punctuations"] == net.out_vocabulary

    print "2nd phase data loaded..."

    print "Training set size is %d" % training_data["total_size"]
    print "Validation set size is %d" % validation_data["total_size"]
    print ("with" if conf.PHASE2["USE_PAUSES"] else "without") % "Trainging %s pause durations."

    t_lstm = net

    net = models.TA_LSTM()
    net.initialize(hidden_size=conf.PHASE2["HIDDEN_SIZE"],
                   t_lstm=t_lstm,
                   out_vocabulary=training_data["punctuations"],
                   batch_size=training_data["batch_size"],
                   hidden_activation=conf.PHASE2["HIDDEN_ACTIVATION"],
                   bptt_steps=conf.PHASE2["BPTT_STEPS"],
                   use_pauses=conf.PHASE2["USE_PAUSES"])

    _train(net, training_data, validation_data, model_name, conf.PHASE2["LEARNING_RATE"], conf.PHASE2["MAX_EPOCHS"], conf.PHASE2["MIN_IMPROVEMENT"])
dataset/ETHPy150Open ottokart/punctuator/src/trainer.py/train/swapped operands of `%`