code: def train(self):
      max_score = -1
      max_idx = 0
      for epoch in range(args.epochs):
          self.model.train()
          print("Epoch: {}".format(epoch))
          pred_collect = []
          gt_collect = []
          for data in self.train_dataloader:
              graph, tgt = data["graph_data"], data["tgt_tag"]
              tgt_l = [tgt_.to(self.device) for tgt_ in tgt]
              graph = graph.to(self.device)
              pred_tags, loss = self.model(
                  graph, tgt_l, require_loss=True
              )
              pred_collect.extend(
                  pred_tags
              )  # pred: list of batch_sentence pred tensor
              gt_collect.extend(
                  tgt
              )  # tgt:list of sentence token tensor
              # num_tokens=len(torch.cat(pred_tags).view(-1))
              print(
                  "Epoch: {}".format(epoch)
                  + " loss:"
                  + str(loss.cpu().item())
              )
              self.optimizer.zero_grad()
              loss.backward()
              torch.nn.utils.clip_grad_norm_(self.model.parameters(), 1)
              self.optimizer.step()
  
          if epoch % 1 == 0:
              score = self.evaluate(epoch)
              if score > max_score:
                  self.model.save_checkpoint(
                      self.checkpoint_path, "best.pt"
                  )
                  max_idx = epoch
              max_score = max(max_score, score)
      return max_score, max_idx
  
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 6 for calling the Conll obj's underlying member method code with example usage: obj.train() and returns: max_score,  max_idx