Update modeling_paragram_sp.py
Browse files- modeling_paragram_sp.py +5 -4
modeling_paragram_sp.py
CHANGED
@@ -13,11 +13,12 @@ class ParagramSPModel(BertPreTrainedModel):
|
|
13 |
def filter_input_ids(self, input_ids):
|
14 |
output = []
|
15 |
len = input_ids.shape[1]
|
16 |
-
for
|
|
|
17 |
filtered_ids = []
|
18 |
-
for
|
19 |
-
if
|
20 |
-
filtered_ids.append(
|
21 |
if len(filtered_ids) == 0:
|
22 |
filtered_ids = [0]
|
23 |
output.append(filtered_ids + [config.pad_token_id] * (len - len(filtered_ids)))
|
|
|
13 |
def filter_input_ids(self, input_ids):
|
14 |
output = []
|
15 |
len = input_ids.shape[1]
|
16 |
+
for i in range(input_ids.shape[0]):
|
17 |
+
ids = input_ids[i]
|
18 |
filtered_ids = []
|
19 |
+
for j in ids:
|
20 |
+
if j > 0:
|
21 |
+
filtered_ids.append(j)
|
22 |
if len(filtered_ids) == 0:
|
23 |
filtered_ids = [0]
|
24 |
output.append(filtered_ids + [config.pad_token_id] * (len - len(filtered_ids)))
|