Google Colab - Where is the output saved?

久未见 提交于 2021-02-18 16:32:45

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!