import tensorflow as tf

        model = create_model("Tacotron", hparams)
        model.initialize(feeder.inputs, feeder.input_lengths, feeder.speaker_embeddings,
                         feeder.mel_targets, feeder.token_targets,
                         targets_lengths=feeder.targets_lengths, global_step=global_step,
                         is_training=True, split_infos=feeder.split_infos)
        model.add_loss()
        model.add_optimizer(global_step)
        stats = add_train_stats(model, hparams)
        return model, stats


def model_test_mode(args, feeder, hparams, global_step):
    with tf.variable_scope("Tacotron_model", reuse=tf.AUTO_REUSE) as scope:
        model = create_model("Tacotron", hparams)
        model.initialize(feeder.eval_inputs, feeder.eval_input_lengths,
                         feeder.eval_speaker_embeddings, feeder.eval_mel_targets,
                         feeder.eval_token_targets, targets_lengths=feeder.eval_targets_lengths,
                         global_step=global_step, is_training=False, is_evaluating=True,
                         split_infos=feeder.eval_split_infos)
        model.add_loss()
        return model


def train(log_dir, args, hparams):
