"docs/git@developer.sourcefind.cn:hehl2/torchaudio.git" did not exist on "209858ea2eddd33e1a8f677ebd13d98b3d864906"
Commit 84165751 authored by A. Unique TensorFlower's avatar A. Unique TensorFlower
Browse files

Create output directories for finetuning data preparation if they don't exist.

PiperOrigin-RevId: 305703696
parent db6aca44
...@@ -578,6 +578,7 @@ def file_based_convert_examples_to_features(examples, label_list, ...@@ -578,6 +578,7 @@ def file_based_convert_examples_to_features(examples, label_list,
output_file): output_file):
"""Convert a set of `InputExample`s to a TFRecord file.""" """Convert a set of `InputExample`s to a TFRecord file."""
tf.io.gfile.makedirs(os.path.dirname(output_file))
writer = tf.io.TFRecordWriter(output_file) writer = tf.io.TFRecordWriter(output_file)
for (ex_index, example) in enumerate(examples): for (ex_index, example) in enumerate(examples):
......
...@@ -20,6 +20,7 @@ from __future__ import print_function ...@@ -20,6 +20,7 @@ from __future__ import print_function
import functools import functools
import json import json
import os
from absl import app from absl import app
from absl import flags from absl import flags
...@@ -191,6 +192,7 @@ def main(_): ...@@ -191,6 +192,7 @@ def main(_):
else: else:
input_meta_data = generate_squad_dataset() input_meta_data = generate_squad_dataset()
tf.io.gfile.makedirs(os.path.dirname(FLAGS.meta_data_file_path))
with tf.io.gfile.GFile(FLAGS.meta_data_file_path, "w") as writer: with tf.io.gfile.GFile(FLAGS.meta_data_file_path, "w") as writer:
writer.write(json.dumps(input_meta_data, indent=4) + "\n") writer.write(json.dumps(input_meta_data, indent=4) + "\n")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment