简体   繁体   English

google colab中的Tensorflow网络,当我重新运行脚本时会发生什么

[英]Tensorflow networks in google colab, what happens when I re-run the script

I created a simple neural network with tensorflow and I am studying how the amount of epochs is affecting results.我用 tensorflow 创建了一个简单的神经网络,我正在研究时期的数量如何影响结果。 I use Google Colab for this purpose.为此,我使用 Google Colab。

Scenario:设想:

  1. I download the dataset from tensorflow (built-in)我从 tensorflow 下载数据集(内置)
  2. I create a model in tensorflow我在 tensorflow 中创建了一个 model
  3. I set the variable with how many epochs I want to train the model我将变量设置为要训练 model 的时期数
  4. Compile and train the model编译训练model

I noticed that when I re-run the script, the dataset is already downloaded and I am worried the model may be also kept in session memory..我注意到当我重新运行脚本时,数据集已经下载了,我担心 model 可能也会保存在 session memory 中。

My question is: if I re-run the script in google colab using option "Run after" with different epochs number, will this create new instance of the model and start training from 0, or will it start re-training already trained model?我的问题是:如果我在 google colab 中使用具有不同时期编号的选项“Run after”重新运行脚本,这会创建 model 的新实例并从 0 开始训练,还是开始重新训练已经训练的 model?

For example: I run the script and trained network for 10 epochs.例如:我运行脚本并训练网络 10 个 epoch。 I change the variable to 50 and re-run the script.我将变量更改为 50 并重新运行脚本。 Will it start training model from 0 to 50, or will it take already trained model and train for 50 more epochs, so 60 in total?它会开始从 0 到 50 训练 model,还是需要已经训练过的 model 并再训练 50 个 epoch,总共 60 个?

Is there any way to check for how many epochs the model was trained?有什么方法可以检查 model 训练了多少个纪元?

I created new script with network from tensorflow tutorial, added evaluation function after model compilation and before training and then after training.我从 tensorflow 教程创建了带有网络的新脚本,在 model 编译之后以及训练之前和训练之后添加了评估 function。

Answer: when re-running the script model is always trained from 0 epoch.答:当重新运行脚本 model 时,总是从 0 epoch 开始训练。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Python发生异常时如何重新运行循环? - How to re-run through loop when exception happens in Python? 每当我在PyCharm中重新运行脚本时,都需要终止在端口上运行的进程 - Process running on port needs to be killed everytime I re-run a script in PyCharm 从python脚本中重新运行脚本的命令 - Command to re-run script from within the script in python 我可以输入什么代码来清除所有以前的用户输入并从顶部重新运行代码? - What code can I put in to clear all previous user inputs and re-run the code from the top? 检查python脚本是否正常运行以及是否没有重新运行? - Check if a python script is running properly and if it isn't re-run it? 在crontab中重新运行失败的python导入脚本,直到成功 - re-run failed python import script in crontab untill succeed Scrapy:无法在Jupyter Notebook脚本中重新运行,报告ReactorNotRestartable - Scrapy: fail to re-run in Jupyter Notebook script, reporting ReactorNotRestartable 为什么我重新运行程序时,我的客户端没有通过 sockets 向服务器发送数据? - Why isn't my Client sending data to server through sockets when I re-run the program? 如何更改 Google Colab 脚本以在本地运行? - How can i change Google Colab script to run locally? Python - 失败时重新运行子进程调用 - Python - Re-run subprocess call when it fails
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM