fix reformer apex scaling issue (#4242)
This commit is contained in:
@@ -562,8 +562,8 @@ class LSHSelfAttention(nn.Module, EfficientAttentionMixin):
|
||||
|
||||
# get correct mask values depending on precision
|
||||
if query_key_dots.dtype == torch.float16:
|
||||
self_mask_value = self.self_mask_value_float16
|
||||
mask_value = self.mask_value_float16
|
||||
self_mask_value = self.self_mask_value_float16.half()
|
||||
mask_value = self.mask_value_float16.half()
|
||||
else:
|
||||
self_mask_value = self.self_mask_value_float32
|
||||
mask_value = self.mask_value_float32
|
||||
@@ -834,7 +834,7 @@ class LocalSelfAttention(nn.Module, EfficientAttentionMixin):
|
||||
if mask is not None:
|
||||
# get mask tensor depending on half precision or not
|
||||
if query_key_dots.dtype == torch.float16:
|
||||
mask_value = self.mask_value_float16
|
||||
mask_value = self.mask_value_float16.half()
|
||||
else:
|
||||
mask_value = self.mask_value_float32
|
||||
|
||||
|
||||
Reference in New Issue
Block a user