oweller2 commited on
Commit
a00859f
1 Parent(s): 1f61dbc
Files changed (1) hide show
  1. modeling_flexbert.py +3 -0
modeling_flexbert.py CHANGED
@@ -1641,6 +1641,9 @@ class FlexBertForCausalLM(FlexBertPreTrainedModel):
1641
  return_dict = return_dict if return_dict is not None else self.config.use_return_dict
1642
  if self.unpad_embeddings and (indices is None and cu_seqlens is None and max_seqlen is None):
1643
  batch_size, seq_len = input_ids.shape[:2]
 
 
 
1644
  input_ids, indices, cu_seqlens, max_seqlen, position_ids, labels = self.unpad_inputs(
1645
  input_ids, attention_mask, position_ids, labels
1646
  )
 
1641
  return_dict = return_dict if return_dict is not None else self.config.use_return_dict
1642
  if self.unpad_embeddings and (indices is None and cu_seqlens is None and max_seqlen is None):
1643
  batch_size, seq_len = input_ids.shape[:2]
1644
+ if attention_mask is None:
1645
+ # create all ones
1646
+ attention_mask = torch.ones_like(input_ids)
1647
  input_ids, indices, cu_seqlens, max_seqlen, position_ids, labels = self.unpad_inputs(
1648
  input_ids, attention_mask, position_ids, labels
1649
  )