How to directly rebuild the model from saved zip file?
See original GitHub issueCurrently I want to rebuild the stable baseline model in keras and pytorch. It seems that the model cannot directly save to a h5 file. Thus I want to rebuild from the zip file save in this code.
log_dir = "test_save/"
model_dqn.save(log_dir + "pong")
This file contains the model structure in parameter_list
, and weights in parameters
. However, I cannot rebuild the model from these two files with the code below:
# load json and create model
json_file = open('parameter_list', 'r')
loaded_model_json = json_file.read()
json_file.close()
loaded_model = model_from_json(loaded_model_json)
loaded_model.load_weights("parameters")
Issue Analytics
- State:
- Created 4 years ago
- Comments:11
Top Results From Across the Web
structure and functioning of a ZIP file - Computer forensics
In this computer forensics tutorial you can learn how to restore a ZIP file manually. We go through the whole process step by...
Read more >Save and load Keras models | TensorFlow Core
# Train the model. # Calling `save('my_model')` creates a SavedModel folder `my_model`. # It can be used to reconstruct the model identically.
Read more >How do I reassemble a zip file that has been emailed in ...
Open the folder where the split folders are stored. · Right-click on the first of the folders and left click to select the...
Read more >How to save/restore a model after training? - Stack Overflow
If you restore to continue to train, just use the Saver checkpoints. If you save the model to do reference, just the tensorflow...
Read more >A quick complete tutorial to save and restore Tensorflow models
Hence, Tensorflow model has two main files: a) Meta graph: This is a protocol buffer which saves the complete Tensorflow graph; i.e. all...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for your reply. This mapping looks like ignore the last fully connected layer (i.e., from 512 hidden nodes to the action outputs). It would be soooo nice if you can share one example for loading from pkl file and then converting weights to a keras model. In that way, I think people can also save models to other formats (e.g., .h5 that is mentioned by ChunJyeBehBeh). However, this is based on your team has such an extension plan. Thanks so much for your help anyway:)
ONNX export ? or tracing using pytorch jit?