(self, tokens, loss_masks, attention_mask, block_spans, rng, task='bert')
| 158 | return mask_spans |
| 159 | |
| 160 | def make_masked_data(self, tokens, loss_masks, attention_mask, block_spans, rng, task='bert'): |
| 161 | position_ids = np.arange(len(tokens), dtype=np.long) |
| 162 | targets = copy.deepcopy(tokens) |
| 163 | mask_id = self.tokenizer.get_command('MASK').Id |
| 164 | mlm_masks = np.zeros(len(tokens), dtype=np.long) |
| 165 | for start, end in block_spans: |
| 166 | for idx in range(start, end): |
| 167 | tokens[idx] = mask_id |
| 168 | mlm_masks[start: end] = 1 |
| 169 | loss_masks = loss_masks * mlm_masks |
| 170 | return tokens, targets, loss_masks, position_ids |
| 171 | |
| 172 | def make_block_data(self, tokens, loss_masks, attention_mask, block_spans, rng, task='bert'): |
| 173 | text_length = len(tokens) |
no test coverage detected