0cfe82c6beb9a28a5ff7da81b86fa0e93c388f14,tasks/save_reload_model.py,,,#,10

Before Change


if os.path.exists("tcn.npz"):
    // Load checkpoint if file exists.
    w = np.load("tcn.npz", allow_pickle=True)["w"]
    print("Model reloaded.")
    model.set_weights(w.tolist())
else:
    // Save the checkpoint.
    w = np.array(model.get_weights())

After Change



// get model as json string and save to file
model_as_json = model.to_json()
with open(r"model.json", "w") as json_file:
    json_file.write(model_as_json)
// save weights to file (for this format, need h5py installed)
model.save_weights("weights.h5")
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 2

Instances


Project Name: philipperemy/keras-tcn
Commit Name: 0cfe82c6beb9a28a5ff7da81b86fa0e93c388f14
Time: 2019-11-20
Author: premy@cogent.co.jp
File Name: tasks/save_reload_model.py
Class Name:
Method Name:


Project Name: jadore801120/attention-is-all-you-need-pytorch
Commit Name: d5ca7331d0fec71a409e4df2629eda0e632640a6
Time: 2019-12-08
Author: jadore801120@gmail.com
File Name: train.py
Class Name:
Method Name: prepare_dataloaders_from_bpe_files


Project Name: nipy/dipy
Commit Name: 5b0238d247d238b768a5729dd7a5fda931bf2fb1
Time: 2020-10-17
Author: skab12@gmail.com
File Name: dipy/io/tests/test_io_gradients.py
Class Name:
Method Name: test_read_bvals_bvecs