Search code examples
google-colaboratory

Neural Network Memory


Using Google Colab, I made a neural network using tensorflow that generates text based on examples. I ran 60 epochs. How can I get my neural network to maintain what it has learned. Whenever I re-run it, it starts over.


Solution

  • Try saving your model at the end of the training like this:

    import tensorflow as tf
    tf.keras.models.save_model(model, 'model/my_model')
    

    Then you can load the model like this:

    tf.keras.models.load_model('model/my_model')