When using estimator.Estimator in tensorflow.contrib.learn, after training and prediction there are these files in the modeldir:
When the graph is complicated or the number of variables is big, the graph.pbtxt file and the events files can be very big. Is here a way to not write these files? Since model reloading only needs the checkpoint files removing them won't affect evaluation and prediction down the road.
On Google's Machine Learning Crash Course they use the following approach:
# Create classifier:
classifier = tf.estimator.DNNRegressor(
feature_columns=feature_columns,
optimizer=optimizer
)
# Train it:
classifier.train(
input_fn=training_input_fn,
steps=steps
)
# Remove event files to save disk space.
_ = map(os.remove, glob.glob(os.path.join(classifier.model_dir, 'events.out.tfevents*')))
If you don't want the events.out.tfevents files to be written. Find in your code somethings like these and delete them.
tfFileWriter = tf.summary.FileWriter(os.getcwd())
tfFileWriter.add_graph(sess.graph)
tfFileWriter.close()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With