Skip to content

How to apply uniform length batching(smart batching)? #9740

Discussion options

You must be logged in to vote

you can sort the data by len initially while creating the dataset itself. now just use a sequential sampler to avoid shuffle by just setting shuffle=False inside dataloader. collate_fn looks good, although can be optimized a little bit. apart from that even if you use auto_scale_batch_size, it will work just fine since your dataset will already be sorted by length.

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by rohitgr7
Comment options

You must be logged in to vote
2 replies
@rohitgr7
Comment options

@sooftware
Comment options

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