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

paddle support stride, fix dy2st #6539

Merged
merged 5 commits into from
Aug 3, 2023

Conversation

wanghuancoder
Copy link
Contributor

PR types

Others

PR changes

Others

Description

Paddle支持stride后,需要检查动转静不一致的情况。但检查难度大,简单的检查会有误报,但这种方式获得评审会的同意。通过with可以避免误报。

@paddle-bot
Copy link

paddle-bot bot commented Jul 28, 2023

Thanks for your contribution!

Copy link
Member

@ZeyuChen ZeyuChen left a comment

Choose a reason for hiding this comment

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

不能新增Fluid相关API,如果API很关键新增非Fluid目录下的API

Copy link
Member

@ZeyuChen ZeyuChen left a comment

Choose a reason for hiding this comment

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

Add more comment and future TODO

@@ -1351,8 +1351,9 @@ def forward(

option_logits = paddle.matmul(q.unsqueeze(1), k, transpose_y=True).squeeze(1)
option_logits = option_logits / self.predict_size**0.5
for index, logit in enumerate(option_logits):
option_logits[index] -= (1 - (omask_positions[index] > 0).astype("float32")) * 1e12
with paddle.fluid.framework._stride_in_no_check_dy2st_diff():
Copy link
Collaborator

Choose a reason for hiding this comment

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

需要保证旧版本的paddle正常运行,如 paddle 2.4.0

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done, thx!

@wanghuancoder
Copy link
Contributor Author

不能新增Fluid相关API,如果API很关键新增非Fluid目录下的API

done, thx!

@wanghuancoder
Copy link
Contributor Author

Add more comment and future TODO

done, thx!


if hasattr(paddle.framework, "_no_check_dy2st_diff"):
Copy link
Collaborator

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@ZeyuChen ZeyuChen left a comment

Choose a reason for hiding this comment

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

LGTM

@codecov
Copy link

codecov bot commented Aug 3, 2023

Codecov Report

Merging #6539 (ef73ce9) into develop (38a2be0) will decrease coverage by 0.01%.
Report is 1 commits behind head on develop.
The diff coverage is 50.00%.

@@             Coverage Diff             @@
##           develop    #6539      +/-   ##
===========================================
- Coverage    62.94%   62.93%   -0.01%     
===========================================
  Files          531      531              
  Lines        77721    77725       +4     
===========================================
- Hits         48918    48917       -1     
- Misses       28803    28808       +5     
Files Changed Coverage Δ
paddlenlp/transformers/ernie/modeling.py 90.07% <50.00%> (-0.67%) ⬇️

... and 1 file with indirect coverage changes

@ZeyuChen ZeyuChen merged commit c7c65c5 into PaddlePaddle:develop Aug 3, 2023
4 checks passed
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