katuni4ka commited on
Commit
d799bfc
·
verified ·
1 Parent(s): e2db34a

Update modeling_baichuan.py

Browse files
Files changed (1) hide show
  1. modeling_baichuan.py +1 -1
modeling_baichuan.py CHANGED
@@ -59,7 +59,7 @@ def _make_causal_mask(
59
  Make causal mask used for bi-directional self-attention.
60
  """
61
  bsz, tgt_len = input_ids_shape
62
- mask = torch.full((tgt_len, tgt_len), torch.tensor(torch.finfo(dtype).min, device=device, dtype=dtype), device=device, dtype=dtype)
63
  mask_cond = torch.arange(mask.size(-1), device=device)
64
  mask.masked_fill_(mask_cond < (mask_cond + 1).view(mask.size(-1), 1), 0)
65
  mask = mask.to(dtype)
 
59
  Make causal mask used for bi-directional self-attention.
60
  """
61
  bsz, tgt_len = input_ids_shape
62
+ mask = torch.full((tgt_len, tgt_len), float("-inf"), device=device)
63
  mask_cond = torch.arange(mask.size(-1), device=device)
64
  mask.masked_fill_(mask_cond < (mask_cond + 1).view(mask.size(-1), 1), 0)
65
  mask = mask.to(dtype)