Skip to content

Commit

Permalink
Use -inf for sliding window mask value
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 686189315
  • Loading branch information
talumbau authored and copybara-github committed Oct 15, 2024
1 parent ddb7bf7 commit bd494dc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ai_edge_torch/generative/layers/attention_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def build_sliding_window_mask_cache(
sliding_mask = torch.triu(all_ones, -1 * window_size + 1) * torch.tril(
all_ones, window_size - 1
)
return torch.where(sliding_mask == 1, mask, -2.3819763e38)
return torch.where(sliding_mask == 1, mask, float('-inf'))


def relative_position_bucket(
Expand Down

0 comments on commit bd494dc

Please sign in to comment.