Skip to content

Commit aa3e590

Browse files
ydshiehArthurZucker
authored andcommitted
Update squad_convert_example_to_features to work with numpy v2 (#35955)
* Fix * Fix * Fix --------- Co-authored-by: ydshieh <[email protected]>
1 parent f3fad57 commit aa3e590

File tree

1 file changed

+1
-1
lines changed
  • src/transformers/data/processors

1 file changed

+1
-1
lines changed

src/transformers/data/processors/squad.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ def squad_convert_example_to_features(
249249
else:
250250
p_mask[-len(span["tokens"]) : -(len(truncated_query) + sequence_added_tokens)] = 0
251251

252-
pad_token_indices = np.where(span["input_ids"] == tokenizer.pad_token_id)
252+
pad_token_indices = np.where(np.atleast_1d(span["input_ids"] == tokenizer.pad_token_id))
253253
special_token_indices = np.asarray(
254254
tokenizer.get_special_tokens_mask(span["input_ids"], already_has_special_tokens=True)
255255
).nonzero()

0 commit comments

Comments
 (0)