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

add judgment of dataloader's length #355

Merged
merged 1 commit into from
May 31, 2023

Conversation

lijialin03
Copy link
Contributor

PR types

Others

PR changes

Others

Describe

add judgment of dataloader's length to avoid getting empty batch

@paddle-bot
Copy link

paddle-bot bot commented May 31, 2023

Thanks for your contribution!

Comment on lines 110 to 114
raise ValueError(
"batch_size should not bigger than number of samples when drop_last is True, "
"but got batch_size={} and number of samples={}".format(
sampler_cfg["batch_size"], len(_dataset)
)
Copy link
Collaborator

@HydrogenSulfate HydrogenSulfate May 31, 2023

Choose a reason for hiding this comment

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

batch_size({sampler_cfg['batch_size']}) should not bigger than number of samples({len(_dataset)}) when drop_last is {sampler_cfg.get('drop_last', False)}."

Copy link
Collaborator

@HydrogenSulfate HydrogenSulfate left a comment

Choose a reason for hiding this comment

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

LGTM

@HydrogenSulfate HydrogenSulfate merged commit 193162c into PaddlePaddle:develop May 31, 2023
huohuohuohuohuo123 pushed a commit to huohuohuohuohuo123/PaddleScience that referenced this pull request Aug 12, 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.

2 participants