code: def main(args):
      if not args.use_cuda:
          paddle.set_device("cpu")
      if paddle.distributed.get_world_size() > 1:
          paddle.distributed.init_parallel_env()
  
      if args.edge_file:
          graph = load_from_file(args.edge_file)
      else:
          graph = load(args.dataset)
  
      model = SkipGramModel(
          graph.num_nodes,
          args.embed_size,
          args.neg_num,
          sparse=not args.use_cuda,
      )
      model = paddle.DataParallel(model)
  
      train_ds = ShardedDataset(graph.nodes, repeat=args.epoch)
  
      train_steps = int(len(train_ds) // args.batch_size)
      log.info("train_steps: %s" % train_steps)
      scheduler = paddle.optimizer.lr.PolynomialDecay(
          learning_rate=args.learning_rate,
          decay_steps=train_steps,
          end_lr=0.0001,
      )
  
      optim = Adam(
          learning_rate=scheduler, parameters=model.parameters()
      )
  
      collate_fn = BatchNode2vecWalk(
          graph,
          args.walk_len,
          args.win_size,
          args.neg_num,
          args.neg_sample_type,
          args.p,
          args.q,
      )
      data_loader = Dataloader(
          train_ds,
          batch_size=args.batch_size,
          shuffle=True,
          num_workers=args.sample_workers,
          collate_fn=collate_fn,
      )
  
      train_loss = train(model, data_loader, optim)
      paddle.save(model.state_dict(), "model.pdparams")
  
file_path: PGL/examples/node2vec/train.py
imports: import time
  import argparse
  import pgl
  import paddle
  import paddle.nn
  from pgl.utils.logger import log
  import numpy
  import yaml
  from easydict import EasyDict
  import tqdm
  from paddle.optimizer import Adam
  from pgl.utils.data import Dataloader
  from paddle.io import get_worker_info
  from model import SkipGramModel
  from dataset import ShardedDataset
  from dataset import BatchNode2vecWalk
label_desc: Use image node_id 4 for calling a global function with example usage: main(args) without return types