code: def train(args):
      import logging
  
      log.setLevel(logging.DEBUG)
      log.info("start")
  
      worker_num = int(os.getenv("PADDLE_TRAINERS_NUM", "0"))
      num_devices = int(os.getenv("CPU_NUM", 10))
  
      model = DeepwalkModel(
          args.num_nodes,
          args.hidden_size,
          args.neg_num,
          args.is_sparse,
          args.is_distributed,
          1.0,
      )
      pyreader = model.pyreader
      loss = model.forward()
  
      # init fleet
      role = role_maker.PaddleCloudRoleMaker()
      fleet.init(role)
  
      train_steps = math.ceil(
          1.0
          * args.num_nodes
          * args.epoch
          / args.batch_size
          / num_devices
          / worker_num
      )
      log.info("Train step: %s" % train_steps)
  
      if args.optimizer == "sgd":
          args.lr *= args.batch_size * args.walk_len * args.win_size
      optimization(args.lr, loss, train_steps, args.optimizer)
  
      # init and run server or worker
      if fleet.is_server():
          fleet.init_server(args.warm_start_from_dir)
          fleet.run_server()
  
      if fleet.is_worker():
          log.info("start init worker done")
          fleet.init_worker()
          # just the worker, load the sample
          log.info("init worker done")
  
          exe = F.Executor(F.CPUPlace())
          exe.run(fleet.startup_program)
          log.info("Startup done")
  
          if args.dataset is not None:
              # load graph from built-in dataset
              if args.dataset == "BlogCatalog":
                  graph = data_loader.BlogCatalogDataset().graph
              elif args.dataset == "ArXiv":
                  graph = data_loader.ArXivDataset().graph
              else:
                  raise ValueError(
                      args.dataset + " dataset doesn't exists"
                  )
              log.info("Load buildin BlogCatalog dataset done.")
          elif (
              args.walkpath_files is None
              or args.walkpath_files == "None"
          ):
              # build graph from edges file.
              graph = build_graph(args.num_nodes, args.edge_path)
              log.info("Load graph from '%s' done." % args.edge_path)
          else:
              # build a random graph for test
              graph = build_random_graph(args.num_nodes)
  
          # bind gen
          gen_func = build_gen_func(args, graph)
          test_data_pipeline(gen_func)
  
          pyreader.decorate_tensor_provider(gen_func)
          pyreader.start()
  
          compiled_prog = build_complied_prog(fleet.main_program, loss)
          train_prog(
              exe, compiled_prog, loss, pyreader, args, train_steps
          )
          fleet.stop_worker()
  
imports: import argparse
  import time
  import os
  import math
  from multiprocessing import Process
  import numpy
  import paddle.fluid
  import paddle.fluid.layers
  from paddle.fluid.incubate.fleet.parameter_server.distribute_transpiler import fleet
  from paddle.fluid.incubate.fleet.parameter_server.distribute_transpiler import StrategyFactory
  import paddle.fluid.incubate.fleet.base.role_maker
  import pgl
  from pgl.utils.logger import log
  from pgl import data_loader
  from reader import DeepwalkReader
  from model import DeepwalkModel
  from utils import get_file_list
  from utils import build_graph
  from utils import build_random_graph
  from utils import build_fake_graph
  from utils import build_gen_func
label_desc: Use image node_id 7 for calling a global function with example usage: train(args) without return types