Skip to content

Commit

Permalink
replace boolean causal mask for int64 causal mask
Browse files Browse the repository at this point in the history
  • Loading branch information
dbogunowicz committed Jul 26, 2023
1 parent e324cdc commit 91118e6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/deepsparse/transformers/utils/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def pad_to_fixed_length(
def create_causal_mask(
input_ids: Union[numpy.ndarray, List[int]],
attention_mask: Union[numpy.ndarray, List[int]],
dtype: numpy.dtype = numpy.bool_,
dtype: numpy.dtype = numpy.int64,
) -> numpy.ndarray:
"""
Compute a causal from a set of module inputs.
Expand Down
4 changes: 1 addition & 3 deletions tests/deepsparse/transformers/utils/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,4 @@
)
def test_create_causal_mask(input_ids, attention_mask, expected_causal_mask):
causal_mask = create_causal_mask(input_ids, attention_mask)
assert numpy.array_equal(
causal_mask, expected_causal_mask[None, None, ...].astype(numpy.bool_)
)
assert numpy.array_equal(causal_mask, expected_causal_mask[None, None, ...])

0 comments on commit 91118e6

Please sign in to comment.