def METHOD_NAME(config):
    """main function for training metapath2vec model.
    """
    logging.info(config)
    set_seed(config['seed'])
    dataset = getattr(
        Dataset, config['data_loader']['type'])(config['data_loader']['args'])
    data_generator = multiprocess_data_generator(config, dataset)
    # move word2id file to checkpoints directory
    src_word2id_file = dataset.word2id_file
    dst_wor2id_file = config['trainer']['args']['save_dir'] + config[
        'data_loader']['args']['word2id_file']
    logging.info('backup word2id file to %s' % dst_wor2id_file)
    shutil.move(src_word2id_file, dst_wor2id_file)
    place = fluid.CUDAPlace(0) if config['use_cuda'] else fluid.CPUPlace()
    train_program = fluid.Program()
    startup_program = fluid.Program()
    with fluid.program_guard(train_program, startup_program):
        model = getattr(Models, config['model']['type'])(
            dataset=dataset, config=config['model']['args'], place=place)
    with fluid.program_guard(train_program, startup_program):
        global_steps = int(dataset.sentences_count *
                           config['trainer']['args']['epochs'] /
                           config['data_loader']['args']['batch_size'])
        model.backward(global_steps, config['optimizer']['args'])
    # train
    exe = fluid.Executor(place)
    exe.run(startup_program)
    feed_dict = {}
    logging.info('training...')
    for epoch in range(1, 1 + config['trainer']['args']['epochs']):
        run_epoch(epoch, config['trainer']['args'], data_generator,
                  train_program, model, feed_dict, exe)
        logging.info('saving model...')
        cur_save_path = os.path.join(config['trainer']['args']['save_dir'],
                                     "model_epoch%d" % (epoch))
        save_param(cur_save_path, ['content'])
    logging.info('finishing training')