68ddd94e9f80f43cb623e41056c0759ee3883df0,pliers/extractors/text.py,BertLMExtractor,_mask,#BertLMExtractor#Any#Any#,663
Before Change
self.mask_token, self.mask_pos = (mask, w_idx)
else:
raise ValueError("mask argument must be an integer or a string")
nr_masks = len(np.where(np.array(mwds)=="[MASK]")[0])
if nr_masks == 0:
raise ValueError("No valid mask tokens found.")
elif nr_masks > 1:
raise ValueError("Too many masked items.")
return mwds
def _postprocess(self, preds, tok, wds, ons, dur):
preds = preds[0].numpy()[:,1:-1,:]
After Change
self.return_true = return_true
def _mask(self, wds, mask):
if not type(mask) in [int, str]:
raise ValueError("mask argument must be an integer or a string")
mwds = wds.copy()
self.mask_token = mask if type(mask) == str else mwds[mask]
self.mask_pos = np.where(np.array(mwds)==self.mask_token)[0][0]
mwds[self.mask_pos] = "[MASK]"
return mwds
def _extract(self, stims, mask):
"""
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 8
Instances
Project Name: tyarkoni/pliers
Commit Name: 68ddd94e9f80f43cb623e41056c0759ee3883df0
Time: 2020-03-10
Author: rbrrcc@gmail.com
File Name: pliers/extractors/text.py
Class Name: BertLMExtractor
Method Name: _mask
Project Name: dnouri/skorch
Commit Name: a5f83e8f1e29c62070333d6ce48009e2fdb323b9
Time: 2017-07-19
Author: benjamin.bossan@ottogroup.com
File Name: inferno/net.py
Class Name: NeuralNet
Method Name: initialize_callbacks
Project Name: bsmurphy/PyKrige
Commit Name: 42848a82644abab540be1015d2e6267d676f83cf
Time: 2017-02-02
Author: basaks@gmail.com
File Name: pykrige/rk.py
Class Name: Krige
Method Name: fit