添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

I’ve noticed when going through lengthy ML tutorials for Keras and TensorFlow that I often run the same models repeatedly in Jupyter Notebook, regardless of the fact they have no changes. This is natural for me with a notebook with multiple models. I also find that typing the code into a new notebook, rather than just clicking Shift + Enter , aids my understanding and retention of what I have learned.

Most of the time this is not a big deal, but sometimes, even in a lesson notebook, you have models and data that require hours of training. Even simple models could take several minutes. This means wasted time, and energy in the form of compute resources. It may not seem like a lot, but after a while this all adds up. We have a planet to think of here!

How can you avoid all this waste without much effort? Save your models so you can reload them when the notebook runs again.

Saving your TensorFlow model

In this example using TensorFlow and Keras, I trained the model first and saved it once training completed. I can then reload the model later. This requires commenting and uncommenting the appropriate code. Simple, but crude.

I started working on PTMLib when I found myself using the same blocks of helper code in Jupyter Notebook repeatedly. I have found that it saves me time and compute energy, which adds up after a while. I hope you find it useful too.

Posted on Categories Machine Learning , Projects Tags , , ,

Post navigation