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

[Unified Checkpoint] update merge tensor parallel #8856

Merged
merged 1 commit into from
Aug 1, 2024

Conversation

DesmonDay
Copy link
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.

Copy link

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
Collaborator

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
建议再设置小一点。

Copy link

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
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 d4975e0 into PaddlePaddle:develop Aug 1, 2024
10 of 12 checks passed
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