class_docstr: Base class for WMT20 Datasets.
class_docstr_tok: ["Base","class","for","WMT20","Datasets","."]
code: def generate_encoded_samples(self, data_dir, tmp_dir, dataset_split):
      generator = self.generate_samples(
          data_dir, tmp_dir, dataset_split
      )
      vocab = self.get_or_create_vocab(data_dir, tmp_dir)
      # For each example, encode the text and append EOS ID.
      for sample in generator:
          if self.has_inputs:
              sample["inputs"] = vocab.encode(sample["inputs"])
              sample["inputs"].append(text_encoder.EOS_ID)
              sample["targets"] = vocab.encode(sample["targets"])
              sample["targets"].append(text_encoder.EOS_ID)
              yield sample
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import gzip
  import os
  import tarfile
  import zipfile
  from tensor2tensor.data_generators import cleaner_en_xx
  from tensor2tensor.data_generators import generator_utils
  from tensor2tensor.data_generators import problem
  from tensor2tensor.data_generators import text_encoder
  from tensor2tensor.data_generators import text_problems
  from tensor2tensor.utils import bleu_hook
  from tensor2tensor.utils import contrib
  from tensor2tensor.utils import mlperf_log
  import tensorflow.compat.v1
label_desc: Use image node_id 2 for calling the TranslateWmt20Problem obj's underlying member method code with example usage: obj.generate_encoded_samples(data_dir, tmp_dir, dataset_split) without return types