问题
I am training a machine learning model on google's colab. I am using keras with tensorflow backend (python 3.6).
I am saving my model using the model.save()
function provided by keras. When I call model.save('model_name
)` where is the file saved? I cannot find it in my drive anywhere.
回答1:
First, mount your drive:
!mkdir -p drive
!google-drive-ocamlfuse drive
Now, append your path:
import sys
sys.path.append('drive/Project')
You should be able to see your files on your local and web-based drive using:
model.save('drive/Project/myModel.h5')
回答2:
Even though it is a bit late, I was also struggling with the same question.Then i found out mounting the drive in colab and then providing the drive path,the files will get stored in the google drive
from google.colab import drive
drive.mount('/content/gdrive')
#using model.save_weights() to save the weights of the model in HDF5 format
model.save_weights("/content/gdrive/My Drive/weights.h5")
The file is saved in the drive with name "weights.h5"
来源:https://stackoverflow.com/questions/49967752/google-colab-where-is-the-output-saved