MCPcopy Create free account
hub / github.com/PaddlePaddle/Research / _except

Function _except

NLP/UNIMO-2/src/reader/unimo_grounded_batching.py:265–279  ·  view source on GitHub ↗

making all src_ids as target src_ids: [CLS] [SEP] [CLS] t1 t2 ... tn pos_ids: [0, 1, 0, 1, ..., n-1] seg_labels: [-1, -1, -1, 0, 0, ...,0] sent_ids: [0, 0, 0, 0, ..., 0] sent_b_starts: [2]

(sent_index, batch_del_pos, batch_src_ids, batch_pos_ids,
            seg_labels, batch_sent_ids, sent_b_starts, mask_id, cls_id, sep_id)

Source from the content-addressed store, hash-verified

263
264
265def _except(sent_index, batch_del_pos, batch_src_ids, batch_pos_ids,
266 seg_labels, batch_sent_ids, sent_b_starts, mask_id, cls_id, sep_id):
267 """making all src_ids as target
268 src_ids: [CLS] [SEP] [CLS] t1 t2 ... tn
269 pos_ids: [0, 1, 0, 1, ..., n-1]
270 seg_labels: [-1, -1, -1, 0, 0, ...,0]
271 sent_ids: [0, 0, 0, 0, ..., 0]
272 sent_b_starts: [2]
273 """
274 batch_del_pos.append([])
275 batch_src_ids[sent_index] = [cls_id, sep_id] + batch_src_ids[sent_index][:510]
276 batch_pos_ids[sent_index] = [0, 1] + list(range(0, len(batch_src_ids[sent_index]) - 2))
277 seg_labels[sent_index] = [-1, -1] + seg_labels[sent_index][:510]
278 batch_sent_ids[sent_index] = [0] * len(seg_labels[sent_index])
279 sent_b_starts.append(2)
280
281
282def prepare_batch_data(insts,

Callers 1

prepare_batch_dataFunction · 0.85

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected