c10aaab0fb6c0d58f9c6b8a78042fe62d84cc389,addons/embed_bert.py,BERTHubModel,__init__,#BERTHubModel#Any#,1452
Before Change
if "vocab" in kwargs:
self.vocab = kwargs["vocab"]
else:
self.vocab = load_vocab(kwargs.get("vocab_file"))
self.vsz = len(self.vocab)
self.dsz = kwargs.get("dsz")
self.trainable = kwargs.get("trainable", False)
def get_vocab(self):
After Change
super().__init__(name=name, **kwargs)
pooling = kwargs.get("pooling", "cls")
if pooling == "max":
self.pooling_op = _max_pool
elif pooling == "mean":
self.pooling_op = _mean_pool
elif pooling == "sqrt_length":
self.pooling_op = self._sqrt_length_pool
else:
self.pooling_op = self._cls_pool
def _sqrt_length_pool(self, inputs, embeddings):
lengths = (inputs != 0).sum(1)
sqrt_length = lengths.float().sqrt().unsqueeze(1)
embeddings = embeddings.sum(1) / sqrt_length
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 13
Instances
Project Name: dpressel/mead-baseline
Commit Name: c10aaab0fb6c0d58f9c6b8a78042fe62d84cc389
Time: 2020-04-14
Author: dpressel@gmail.com
File Name: addons/embed_bert.py
Class Name: BERTHubModel
Method Name: __init__
Project Name: cve-search/cve-search
Commit Name: b3f9fcd7774b4848df1eb8cea1eb1bdf6459911d
Time: 2019-01-29
Author: serge-olivier.paquette@delvelabs.ca
File Name: sbin/db_mgmt_cwe.py
Class Name: CWEHandler
Method Name: startElement
Project Name: AlexsLemonade/refinebio
Commit Name: f55c645373b2057a5c1c7861cdb6c717585cf0b7
Time: 2018-05-29
Author: kurt.wheeler91@gmail.com
File Name: foreman/data_refinery_foreman/surveyor/geo.py
Class Name: GeoSurveyor
Method Name: create_experiment_and_samples_from_api