code: def main(config):
      """main function for training GATNE model."""
      logging.info(config)
  
      set_seed(config["seed"])
  
      dataset = getattr(Dataset, config["data_loader"]["type"])(
          config["data_loader"]["args"]
      )
      edge_types = dataset.graph.edge_types_info()
      logging.info(["total edge types: ", edge_types])
  
      # train_pairs is a list of tuple: [(src1, dst1, neg, e1), (src2, dst2, neg, e2)]
      # e(int), edge num count, for select which edge embedding
      train_pairs_file = (
          config["data_loader"]["args"]["data_path"]
          + config["data_loader"]["args"]["train_pairs_file"]
      )
      if os.path.exists(train_pairs_file):
          logging.info(
              "loading train pairs from pkl file %s" % train_pairs_file
          )
          train_pairs = pkl.load(open(train_pairs_file, "rb"))
      else:
          logging.info("generating walks")
          all_walks = dataset.generate_walks()
          logging.info("generating train pairs")
          train_pairs = dataset.generate_pairs(all_walks)
          logging.info("dumping train pairs to %s" % (train_pairs_file))
          pkl.dump(train_pairs, open(train_pairs_file, "wb"))
  
      logging.info("total train pairs: %d" % (len(train_pairs)))
      data = dataset.fetch_batch(
          train_pairs, config["data_loader"]["args"]["batch_size"]
      )
  
      place = (
          fluid.CUDAPlace(0) if config["use_cuda"] else fluid.CPUPlace()
      )
      train_program = fluid.Program()
      startup_program = fluid.Program()
      test_program = fluid.Program()
  
      with fluid.program_guard(train_program, startup_program):
          model = getattr(Model, config["model"]["type"])(
              config["model"]["args"], dataset, place
          )
  
      test_program = train_program.clone(for_test=True)
      with fluid.program_guard(train_program, startup_program):
          global_steps = len(data) * config["trainer"]["args"]["epochs"]
          model.backward(global_steps, config["optimizer"]["args"])
  
      # train
      exe = fluid.Executor(place)
      exe.run(startup_program)
      feed_dict = model.gw.to_feed(dataset.graph)
  
      logging.info("test before training...")
      test(test_program, exe, dataset, model, feed_dict)
      logging.info("training...")
      for epoch in range(1, 1 + config["trainer"]["args"]["epochs"]):
          train_result = run_epoch(
              epoch,
              config["trainer"]["args"],
              dataset,
              data,
              train_program,
              test_program,
              model,
              feed_dict,
              exe,
          )
  
          logging.info("validating and testing...")
          test_result = test(
              test_program, exe, dataset, model, feed_dict
          )
  
          filename = os.path.join(
              config["trainer"]["args"]["save_dir"],
              "dict_embed_model_epoch_%d.pkl" % (epoch),
          )
          save_model(
              test_program, exe, dataset, model, feed_dict, filename
          )
  
      logging.info(
          "final_test_AUC %.4f | final_test_PR %.4f | fianl_test_F1 %.4f"
          % (test_result["AUC"], test_result["PR"], test_result["F1"])
      )
  
      logging.info("training finished")
  
imports: import os
  import argparse
  import time
  import numpy
  import logging
  import pickle
  import pgl
  from pgl.utils import paddle_helper
  import paddle
  import paddle.fluid
  import paddle.fluid.layers
  from utils import *
  import Dataset
  import model
  from sklearn.metrics import auc, f1_score, precision_recall_curve, roc_auc_score
label_desc: Use image node_id 9 for calling a global function with example usage: main(config) without return types