Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove refined recompute deep copy #9617

Open
wants to merge 14 commits into
base: develop
Choose a base branch
from

Conversation

JunnYu
Copy link
Member

@JunnYu JunnYu commented Dec 11, 2024

PR types

Function optimization

PR changes

APIs

Description

删除refined recompute对config的deep copy操作。
添加对应的文档介绍。

Copy link

paddle-bot bot commented Dec 11, 2024

Thanks for your contribution!

@JunnYu JunnYu requested a review from DesmonDay December 11, 2024 10:03
@@ -484,13 +484,13 @@ def forward(self, hidden_states):


class QWenBlock(nn.Layer):
def __init__(self, config):
def __init__(self, config, layer_idx: int = 0):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QwenBlock的外部调用,缺少了layer_idx的输入,可以检查一下。

@JunnYu JunnYu requested a review from ZHUI December 18, 2024 09:46
Copy link

codecov bot commented Dec 18, 2024

Codecov Report

Attention: Patch coverage is 43.75000% with 27 lines in your changes missing coverage. Please review.

Project coverage is 52.79%. Comparing base (1842d6d) to head (688eb18).
Report is 1 commits behind head on develop.

Current head 688eb18 differs from pull request most recent head c81a8b3

Please upload reports for the commit c81a8b3 to get more accurate results.

Files with missing lines Patch % Lines
paddlenlp/transformers/llama/modeling.py 38.46% 8 Missing ⚠️
paddlenlp/transformers/qwen/modeling.py 42.85% 8 Missing ⚠️
paddlenlp/transformers/qwen2/modeling.py 38.46% 8 Missing ⚠️
paddlenlp/transformers/refined_recompute.py 25.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #9617      +/-   ##
===========================================
- Coverage    53.18%   52.79%   -0.40%     
===========================================
  Files          718      718              
  Lines       113340   112256    -1084     
===========================================
- Hits         60282    59267    -1015     
+ Misses       53058    52989      -69     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

paddlenlp/trainer/training_args.py Show resolved Hide resolved
"",
"refined_recompute, Choose from 'mlp_row_ln', 'mlp_column_ln', 'attention_row_ln', 'attention_column_ln', 'flash_attn']",
),
("skip_recompute_ops", Optional[Dict[str, int]], None, "skip_recompute_ops"),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

skip_recompute_ops 这个没有了,现在加在哪里?

@@ -138,9 +138,9 @@ def get_triangle_upper_mask(x, mask=None):


class QWenAttention(nn.Layer):
def __init__(self, config):
def __init__(self, config, layer_idx: int = 0):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个是必需加layer_idx的吗?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

必须加,不然不知道第几层是不是需要开启rr

Comment on lines 565 to 567
self.refined_recompute = kwargs.pop("refined_recompute", {})
self.skip_recompute_ops = kwargs.pop("skip_recompute_ops", {})
self.register_unsavable_keys(["refined_recompute", "skip_recompute_ops"])
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

放到这里了,作为config基类里面的属性,默认都是空字典

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

加入到不保存的配置里吧,否则可能影响下游推理等任务加载。

"You can also set `skip_num` to a value within the range [1, ..., num_layers]. If `skip_num` exceeds `num_layers`, it will behave as if set to `-1`.\n"
"If a parameter is omitted, it defaults to `xxx:0`."
},
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines 565 to 567
self.refined_recompute = kwargs.pop("refined_recompute", {})
self.skip_recompute_ops = kwargs.pop("skip_recompute_ops", {})
self.register_unsavable_keys(["refined_recompute", "skip_recompute_ops"])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

加入到不保存的配置里吧,否则可能影响下游推理等任务加载。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants