code: def setUp(self):
      # Load datasets.
      train_path = os.path.join(DATA_ROOT, "train.txt")
      valid_path = os.path.join(DATA_ROOT, "valid.txt")
      self.x_train, self.y_train = load_data_and_labels(train_path)
      self.x_valid, self.y_valid = load_data_and_labels(valid_path)
  
      # Fit transformer.
      self.p = IndexTransformer()
      self.p.fit(self.x_train, self.y_train)
  
      # Build a model.
      self.model = BiLSTMCRF(
          char_vocab_size=self.p.char_vocab_size,
          word_vocab_size=self.p.word_vocab_size,
          num_labels=self.p.label_size,
      )
      self.model, loss = self.model.build()
      self.model.compile(loss=loss, optimizer="adam")
  
file_path: anago/tests/test_trainer.py
imports: import os
  import unittest
  from anago.utils import load_data_and_labels
  from anago.models import BiLSTMCRF, save_model
  from anago.preprocessing import IndexTransformer
  from anago.trainer import Trainer
label_desc: Use image node_id 2 for calling the TestTrainer obj's underlying member method code with example usage: obj.setUp() without return types