Skip to content

Commit

Permalink
Update squad_convert_example_to_features to work with numpy v2 (#35955
Browse files Browse the repository at this point in the history
)

* Fix

* Fix

* Fix

---------

Co-authored-by: ydshieh <[email protected]>
  • Loading branch information
2 people authored and ArthurZucker committed Jan 30, 2025
1 parent f3fad57 commit aa3e590
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/transformers/data/processors/squad.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ def squad_convert_example_to_features(
else:
p_mask[-len(span["tokens"]) : -(len(truncated_query) + sequence_added_tokens)] = 0

pad_token_indices = np.where(span["input_ids"] == tokenizer.pad_token_id)
pad_token_indices = np.where(np.atleast_1d(span["input_ids"] == tokenizer.pad_token_id))
special_token_indices = np.asarray(
tokenizer.get_special_tokens_mask(span["input_ids"], already_has_special_tokens=True)
).nonzero()
Expand Down

0 comments on commit aa3e590

Please sign in to comment.