code: def predict(config):
      # Build Train Data
      trainer_id = int(os.getenv("PADDLE_TRAINER_ID", "0"))
  
      num_nodes = int(
          np.load(os.path.join(config.graph_work_path, "num_nodes.npy"))
      )
      data = PredictData(num_nodes)
      predict_iter = BatchGraphGenerator(
          graph_wrappers=[1],
          batch_size=config.infer_batch_size,
          data=data,
          samples=config.samples,
          num_workers=config.sample_workers,
          feed_name_list=None,
          use_pyreader=False,
          phase="predict",
          graph_data_path=config.graph_work_path,
          shuffle=False,
          neg_type=config.neg_type,
      )
      predict_ds = Dataset.from_generator_func(predict_iter)
  
      predict_ds.name = "predict"
      predict_ds.data_shapes = [
          [-1] + list(shape[1:]) for shape in predict_ds.data_shapes
      ]
  
      tokenizer = load_tokenizer(config.ernie_name)
      config.cls_id = tokenizer.cls_id
  
      (
          ernie_cfg_dict,
          ernie_param_path,
      ) = PretrainedModelLoader.from_pretrained(config.ernie_name)
      config.ernie_config = ernie_cfg_dict
  
      est = propeller.Learner(ERNIESageLinkPredictModel, config, config)
  
      id2str = io.open(
          os.path.join(config.graph_work_path, "terms.txt"),
          encoding=config.encoding,
      ).readlines()
      fout = io.open(
          "%s/part-%s" % (config.model_dir, trainer_id),
          "w",
          encoding="utf8",
      )
  
      if "infer_model" in config:
          predict_result_iter = est.predict(
              predict_ds, ckpt_path=config["infer_model"]
          )
      else:
          predict_result_iter = est.predict(predict_ds, ckpt=-1)
  
      for user_feat, user_real_index in predict_result_iter:
          sri = id2str[int(user_real_index)].strip("\n")
          line = "{}\t{}\n".format(sri, tostr(user_feat))
          fout.write(line)
  
      fout.close()
  
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 4 for calling a global function with example usage: predict(config) without return types