add long sequence strategies #8076
Merged
Merged
Conversation
|
Thanks for your contribution! |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #8076 +/- ##
===========================================
- Coverage 56.56% 55.41% -1.16%
===========================================
Files 589 600 +11
Lines 89964 91642 +1678
===========================================
- Hits 50889 50782 -107
- Misses 39075 40860 +1785 ☔ View full report in Codecov by Sentry. |
gongel
reviewed
Mar 18, 2024
| if hasattr(model_config, "use_flash_attention"): | ||
| model_config.use_flash_attention = model_args.use_flash_attention | ||
|
|
||
| "intokens": true, | ||
| "zero_padding": false, | ||
| "use_flash_attention": false | ||
| } No newline at end of file |
|
|
||
| class AttentionWithLinearBias(nn.Layer): | ||
| """ | ||
| init_args:bool_attention_mask,num_heads,dtype,tensor_parallel_degree |
Member
There was a problem hiding this comment.
| + self._get_interleave(2 * closest_power_of_2)[0::2][: n - closest_power_of_2] | ||
| ) | ||
|
|
||
| def forward(self, bool_attention_mask: Tensor, num_heads: int, dtype: paddle.dtype, tensor_parallel_degree=1): |
| def _get_interleave(self, n): | ||
| def _get_interleave_power_of_2(n): | ||
| start = 2 ** (-(2 ** -(math.log2(n) - 3))) | ||
| ratio = start |
| """ | ||
| try: | ||
| import_class = importlib.import_module(f"paddlenlp.transformers.LongSequenceStrategies.{strategy_type}") | ||
| except ValueError: |
| strategy_class = getattr(import_class, stratety_name) | ||
| strategy_instance = strategy_class(**init_args) | ||
| return strategy_instance | ||
| except AttributeError: |
Member
There was a problem hiding this comment.
如果是strategy_class,报的错误是AttributeError?
JunnYu
reviewed
Mar 22, 2024
| @@ -0,0 +1,49 @@ | |||
| # Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved. | |||
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR types
PR changes
Models、APIs
Description
将长序列方案和模型解耦