我正在使用 Google Colab 训练对象检测模型,使用 tensorflow 对象检测 api。当我运行单元 train.py
时,它会不断打印诊断输出。大约 30 分钟后,由于单元格输出中打印的行数过多,浏览器崩溃。
是否有任何脚本可以用来定期(比如每 30 分钟)清除输出,而不是手动按下 clear output button
?
最佳答案
您可以使用 google.colab.output.clear()
from google.colab import output
for i in range(100):
print(i)
# do something
if i%10 == 0:
output.clear()
关于python - 你如何定期清除 Google Colab 的输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57086398/