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

Before Change


x = Dropout(0.5)(x)  // and dropout here.
x = Dense(1, activation="sigmoid")(x)

model = Model(inputs=[i], outputs=[x])

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())
    np.savez_compressed(file="tcn.npz", w=w, allow_pickle=True)
    print("First time.")

// Make inference.

After Change


                           Dense(units=1, activation="sigmoid")])

// 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")

// Make inference.
inputs = np.ones(shape=(1, 100))
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 7

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: HyperGAN/HyperGAN
Commit Name: 5a69007e1ab2f4c0b4a549c0a2a8cd9701fd8929
Time: 2017-06-28
Author: mikkel@255bits.com
File Name: examples/colorizer.py
Class Name:
Method Name: search


Project Name: pytorch/text
Commit Name: 37452ca74a6022d6b67ba0ba9af2b1e406de7578
Time: 2018-04-27
Author: zhshihang@gmail.com
File Name: torchtext/utils.py
Class Name:
Method Name: download_from_url


Project Name: RasaHQ/rasa
Commit Name: 06999395c7898abd4bc9ac3bae57d3516f7bca92
Time: 2019-03-14
Author: ric.wkr@gmail.com
File Name: tests/test_server.py
Class Name:
Method Name: test_stack_training