def txt_line_sharded_iterator(txt_pattern):
  """Iterate through lines of sharded file."""
  all_files = tf.gfile.Glob(txt_pattern)
  for txt_path in all_files:
    with tf.gfile.Open(txt_path) as f:
      for line in f:
        yield line.strip()
Iterate through lines of sharded file.
tensor2tensor/data_generators/text_problems.py