我正在 Google CoLab 上使用 Tensorflow 訓練模型。訓練過程向屏幕輸出了很多行。有沒有辦法將所有 python 輸出重定向到日志文件并稍后讀???PS我試過這個建議:https : //colab.research.google.com/drive/1q2mhsj4bwwdQK-KZIxrIIKed8O11MQl0但它僅適用于系統命令(如“ls -la”等)。使用此代碼,python 命令仍在寫入標準輸出。!python /root/models/research/object_detection/model_main.py \ --pipeline_config_path=/drive/data/ssd_mobilenet_v1_0.75_depth_300x300_coco14_sync.config \ --model_dir=/drive/data/ \ --num_train_steps=50000 \ --num_eval_steps=2000 \ --alsologtostderr
2 回答

慕無忌1623718
TA貢獻1744條經驗 獲得超4個贊
阿米特的回答很好。附帶說明:如果您收到類似于以下內容的錯誤消息:
tee: output.txt: Transport endpoint is not connected
并且您已經使用類似的東西在當前的 colab notebook 文件中安裝了一個驅動器;
drive.mount('/content/gdrive', force_remount=True)
重新檢查您是否沒有嘗試在嘗試運行的 python 腳本中再次安裝 gdrive 驅動器可能會有所幫助。
添加回答
舉報
0/150
提交
取消