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,
output_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)
for (ex_index, example) in enumerate(examples):
......
......@@ -20,6 +20,7 @@ from __future__ import print_function
import functools
import json
import os
from absl import app
from absl import flags
......@@ -191,6 +192,7 @@ def main(_):
else:
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:
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