Spaces:
Build error
Build error
PeteBleackley
commited on
Commit
·
a0c9643
1
Parent(s):
08197ec
Create BatchEncoding in pad
Browse files
qarac/corpora/CombinedCorpus.py
CHANGED
|
@@ -150,7 +150,7 @@ class CombinedCorpus(torch.utils.data.IterableDataset):
|
|
| 150 |
False)
|
| 151 |
for (key,value) in Y.items()}
|
| 152 |
Y['question_answering'] = torch.zeros((n,768))
|
| 153 |
-
return (
|
| 154 |
tuple([Y[key]
|
| 155 |
for key in ('encode_decode',
|
| 156 |
'question_answering',
|
|
@@ -180,8 +180,8 @@ class CombinedCorpus(torch.utils.data.IterableDataset):
|
|
| 180 |
if inputs:
|
| 181 |
attention_mask = torch.not_equal(input_ids,
|
| 182 |
self.pad_token)
|
| 183 |
-
result = {'input_ids':input_ids,
|
| 184 |
-
|
| 185 |
return result
|
| 186 |
|
| 187 |
|
|
|
|
| 150 |
False)
|
| 151 |
for (key,value) in Y.items()}
|
| 152 |
Y['question_answering'] = torch.zeros((n,768))
|
| 153 |
+
return (X,
|
| 154 |
tuple([Y[key]
|
| 155 |
for key in ('encode_decode',
|
| 156 |
'question_answering',
|
|
|
|
| 180 |
if inputs:
|
| 181 |
attention_mask = torch.not_equal(input_ids,
|
| 182 |
self.pad_token)
|
| 183 |
+
result = transformers.BatchEncoding({'input_ids':input_ids,
|
| 184 |
+
'attention_mask':attention_mask})
|
| 185 |
return result
|
| 186 |
|
| 187 |
|