code: def report(args, model, features):
      device = torch.device(
          "cuda:0" if torch.cuda.is_available() else "cpu"
      )
      dataloader = DataLoader(
          features,
          batch_size=args.test_batch_size,
          shuffle=False,
          collate_fn=collate_fn,
          drop_last=False,
      )
      preds = []
      for batch in dataloader:
          model.eval()
  
          inputs = {
              "input_ids": batch[0].to(device),
              "attention_mask": batch[1].to(device),
              "entity_pos": batch[3],
              "hts": batch[4],
          }
  
          with torch.no_grad():
              pred = model(**inputs)
              pred = pred.cpu().numpy()
              pred[np.isnan(pred)] = 0
              preds.append(pred)
  
      preds = np.concatenate(preds, axis=0).astype(np.float32)
      preds = to_official(args, preds, features)
      return preds
  
file_path: DeepKE/example/re/document/predict.py
imports: import os
  import time
  import hydra
  from hydra.utils import get_original_cwd
  import numpy
  import torch
  import ujson
  from torch.utils.data import DataLoader
  from transformers import AutoConfig, AutoModel, AutoTokenizer
  from transformers.optimization import AdamW, get_linear_schedule_with_warmup
  from deepke.relation_extraction.document import *
label_desc: Use image node_id 1 for calling a global function with example usage: report(args, model, features) and returns: preds