code: def train(config):
      # Build Train Data
      data = TrainData(config.graph_work_path)
      train_iter = BatchGraphGenerator(
          graph_wrappers=[1],
          batch_size=config.batch_size,
          data=data,
          samples=config.samples,
          num_workers=config.sample_workers,
          feed_name_list=None,
          use_pyreader=False,
          phase="train",
          graph_data_path=config.graph_work_path,
          shuffle=True,
          neg_type=config.neg_type,
      )
      train_ds = Dataset.from_generator_func(train_iter).repeat(
          config.epochs
      )
      dev_ds = Dataset.from_generator_func(train_iter)
  
      (
          ernie_cfg_dict,
          ernie_param_path,
      ) = PretrainedModelLoader.from_pretrained(config.ernie_name)
  
      if "warm_start_from" not in config:
          warm_start_from = ernie_param_path
      else:
          ernie_param_path = config.ernie_param_path
  
      if "ernie_config" not in config:
          config.ernie_config = ernie_cfg_dict
  
      ws = propeller.WarmStartSetting(
          predicate_fn=lambda v: os.path.exists(
              os.path.join(warm_start_from, v.name)
          ),
          from_dir=warm_start_from,
      )
  
      train_ds.name = "train"
      train_ds.data_shapes = [
          [-1] + list(shape[1:]) for shape in train_ds.data_shapes
      ]
      dev_ds.name = "dev"
      dev_ds.data_shapes = [
          [-1] + list(shape[1:]) for shape in dev_ds.data_shapes
      ]
  
      tokenizer = load_tokenizer(config.ernie_name)
      config.cls_id = tokenizer.cls_id
  
      propeller.train.train_and_eval(
          model_class_or_model_fn=ERNIESageLinkPredictModel,
          params=config,
          run_config=config,
          train_dataset=train_ds,
          eval_dataset={"eval": dev_ds},
          warm_start_setting=ws,
      )
  
imports: import os
  import argparse
  import traceback
  import re
  import io
  import yaml
  import numpy
  from easydict import EasyDict
  from pgl.utils import paddle_helper
  from pgl.graph_wrapper import BatchGraphWrapper
  import propeller.paddle
  from propeller.paddle.data import Dataset
  import paddle.fluid
  import paddle.fluid.layers
  import logging
  from propeller import log
  from ernie.tokenizing_ernie import ErnieTokenizer
  from ernie.tokenizing_ernie import ErnieTinyTokenizer
  from dataset.graph_reader import BatchGraphGenerator
  from models.encoder import Encoder
  from models.pretrain_model_loader import PretrainedModelLoader
  from models.loss import Loss
  from optimization import optimization
label_desc: Use image node_id 2 for calling a global function with example usage: train(config) without return types