Sign up to take part
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
I would like to save a keras model in a folder. I can not figure out how to save the weights of my models because I do not find the correct filepath.
The needed code to achieve this goal is :
model.save_weights(filepath)
Even with this syntax :
path = str(trained_LSTM_info['accessInfo']['root'])
model.save_weights(os.path.join(path, 'My_model_weights.h5'))
I can not use the syntax because I am on HDFS :
.get_path()
Do you have the correct syntax ?
Thank you very much.
Hi,
Keras can only save H5 files to a regular filesystem, not to arbitrary storage locations.
You can either (recommended) switch your managed folder to a local folder, or:
* Save weights to a local file
* Then upload the models file to the managed folder using folder.upload_file(path_of_the_local_file, "path_in_the_managed_folder")
. You'll need to use something like that for retrieving the file in the scoring recipe:
with open("localfile", "wb") as out:
with folder.get_download_stream("path-of-the-h5-file") as in:
out.write(in.read())
Hi,
Keras can only save H5 files to a regular filesystem, not to arbitrary storage locations.
You can either (recommended) switch your managed folder to a local folder, or:
* Save weights to a local file
* Then upload the models file to the managed folder using folder.upload_file(path_of_the_local_file, "path_in_the_managed_folder")
. You'll need to use something like that for retrieving the file in the scoring recipe:
with open("localfile", "wb") as out:
with folder.get_download_stream("path-of-the-h5-file") as in:
out.write(in.read())