f4275c0b80197e0f1bbd3a2a1a31cf07d85013b1,scripts/word_embeddings/evaluate_pretrained.py,,,#,173
Before Change
enforce_max_size(token_embedding_, args_.max_vocab_size)
known_tokens = set(token_embedding_.idx_to_token)
// Auto-extend token_embedding with unknown extra eval tokens
if token_embedding_.unknown_lookup is not None:
eval_tokens = evaluation.get_tokens_in_evaluation_datasets(args_)
// pylint: disable=pointless-statement
token_embedding_[[
t for t in eval_tokens - known_tokens
if t in token_embedding_.unknown_lookup
]]
if args_.max_vocab_size is not None and len(
token_embedding_.idx_to_token) > args_.max_vocab_size:
logging.warning("Computing embeddings for OOV words that occur "
"in the evaluation dataset lead to having "
"more words than --max-vocab-size. "
"Have %s words (--max-vocab-size %s)",
len(token_embedding_.idx_to_token),
args_.max_vocab_size)
similarity_results = evaluation.evaluate_similarity(
args_, token_embedding_, ctx, logfile=os.path.join(
args_.logdir, "similarity{}.tsv".format(name)))
analogy_results = evaluation.evaluate_analogy(
After Change
"OOV tokens for analogy"):
tokens = evaluation.get_analogy_task_tokens(args_)
if token_embedding_.unknown_token is not None:
tokens.update(token_embedding_.idx_to_token[1:] )
else:
tokens.update(token_embedding_.idx_to_token)
vocab = nlp.Vocab(nlp.data.count_tokens(tokens))
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 3
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: ray-project/ray
Commit Name: 1f00f834ac44d06dbe7264ca712b8d587b0a60f6
Time: 2021-01-18
Author: sven@anyscale.io
File Name: rllib/agents/a3c/a3c.py
Class Name:
Method Name: validate_config
Project Name: microsoft/nni
Commit Name: 2de52a8976971da4836727ba9242fedcc7474878
Time: 2020-01-16
Author: 656569648@qq.com
File Name: src/sdk/pynni/nni/compression/torch/compressor.py
Class Name: Pruner
Method Name: export_model