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

[BUG] num_samples 向下去整, 防止prefrech预取时候超过数据集最大长度... #8690

Merged
merged 1 commit into from
Jul 3, 2024

Conversation

JunnYu
Copy link
Member

@JunnYu JunnYu commented Jul 1, 2024

PR types

Bug fixes

PR changes

APIs

Description

num_samples 向下去整, 防止prefrech预取时候超过数据集最大长度...

# 该情况下,计算存在问题,当向上去整的时候2848会超过数据集的最大长度2844
len(self.dataset) = 2844
self.nranks = 8
int( len(self.dataset)* 1.0 / self.nranks) * self.nranks = 2840
int(ceil(len(self.dataset)* 1.0 / self.nranks)) * self.nranks = 2848
# 该情况下计算不会有问题,因为整除了
len(self.dataset) = 2844
self.nranks = 4
int( len(self.dataset)* 1.0 / self.nranks) * self.nranks = 2844
int(ceil(len(self.dataset)* 1.0 / self.nranks)) * self.nranks = 2844

Copy link

paddle-bot bot commented Jul 1, 2024

Thanks for your contribution!

Copy link

codecov bot commented Jul 1, 2024

Codecov Report

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

Project coverage is 55.61%. Comparing base (2723138) to head (a2094dc).
Report is 230 commits behind head on develop.

Files with missing lines Patch % Lines
paddlenlp/utils/batch_sampler.py 0.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #8690      +/-   ##
===========================================
- Coverage    55.61%   55.61%   -0.01%     
===========================================
  Files          620      620              
  Lines        96965    96964       -1     
===========================================
- Hits         53930    53929       -1     
  Misses       43035    43035              

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

@ZHUI ZHUI merged commit 85cbada into develop Jul 3, 2024
10 of 13 checks passed
@ZHUI ZHUI deleted the fix_DistributedBatchSampler branch September 26, 2024 08:13
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