robinzixuan commited on
Commit
3bad039
1 Parent(s): 3abefd7

Upload modeling_bert.py

Browse files
Files changed (1) hide show
  1. modeling_bert.py +2 -4
modeling_bert.py CHANGED
@@ -186,8 +186,7 @@ def load_tf_weights_in_bert(model, config, tf_checkpoint_path):
186
  array = np.transpose(array)
187
  try:
188
  if pointer.shape != array.shape:
189
- raise ValueError(f"Pointer shape {pointer.shape} and array shape {
190
- array.shape} mismatched")
191
  except ValueError as e:
192
  e.args += (pointer.shape, array.shape)
193
  raise
@@ -845,8 +844,7 @@ class BertLayer(nn.Module):
845
  if self.is_decoder and encoder_hidden_states is not None:
846
  if not hasattr(self, "crossattention"):
847
  raise ValueError(
848
- f"If `encoder_hidden_states` are passed, {
849
- self} has to be instantiated with cross-attention layers"
850
  " by setting `config.add_cross_attention=True`"
851
  )
852
 
 
186
  array = np.transpose(array)
187
  try:
188
  if pointer.shape != array.shape:
189
+ raise ValueError(f"Pointer shape {pointer.shape} and array shape {array.shape} mismatched")
 
190
  except ValueError as e:
191
  e.args += (pointer.shape, array.shape)
192
  raise
 
844
  if self.is_decoder and encoder_hidden_states is not None:
845
  if not hasattr(self, "crossattention"):
846
  raise ValueError(
847
+ f"If `encoder_hidden_states` are passed, {self} has to be instantiated with cross-attention layers"
 
848
  " by setting `config.add_cross_attention=True`"
849
  )
850