def _encode_and_batch(self,
                        dataset,
                        train=False,
                        filter_claims=True,
                        filter_evidence=True):
    """Convert a tensorflow dataset of unbatched, text examples to TF batches.

    Args:
      dataset: TF Dataset to transform
      train: Whether to encode as training dataset
      filter_claims: Whether to filter zero length claims
      filter_evidence: Whether to filter zero length evidence

    Returns:
      encoded and batched dataset for keras fit
    """
    encoded = self._encode_dataset(
        dataset, filter_claims=filter_claims, filter_evidence=filter_evidence)
    if train:
      encoded = encoded.shuffle(
          self._model_config.buffer_size, reshuffle_each_iteration=False)
    batched = self._batch_dataset(encoded)
    return batched
Convert a tensorflow dataset of unbatched, text examples to TF batches.

    Args:
      dataset: TF Dataset to transform
      train: Whether to encode as training dataset
      filter_claims: Whether to filter zero length claims
      filter_evidence: Whether to filter zero length evidence

    Returns:
      encoded and batched dataset for keras fit
    
language/serene/training.py