Search code examples
pythontensorflowkerasgoogle-colaboratory

How to download return from google colab?


I am using Google colab to analyze some data. I want to download the model file. I have a code like that:

model.fit(x_train, y_train, epochs=1, batch_size=1, 

I tried using the download(), but it doesn't work. Is there any way to download it?


Solution

  • I assuming that you are using Keras, because model.save() method return None so if you put it as download() method parameter, it will make an error. Just save model first then download it after that:

    model.save('model_name.h5')
    download('model_name.h5')
    

    And make sure that you are at the correct directory that contain model_name.h5 file. You can check that with !ls command.