Skip to content

[Unified Checkpoint] update merge tensor parallel#8856

Merged
wawltor merged 1 commit into
PaddlePaddle:developfrom
DesmonDay:update_uc_merge
Aug 1, 2024
Merged

[Unified Checkpoint] update merge tensor parallel#8856
wawltor merged 1 commit into
PaddlePaddle:developfrom
DesmonDay:update_uc_merge

Conversation

@DesmonDay
Copy link
Copy Markdown
Contributor

PR types

Others

PR changes

Others

Description

When merging large tensors, there may be not enough GPU memory to allocate due to VRAM fragmentation. Therefore we split the large tensors into smaller parts, and then merge these tensors on CPU.

@paddle-bot
Copy link
Copy Markdown

paddle-bot Bot commented Aug 1, 2024

Thanks for your contribution!

ret = distributed_allgather(tensor, group=tp_group, offload=False)
# Get tensor size
tensor_bytes = tensor.numel().item() * dtype_byte_size(tensor.dtype) * tp_group.nranks
if tensor_bytes >= 5368709120: # temporarily set 5GB as threshold
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No Magic Number。 tensor_bytes > 5*1024*1024*1024
建议再设置小一点。

@codecov
Copy link
Copy Markdown

codecov Bot commented Aug 1, 2024

Codecov Report

Attention: Patch coverage is 2.50000% with 39 lines in your changes missing coverage. Please review.

Project coverage is 55.42%. Comparing base (d406e56) to head (0a21315).
Report is 1 commits behind head on develop.

Current head 0a21315 differs from pull request most recent head 8ddf398

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

Files Patch % Lines
paddlenlp/trainer/plugins/unified_checkpoint.py 2.50% 39 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #8856      +/-   ##
===========================================
- Coverage    55.43%   55.42%   -0.02%     
===========================================
  Files          631      631              
  Lines        98544    98577      +33     
===========================================
+ Hits         54632    54633       +1     
- Misses       43912    43944      +32     

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

Copy link
Copy Markdown
Contributor

@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 d4975e0 into PaddlePaddle:develop Aug 1, 2024
DrownFish19 pushed a commit to DrownFish19/PaddleNLP that referenced this pull request Aug 2, 2024
DrownFish19 pushed a commit to DrownFish19/PaddleNLP that referenced this pull request Aug 2, 2024
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