如何在caffe中使用Python-API写入日志文件
How to write to log file with Python-API in caffe
我有一个 python 脚本来使用 caffe 进行训练。我的 start_train.py
看起来像这样:
python train.py 2>&1 | tee $LOGGING
在我的 train.py
中,我有这样的代码:
sys.stderr.write("[%s] 迭代 %d: %f 秒" % (time.strftime("%c"), 它, time.time()-开始) )
但是,这段代码没有写入$LOGGING
文件。我怎样才能做到这一点?
像这样将 -u
添加到您的命令中:
python -u train.py 2>&1 | tee $LOGGING
并使用
print("[%s] Iteration %d: %f seconds" % (time.strftime("%c"), it, time.time()-start)
我有一个 python 脚本来使用 caffe 进行训练。我的 start_train.py
看起来像这样:
python train.py 2>&1 | tee $LOGGING
在我的 train.py
中,我有这样的代码:
sys.stderr.write("[%s] 迭代 %d: %f 秒" % (time.strftime("%c"), 它, time.time()-开始) )
但是,这段代码没有写入$LOGGING
文件。我怎样才能做到这一点?
像这样将 -u
添加到您的命令中:
python -u train.py 2>&1 | tee $LOGGING
并使用
print("[%s] Iteration %d: %f seconds" % (time.strftime("%c"), it, time.time()-start)