code: def fit(
      self,
      x_train: TextSamplesVar,
      y_train: TextSamplesVar,
      *,
      batch_size: int = 64,
      epochs: int = 5,
      callbacks: List[tf.keras.callbacks.Callback] = None,
  ) -> tf.keras.callbacks.History:
      train_gen = CorpusGenerator(x_train, y_train)
      self.build_model_generator(train_gen)
  
      train_dataset = Seq2SeqDataSet(
          train_gen,
          batch_size=batch_size,
          encoder_processor=self.encoder_processor,
          encoder_seq_length=self.encoder_seq_length,
          decoder_processor=self.decoder_processor,
          decoder_seq_length=self.decoder_seq_length,
      )
  
      if callbacks is None:
          callbacks = []
      history_callback = tf.keras.callbacks.History()
      callbacks.append(history_callback)
  
      for c in callbacks:
          c.set_model(self)
          c.on_train_begin()
  
      for epoch in range(epochs):
          for c in callbacks:
              c.on_epoch_begin(epoch=epoch)
          enc_hidden = tf.zeros((batch_size, self.hidden_size))
          total_loss = []
  
          with tqdm.tqdm(total=len(train_dataset)) as p_bar:
              for inputs, targets in train_dataset.take():
                  p_bar.update(1)
                  batch_loss = self.train_step(
                      inputs, targets, enc_hidden
                  )
                  total_loss.append(batch_loss.numpy())
                  info = (
                      f"Epoch {epoch + 1}/{epochs} | Epoch Loss: {np.mean(total_loss):.4f} "
                      f"Batch Loss: {batch_loss.numpy():.4f}"
                  )
                  p_bar.set_description_str(info)
          logs = {"loss": np.mean(total_loss)}
          for c in callbacks:
              c.on_epoch_end(epoch=epoch, logs=logs)
  
      return history_callback
  
imports: import json
  import os
  import pathlib
  from typing import Any, Tuple, List, Dict
  import numpy
  import tensorflow
  import tqdm
  import kashgari
  from kashgari.embeddings import BareEmbedding
  from kashgari.embeddings.abc_embedding import ABCEmbedding
  from kashgari.generators import CorpusGenerator, Seq2SeqDataSet
  from kashgari.logger import logger
  from kashgari.processors import SequenceProcessor
  from kashgari.tasks.seq2seq.decoder import AttGRUDecoder
  from kashgari.tasks.seq2seq.encoder import GRUEncoder
  from kashgari.types import TextSamplesVar
label_desc: Use image node_id 8 for calling the Seq2Seq obj's underlying member method code with example usage: obj.fit(x_train, y_train) and returns: history_callback