792d64bd6f64c4483af5ca1cdb7cbe22c13b5715,demo/load_model/load_and_predict.py,,,#,7

Before Change



print("This demo demonstrates how to load the pre-trained model and check whether the two sentences are continuous")

config_path, checkpoint_path, dict_path = tuple(sys.argv[1:])

model = load_trained_model_from_checkpoint(config_path, checkpoint_path, training=True)
model.summary(line_length=120)

After Change


sentence_2 = "从某种角度看屬於形式科學的一種。"
print("Tokens:", tokenizer.tokenize(first=sentence_1, second=sentence_2))
indices, segments = tokenizer.encode(first=sentence_1, second=sentence_2)
masks = np.array([[0] * len(indices)])

predicts = model.predict([np.array([indices]), np.array([segments]), masks])[1]
print("%s is random next: " % sentence_2, bool(np.argmax(predicts, axis=-1)[0]))
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: CyberZHG/keras-bert
Commit Name: 792d64bd6f64c4483af5ca1cdb7cbe22c13b5715
Time: 2019-07-12
Author: CyberZHG@gmail.com
File Name: demo/load_model/load_and_predict.py
Class Name:
Method Name:


Project Name: dmlc/dgl
Commit Name: 2cdc4d3c1d17e1ac8be1c44ca54d772084c76f18
Time: 2020-03-21
Author: wmjlyjemaine@gmail.com
File Name: tutorials/basics/1_first.py
Class Name:
Method Name: build_karate_club_graph


Project Name: kundajelab/dragonn
Commit Name: 9c158b87f5fb2dca1ed95884e667ab2fc218e1b7
Time: 2017-05-01
Author: jisraeli@stanford.edu
File Name: dragonn/models.py
Class Name: SequenceDNN
Method Name: deeplift