dda76fd82e99ce21cba2e1345732fa859a20fc72,allennlp/data/token_indexers/pretrained_transformer_indexer.py,PretrainedTransformerIndexer,_add_encoding_to_vocabulary_if_needed,#PretrainedTransformerIndexer#Any#,65
Before Change
return
pretrained_vocab = self._tokenizer.get_vocab()
for word, idx in pretrained_vocab.items() :
vocab._token_to_index[self._namespace][word] = idx
vocab._index_to_token[self._namespace][idx] = word
After Change
try:
vocab_items = self._tokenizer.get_vocab().items()
except NotImplementedError:
vocab_items = (
(self._tokenizer.convert_ids_to_tokens(idx), idx)
for idx in range(self._tokenizer.vocab_size)
)
for word, idx in vocab_items:
vocab._token_to_index[self._namespace][word] = idx
vocab._index_to_token[self._namespace][idx] = word
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 4
Instances Project Name: allenai/allennlp
Commit Name: dda76fd82e99ce21cba2e1345732fa859a20fc72
Time: 2020-04-15
Author: dirkg@allenai.org
File Name: allennlp/data/token_indexers/pretrained_transformer_indexer.py
Class Name: PretrainedTransformerIndexer
Method Name: _add_encoding_to_vocabulary_if_needed
Project Name: ray-project/ray
Commit Name: 732197e23a937b7b6d196936519c16ec6317ea9f
Time: 2021-03-08
Author: sven@anyscale.io
File Name: rllib/execution/train_ops.py
Class Name: TrainTFMultiGPU
Method Name: __call__
Project Name: hanxiao/bert-as-service
Commit Name: 624f5b31d0572da62f8a61f51d49a157717c9a51
Time: 2019-01-21
Author: hanhxiao@tencent.com
File Name: benchmark.py
Class Name:
Method Name: