wwydmanski commited on
Commit
ea297b5
1 Parent(s): 7296f33

fix: invalid variable

Browse files

Before: If user tries to run the code with float32 setting and flash_attention, they will encounter an undefined variable error, due to misspelling of `self.query`.
After: If user tries to run the code with float32 setting and flash_attention, they will correctly get a `float32 not supported `error

Files changed (1) hide show
  1. modeling_roberta.py +1 -1
modeling_roberta.py CHANGED
@@ -408,7 +408,7 @@ class RobertaFlashAttention2(RobertaSelfAttention):
408
  elif hasattr(self.config, "_pre_quantization_dtype"):
409
  target_dtype = self.config._pre_quantization_dtype
410
  else:
411
- target_dtype = self.q_lin.weight.dtype
412
 
413
  logger.warning_once(
414
  f"The input hidden states seems to be silently casted in float32, this might be related to"
 
408
  elif hasattr(self.config, "_pre_quantization_dtype"):
409
  target_dtype = self.config._pre_quantization_dtype
410
  else:
411
+ target_dtype = self.query.weight.dtype
412
 
413
  logger.warning_once(
414
  f"The input hidden states seems to be silently casted in float32, this might be related to"