class_docstr: Dataset scheduling for multiple text-to-text problems.
class_docstr_tok: ["Dataset","scheduling","for","multiple","text-to-text","problems","."]
docstr: Generates TF-Records for problems using a global vocabulary file.
docstr_tok: ["Generates","TF-Records","for","problems","using","a","global","vocabulary","file","."]
code: def generate_data_with_shared_vocab(
      self, data_dir, tmp_dir, task_id=-1
  ):
      """Generates TF-Records for problems using a global vocabulary file."""
      global_vocab_filename = os.path.join(
          data_dir, self.vocab_filename
      )
      if not tf.gfile.Exists(global_vocab_filename):
          raise ValueError(
              "Global vocabulary file: %s does not exist, "
              "please create one using build_vocab.py"
              % global_vocab_filename
          )
      # Before generating data, we copy the global vocabulary file to the children
      # locations. Although this is not the most disk efficient strategy, it
      # imposes the fewest changes to the text-to-text API.
      for p in self.problems:
          local_vocab_filename = os.path.join(
              data_dir, p.vocab_filename
          )
          if not tf.gfile.Exists(local_vocab_filename):
              tf.gfile.Copy(global_vocab_filename, local_vocab_filename)
          p.generate_data(data_dir, tmp_dir, task_id)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import functools
  import os
  import numpy
  from tensor2tensor.data_generators import problem
  from tensor2tensor.data_generators import text_problems
  import tensorflow.compat.v1
label_desc: Use image node_id 2 for calling the MultiText2TextProblem obj's underlying member method code with example usage: obj.generate_data_with_shared_vocab(data_dir, tmp_dir, task_id) without return types