Issue
This is the result I get after fitting my model in Tensorflow 2 on a jupyter notebook
Epoch 18/20
7352/7352 [==============================] - 13s 2ms/sample - loss: 0.0184 - accuracy: 0.9954 - val_loss: 0.4653 - val_accuracy: 0.9094
Epoch 19/20
7352/7352 [==============================] - 12s 2ms/sample - loss: 0.0243 - accuracy: 0.9916 - val_loss: 0.6256 - val_accuracy: 0.8880
Epoch 20/20
7352/7352 [==============================] - 13s 2ms/sample - loss: 0.0699 - accuracy: 0.9845 - val_loss: 0.4982 - val_accuracy: 0.9023
Since I'll be running my jupyter notebook script from a remote server, I won't have access to it's GUI. Is there a way to programmatically save the results to a .txt file (Or any other like a spreadsheet?)
Solution
One approach here is by redirecting your stdout using the sys library.
import sys
orig_stdout = sys.stdout
f = open('train_log.txt', 'w')
sys.stdout = f
model.fit(x_train, y_train, epochs = 100)
sys.stdout = orig_stdout
f.close()
Another one is by redirecting externally the script to the file using shell.
./script.py > log.txt
Answered By - TF_Support
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.