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

[XPU] use allgather and fp32 multinomial for XPU #8787

Merged
merged 1 commit into from
Jul 22, 2024

Conversation

houj04
Copy link
Contributor

@houj04 houj04 commented Jul 19, 2024

PR types

New features

PR changes

Models

Description

针对XPU的特性修改两处:

Copy link

paddle-bot bot commented Jul 19, 2024

Thanks for your contribution!

Copy link

codecov bot commented Jul 19, 2024

Codecov Report

Attention: Patch coverage is 33.33333% with 4 lines in your changes missing coverage. Please review.

Project coverage is 55.49%. Comparing base (dedf4c5) to head (b58803c).
Report is 222 commits behind head on develop.

Files with missing lines Patch % Lines
paddlenlp/peft/lora/lora_model.py 25.00% 3 Missing ⚠️
paddlenlp/generation/utils.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #8787      +/-   ##
===========================================
+ Coverage    55.44%   55.49%   +0.05%     
===========================================
  Files          626      626              
  Lines        98064    98069       +5     
===========================================
+ Hits         54367    54427      +60     
+ Misses       43697    43642      -55     

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

@houj04 houj04 closed this Jul 22, 2024
@houj04 houj04 reopened this Jul 22, 2024
@@ -42,7 +42,7 @@
load_state_dict,
)
from ...transformers.utils import get_checkpoint_shard_files, weight_name_suffix
from ...utils.distributed import distributed_gather
from ...utils.distributed import distributed_allgather, distributed_gather
from ...utils.env import LORA_WEIGHTS_NAME, SAFE_PEFT_WEIGHTS_INDEX_NAME
Copy link
Collaborator

Choose a reason for hiding this comment

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

在XPU和GPU的接口里面可以直接同时import distributed_allgather 和 distributed_gather 吗

Copy link
Contributor Author

@houj04 houj04 Jul 22, 2024

Choose a reason for hiding this comment

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

参考代码是:#8697
改这个的原因是,XPU目前不支持gather。
gather和allgather对于rank0是一样的,对于非rank0不同。但是代码逻辑中有is_dst的控制,非rank0的反正都会扔掉不要,所以就直接替换了。

Copy link
Collaborator

@wawltor wawltor left a comment

Choose a reason for hiding this comment

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

LGTM

@wawltor wawltor merged commit 88d4b19 into PaddlePaddle:develop Jul 22, 2024
12 of 14 checks passed
FeixLiu pushed a commit to FeixLiu/PaddleNLP that referenced this pull request Jul 26, 2024
FeixLiu pushed a commit to FeixLiu/PaddleNLP that referenced this pull request Jul 26, 2024
gongel pushed a commit that referenced this pull request Jul 31, 2024
* xpu use allgather (#8697)

* xpu use allgather

* xpu use allgather

* fix xpu gather for unified ckpt (#8710)

* bug fix (#8730)

* [XPU] use allgather and fp32 multinomial for XPU (#8787)

---------

Co-authored-by: houj04 <35131887+houj04@users.noreply.github.com>
@ZHUI ZHUI added the XPU label Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants