Skip to content

Conversation

@cqulilujia
Copy link
Contributor

PR types

Function optimization

PR changes

Others

Description

Support unified ckpt function on XPU

@paddle-bot
Copy link

paddle-bot bot commented Oct 24, 2024

Thanks for your contribution!

@paddle-bot paddle-bot bot added the XPU label Oct 24, 2024
@codecov
Copy link

codecov bot commented Oct 24, 2024

Codecov Report

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

Project coverage is 52.92%. Comparing base (7551730) to head (9cdabb6).
Report is 263 commits behind head on develop.

Files with missing lines Patch % Lines
paddlenlp/trainer/trainer.py 0.00% 5 Missing ⚠️
paddlenlp/trainer/plugins/unified_checkpoint.py 0.00% 2 Missing ⚠️
Additional details and impacted files
@@ Coverage Diff @@ ## develop #9312 +/- ## =========================================== + Coverage 52.80% 52.92% +0.11%  =========================================== Files 660 660 Lines 106869 106875 +6 =========================================== + Hits 56434 56564 +130  + Misses 50435 50311 -124 

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

if paddle.is_compiled_with_xpu():
# XPU does not support all_reduce prod now, in XPU, bool is treated as int8,
# so temporarily use reduce_min instead
dist.all_reduce(local_resume, op=dist.ReduceOp.MIN)
Copy link
Contributor

Choose a reason for hiding this comment

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

那就统一改成dist.all_reduce(local_resume, op=dist.ReduceOp.MIN)吧,不需要特地区分XPU和GPU

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

if paddle.is_compiled_with_xpu():
# XPU does not support all_reduce prod now, in XPU, bool is treated as int8,
# so temporarily use reduce_min instead
dist.all_reduce(local_resume, op=dist.ReduceOp.MIN)
Copy link
Contributor

Choose a reason for hiding this comment

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

同上

DesmonDay
DesmonDay previously approved these changes Oct 24, 2024
Copy link
Contributor

@DesmonDay DesmonDay left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@zhiqiu zhiqiu left a comment

Choose a reason for hiding this comment

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

LGTM

@cqulilujia cqulilujia changed the title [XPU], support unified ckpt function [XPU] support unified ckpt function Oct 25, 2024
@wawltor wawltor merged commit b237ba7 into PaddlePaddle:develop Oct 25, 2024
2 of 4 checks passed
if not len(checkpoint_rng_state["cuda"]) == core.get_xpu_device_count():
raise ValueError("Length of xpu state list shoule be equal to the xpu device count")
for i in range(core.get_xpu_device_count()):
core.default_xpu_generator(i).set_state(checkpoint_rng_state["cuda"][i])
Copy link
Contributor

Choose a reason for hiding this comment

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

这里 xpu 很下面 custom device 处理会有不同吗?更适合框架测修改吧。

Copy link
Contributor Author

@cqulilujia cqulilujia Oct 25, 2024

Choose a reason for hiding this comment

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

在框架侧的device上XPU和GPU、CPU是同一级别的,custom device(如海光、昇腾等)是放在一起的

Copy link
Contributor Author

Choose a reason for hiding this comment

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

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

5 participants