code: def write_file(
      tokens_collect, pred_collect, tag_collect, file_name, tag_types
  ):
      num_sent = len(tokens_collect)
      f = open(file_name, "w")
      for idx in range(num_sent):
          sent_token = tokens_collect[idx]
          sent_pred = pred_collect[idx].cpu().clone().numpy()
          sent_tag = tag_collect[idx].cpu().clone().numpy()
          # f.write('%s\n' % ('-X- SENTENCE START'))
          for word_idx in range(len(sent_token)):
              w = sent_token[word_idx]
              tgt = tag_types[sent_tag[word_idx].item()]
              pred = tag_types[sent_pred[word_idx].item()]
              f.write("%d %s %s %s\n" % (word_idx + 1, w, tgt, pred))
  
      f.close()
  
imports: import argparse
  import os
  import torch
  import torch.backends.cudnn
  import torch.multiprocessing
  import torch.optim
  from torch.utils.data import DataLoader
  from graph4nlp.pytorch.data.data import from_batch
  from graph4nlp.pytorch.modules.evaluation.accuracy import Accuracy
  from graph4nlp.pytorch.modules.graph_construction import NodeEmbeddingBasedRefinedGraphConstruction
  from graph4nlp.pytorch.modules.graph_construction.node_embedding_based_graph_construction import NodeEmbeddingBasedGraphConstruction
  from graph4nlp.pytorch.modules.utils.generic_utils import to_cuda
  from conll import ConllDataset
  from conlleval import evaluate
  from dependency_graph_construction_without_tokenize import DependencyBasedGraphConstruction_without_tokenizer
  from line_graph_construction import LineBasedGraphConstruction
  from model import Word2tag
label_desc: Use image node_id 4 for calling a global function with example usage: write_file(tokens_collect, pred_collect, tag_collect, file_name, tag_types) without return types