code: def main(args):
      """The main funciton for training LINE model."""
      make_dir(args.save_dir)
      set_seed(args.seed)
  
      dataset = FlickrDataset(args.data_path)
  
      log.info("num nodes in graph: %d" % dataset.graph.num_nodes)
      log.info("num edges in graph: %d" % dataset.graph.num_edges)
  
      place = fluid.CUDAPlace(0) if args.use_cuda else fluid.CPUPlace()
  
      main_program = fluid.default_main_program()
      startup_program = fluid.default_startup_program()
  
      # build model here
      with fluid.program_guard(main_program, startup_program):
          loss, opt = build_model(args, dataset.graph)
  
      exe = fluid.Executor(place)
      exe.run(
          startup_program
      )  # initialize the parameters of the network
  
      batchrange = int(dataset.graph.num_edges / args.batch_size)
      T = batchrange * args.epochs
      for epoch in range(args.epochs):
          for b in range(batchrange):
              lr = max(
                  args.lr * (1 - (batchrange * epoch + b) / T), 0.0001
              )
  
              u_i, u_j, label = dataset.fetch_batch(
                  batch_size=args.batch_size,
                  K=args.neg_sample_size,
                  edge_sampling=args.sample_method,
                  node_sampling=args.sample_method,
              )
  
              feed_dict = {
                  "u_i": u_i,
                  "u_j": u_j,
                  "label": label,
                  "learning_rate": lr,
              }
  
              ret_loss = exe.run(
                  main_program,
                  feed=feed_dict,
                  fetch_list=[loss],
                  return_numpy=True,
              )
  
              if b % 500 == 0:
                  log.info(
                      "Epoch %d | Step %d | Loss %f | lr: %f"
                      % (epoch, b, ret_loss[0], lr)
                  )
  
          # save parameters in every epoch
          log.info("saving persistables parameters...")
          cur_save_path = os.path.join(
              args.save_dir, "model_epoch_%d" % (epoch + 1)
          )
          save_param(cur_save_path, ["shared_w"])
  
file_path: PGL/legacy/examples/line/line.py
imports: import time
  import argparse
  import random
  import os
  import numpy
  import pgl
  import paddle.fluid
  import paddle.fluid.layers
  from pgl.utils.logger import log
  from data_loader import FlickrDataset
label_desc: Use image node_id 5 for calling a global function with example usage: main(args) without return types