f4275c0b80197e0f1bbd3a2a1a31cf07d85013b1,scripts/word_embeddings/evaluate_pretrained.py,,,#,173
Before Change
// Load pre-trained embeddings
if not args_.embedding_path:
if args_.embedding_name.lower() == "fasttext":
token_embedding_ = nlp.embedding.create(
args_.embedding_name,
source=args_.embedding_source,
load_ngrams=args_.fasttext_load_ngrams,
allow_extend=True,
unknown_autoextend=True)
else:
token_embedding_ = nlp.embedding.create(
args_.embedding_name, source=args_.embedding_source)
name = "-" + args_.embedding_name + "-" + args_.embedding_source
else:
token_embedding_ = load_embedding_from_path(args_)
name = ""
After Change
known_tokens = set(token_embedding_.idx_to_token)
if args_.similarity_datasets:
with utils.print_time("find relevant tokens for similarity"):
tokens = evaluation.get_similarity_task_tokens(args_)
vocab = nlp.Vocab(nlp.data.count_tokens(tokens))
with utils.print_time("set {} embeddings".format(len(tokens))):
vocab.set_embedding(token_embedding_)
evaluation.evaluate_similarity(
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 8
Instances
Project Name: dmlc/gluon-nlp
Commit Name: f4275c0b80197e0f1bbd3a2a1a31cf07d85013b1
Time: 2019-01-09
Author: leonard@lausen.nl
File Name: scripts/word_embeddings/evaluate_pretrained.py
Class Name:
Method Name:
Project Name: tensorlayer/tensorlayer
Commit Name: b2e6cccd53bd6c076c32421b8c4d562a96437524
Time: 2018-03-10
Author: dhsig552@163.com
File Name: tensorlayer/layers/normalization.py
Class Name: LayerNormLayer
Method Name: __init__
Project Name: dmlc/gluon-cv
Commit Name: 2318052dc79966bf36675606b7d992a347418292
Time: 2019-01-07
Author: cheungchih@gmail.com
File Name: gluoncv/model_zoo/se_resnet.py
Class Name: SE_BasicBlockV2
Method Name: __init__