-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #85 from microsoft/move-files
CLEAN: Move all the functions from projects/modular_llm into mttl
- Loading branch information
Showing
38 changed files
with
452 additions
and
2,536 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,25 @@ | ||
# | ||
from mttl.models.packed_attention_monkey_patch import ( | ||
flash_attn_func_wrapper, | ||
flash_attn_varlen_func_wrapper, | ||
scaled_dot_product_attention, | ||
) | ||
|
||
try: | ||
import flash_attn | ||
from flash_attn import flash_attn_func, flash_attn_varlen_func | ||
|
||
flash_attn._default_flash_attn_func = flash_attn_func | ||
flash_attn._default_flash_attn_varlen_func = flash_attn_varlen_func | ||
flash_attn.flash_attn_varlen_func = flash_attn_varlen_func_wrapper | ||
flash_attn.flash_attn_func = flash_attn_func_wrapper | ||
except ImportError: | ||
from mttl.logging import logger | ||
|
||
logger.info("Flash Attention not available") | ||
|
||
import torch | ||
|
||
torch.nn.functional._default_scaled_dot_product_attention = ( | ||
torch.nn.functional.scaled_dot_product_attention | ||
) | ||
torch.nn.functional.scaled_dot_product_attention = scaled_dot_product_attention |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.