Exemple #1
0
def _create_all_examples(
    task,
    vocab_file,
    test_mode,
    output_dir,
    test_batch_size,
):
  """Converts interactions to TF examples."""
  interaction_dir = task_utils.get_interaction_dir(output_dir)
  example_dir = os.path.join(output_dir, 'tf_examples')
  file_utils.make_directories(example_dir)

  _create_examples(
      interaction_dir,
      example_dir,
      vocab_file,
      task_utils.get_train_filename(task),
      batch_size=None,
      test_mode=test_mode)
  _create_examples(interaction_dir, example_dir, vocab_file,
                   task_utils.get_dev_filename(task), test_batch_size,
                   test_mode)
  _create_examples(interaction_dir, example_dir, vocab_file,
                   task_utils.get_test_filename(task), test_batch_size,
                   test_mode)
Exemple #2
0
def _get_test_filename(task, test_set):
  if test_set == TestSet.TEST:
    return task_utils.get_test_filename(task)
  if test_set == TestSet.DEV:
    return task_utils.get_dev_filename(task)
  raise ValueError(f'Unknown test set: {test_set}')