Ubuntu commited on
Commit
d4fc678
·
1 Parent(s): 5e69ce3

Handling None type attention-mask

Browse files
Files changed (1) hide show
  1. modeling_hinvec.py +3 -0
modeling_hinvec.py CHANGED
@@ -61,6 +61,9 @@ class BidirectionalMistralModel(MistralModel):
61
  else:
62
  raise ValueError("You have to specify either decoder_input_ids or decoder_inputs_embeds")
63
 
 
 
 
64
  if self.gradient_checkpointing and self.training and use_cache:
65
  logger.warning_once(
66
  "`use_cache=True` is incompatible with gradient checkpointing. Setting `use_cache=False`."
 
61
  else:
62
  raise ValueError("You have to specify either decoder_input_ids or decoder_inputs_embeds")
63
 
64
+ if attention_mask is None:
65
+ attention_mask = torch.ones(batch_size, seq_length, dtype=input_ids.dtype, device=input_ids.device)
66
+
67
  if self.gradient_checkpointing and self.training and use_cache:
68
  logger.warning_once(
69
  "`use_cache=True` is incompatible with gradient checkpointing. Setting `use_cache=False`."