Author: Awais Farooq

  • Writing your own callbacks

    Introduction A callback is a powerful tool to customize the behavior of a Keras model during training, evaluation, or inference. Examples include keras.callbacks.TensorBoard to visualize training progress and results with TensorBoard, or keras.callbacks.ModelCheckpoint to periodically save your model during training. In this guide, you will learn what a Keras callback is, what it can do, and how you can…

  • Customizing Saving and Serialization

    Introduction This guide covers advanced methods that can be customized in Keras saving. For most users, the methods outlined in the primary Serialize, save, and export guide are sufficient. APIs We will cover the following APIs: When restoring a model, these get executed in the following order: Setup State saving customization These methods determine how the state…

  • Save, serialize, and export models

    Introduction A Keras model consists of multiple components: The Keras API saves all of these pieces together in a unified format, marked by the .keras extension. This is a zip archive consisting of the following: Let’s take a look at how this works. How to save and load a model If you only have 10 seconds to…

  • Writing a training loop from scratch in PyTorch

    Setup Introduction Keras provides default training and evaluation loops, fit() and evaluate(). Their usage is covered in the guide Training & evaluation with the built-in methods. If you want to customize the learning algorithm of your model while still leveraging the convenience of fit() (for instance, to train a GAN using fit()), you can subclass the Model class and implement your own train_step() method, which is…

  • Writing a training loop from scratch in TensorFlow

    Setup Introduction Keras provides default training and evaluation loops, fit() and evaluate(). Their usage is covered in the guide Training & evaluation with the built-in methods. If you want to customize the learning algorithm of your model while still leveraging the convenience of fit() (for instance, to train a GAN using fit()), you can subclass the Model class and implement your own train_step() method, which is…

  • Writing a training loop from scratch in JAX

    Setup Introduction Keras provides default training and evaluation loops, fit() and evaluate(). Their usage is covered in the guide Training & evaluation with the built-in methods. If you want to customize the learning algorithm of your model while still leveraging the convenience of fit() (for instance, to train a GAN using fit()), you can subclass the Model class and implement your own train_step() method, which is…

  • Customizing what happens in fit() with PyTorch

    Introduction When you’re doing supervised learning, you can use fit() and everything works smoothly. When you need to take control of every little detail, you can write your own training loop entirely from scratch. But what if you need a custom training algorithm, but you still want to benefit from the convenient features of fit(), such as callbacks,…

  • Customizing what happens in fit() with TensorFlow

    Introduction When you’re doing supervised learning, you can use fit() and everything works smoothly. When you need to take control of every little detail, you can write your own training loop entirely from scratch. But what if you need a custom training algorithm, but you still want to benefit from the convenient features of fit(), such as callbacks,…

  • Customizing what happens in fit() with JAX

    Introduction When you’re doing supervised learning, you can use fit() and everything works smoothly. When you need to take control of every little detail, you can write your own training loop entirely from scratch. But what if you need a custom training algorithm, but you still want to benefit from the convenient features of fit(), such as callbacks,…

  • Training & evaluation with the built-in methods

    Setup Introduction This guide covers training, evaluation, and prediction (inference) models when using built-in APIs for training & validation (such as Model.fit(), Model.evaluate() and Model.predict()). If you are interested in leveraging fit() while specifying your own training step function, see the guides on customizing what happens in fit(): If you are interested in writing your own training & evaluation loops from scratch,…