code: def test_training_summarizer_transformer(self):
      transformer_summarizer = TransformerSummarizer(
          num_heads=1,
          num_layers=1,
          feed_forward_dim=20,
          embedding_size=10,
          dropout_rate=0,
          max_prediction_len=3,
      )
      transformer_summarizer.init_model(
          preprocessor=self.preprocessor,
          vectorizer=self.vectorizer,
          embedding_weights_encoder=None,
          embedding_weights_decoder=None,
      )
      loss_transformer = 0
      train_step = transformer_summarizer.new_train_step(
          loss_function=self.loss_func, batch_size=2
      )
      for e in range(0, 10):
          for source_seq, target_seq in self.dataset.take(-1):
              loss_transformer = train_step(source_seq, target_seq)
              print(str(loss_transformer))
  
      self.assertAlmostEqual(
          1.3421446084976196, float(loss_transformer), 5
      )
      output_transformer = transformer_summarizer.predict_vectors(
          "a c", ""
      )
      expected_first_logits = np.array(
          [-0.514366, 1.416978, -0.679771, -0.488442, -0.022602]
      )
      np.testing.assert_allclose(
          expected_first_logits,
          output_transformer["logits"][0],
          atol=1e-6,
      )
      self.assertEqual(
          "<start> a c <end>",
          output_transformer["preprocessed_text"][0],
      )
      self.assertEqual("c c c", output_transformer["predicted_text"])
  
file_path: headliner/tests/test_training.py
imports: import unittest
  import numpy
  import tensorflow
  from headliner.losses import masked_crossentropy
  from headliner.model.basic_summarizer import BasicSummarizer
  from headliner.model.attention_summarizer import AttentionSummarizer
  from headliner.model.transformer_summarizer import TransformerSummarizer
  from headliner.preprocessing.dataset_generator import DatasetGenerator
  from headliner.preprocessing.keras_tokenizer import KerasTokenizer
  from headliner.preprocessing.preprocessor import Preprocessor
  from headliner.preprocessing.vectorizer import Vectorizer
label_desc: Use image node_id 4 for calling the TestTraining obj's underlying member method code with example usage: obj.test_training_summarizer_transformer() without return types