File tree 3 files changed +9
-0
lines changed
pytorch/question-answering
tensorflow/question-answering
3 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -137,7 +137,9 @@ def postprocess_qa_predictions(
137
137
start_index >= len (offset_mapping )
138
138
or end_index >= len (offset_mapping )
139
139
or offset_mapping [start_index ] is None
140
+ or len (offset_mapping [start_index ]) < 2
140
141
or offset_mapping [end_index ] is None
142
+ or len (offset_mapping [end_index ]) < 2
141
143
):
142
144
continue
143
145
# Don't consider answers with a length that is either < 0 or > max_answer_length.
@@ -147,6 +149,7 @@ def postprocess_qa_predictions(
147
149
# provided).
148
150
if token_is_max_context is not None and not token_is_max_context .get (str (start_index ), False ):
149
151
continue
152
+
150
153
prelim_predictions .append (
151
154
{
152
155
"offsets" : (offset_mapping [start_index ][0 ], offset_mapping [end_index ][1 ]),
Original file line number Diff line number Diff line change @@ -137,7 +137,9 @@ def postprocess_qa_predictions(
137
137
start_index >= len (offset_mapping )
138
138
or end_index >= len (offset_mapping )
139
139
or offset_mapping [start_index ] is None
140
+ or len (offset_mapping [start_index ]) < 2
140
141
or offset_mapping [end_index ] is None
142
+ or len (offset_mapping [end_index ]) < 2
141
143
):
142
144
continue
143
145
# Don't consider answers with a length that is either < 0 or > max_answer_length.
@@ -147,6 +149,7 @@ def postprocess_qa_predictions(
147
149
# provided).
148
150
if token_is_max_context is not None and not token_is_max_context .get (str (start_index ), False ):
149
151
continue
152
+
150
153
prelim_predictions .append (
151
154
{
152
155
"offsets" : (offset_mapping [start_index ][0 ], offset_mapping [end_index ][1 ]),
Original file line number Diff line number Diff line change @@ -137,7 +137,9 @@ def postprocess_qa_predictions(
137
137
start_index >= len (offset_mapping )
138
138
or end_index >= len (offset_mapping )
139
139
or offset_mapping [start_index ] is None
140
+ or len (offset_mapping [start_index ]) < 2
140
141
or offset_mapping [end_index ] is None
142
+ or len (offset_mapping [end_index ]) < 2
141
143
):
142
144
continue
143
145
# Don't consider answers with a length that is either < 0 or > max_answer_length.
@@ -147,6 +149,7 @@ def postprocess_qa_predictions(
147
149
# provided).
148
150
if token_is_max_context is not None and not token_is_max_context .get (str (start_index ), False ):
149
151
continue
152
+
150
153
prelim_predictions .append (
151
154
{
152
155
"offsets" : (offset_mapping [start_index ][0 ], offset_mapping [end_index ][1 ]),
You can’t perform that action at this time.
0 commit comments