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

Fix paddle.where #9652

Merged
merged 1 commit into from
Dec 18, 2024
Merged

Fix paddle.where #9652

merged 1 commit into from
Dec 18, 2024

Conversation

will-jl944
Copy link
Contributor

PR types

Bug fixes

PR changes

Models

Description

Force condition of padlde.where to be a boolean tensor.

Copy link

paddle-bot bot commented Dec 17, 2024

Thanks for your contribution!

Copy link

codecov bot commented Dec 17, 2024

Codecov Report

Attention: Patch coverage is 0% with 8 lines in your changes missing coverage. Please review.

Project coverage is 52.81%. Comparing base (da7a7d2) to head (8a57fab).
Report is 4 commits behind head on develop.

Files with missing lines Patch % Lines
paddlenlp/transformers/llama/modeling.py 0.00% 8 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #9652      +/-   ##
===========================================
- Coverage    52.81%   52.81%   -0.01%     
===========================================
  Files          710      710              
  Lines       111238   111241       +3     
===========================================
  Hits         58749    58749              
- Misses       52489    52492       +3     

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

Copy link
Collaborator

@DrownFish19 DrownFish19 left a comment

Choose a reason for hiding this comment

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

LGTM

expanded_attn_mask = paddle.where(expanded_attn_mask.cast("bool"), x, y).astype(dtype)
elif get_env_device() == "xpu":
x = paddle.to_tensor(0.0, dtype="float32")
y = paddle.to_tensor(-1.7005809656952787e38, dtype="float32")
Copy link
Collaborator

Choose a reason for hiding this comment

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

这里默认fp32吗?结束之后缺少.astype(dtype),是否结果一致?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

是的,xpu的fa算子需要输入mask为fp32数据类型

Copy link
Collaborator

Choose a reason for hiding this comment

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

已确认,XPU使用fp32

@wawltor wawltor merged commit b9cf723 into PaddlePaddle:develop Dec 18, 2024
8 of 12 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