Update llama.py
This commit is contained in:
parent
686a97d750
commit
8e899bf956
1 changed files with 4 additions and 0 deletions
|
|
@ -738,6 +738,10 @@ def LlamaModel_fast_forward(
|
|||
past_key_values_length,
|
||||
sliding_window = None,
|
||||
)
|
||||
# Fixes https://github.com/unslothai/unsloth/issues/853
|
||||
# Unsloth needs a 2D mask, not a [2, 1, n, n] mask!
|
||||
if self.SWA_mask.dim() == 4: self.SWA_mask = self.SWA_mask[0][0]
|
||||
if self. GA_mask.dim() == 4: self. GA_mask = self. GA_mask[0][0]
|
||||
elif not hasattr(self, "SWA_mask"):
|
||||
if HAS_FLEX_ATTENTION:
|
||||
# Use Flex Attention instead!
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue